MS Power automate and discourse

Sorry for the half baked idea up front, but I’m trying to figure out a way to simplify my administration of groups across platforms.

We schedule a lot of meetings and those meetings are announced to our community via a Discourse post. The discourse post usually includes a lot of boiler plate about where, when and how and typically includes a .ics file for people to add to their calendars.

This is currently built manually after it’s added to other platforms (e.g. our internal exchange server, our community calendar, etc.). I’m trying to figure out if I can somehow automate a lot of this work and just started looking at MS Power Automate.

I’m wondering if there’s a way to integrate discourse into a Power Automate workflow so posts are generated as part of a large set of actions around scheduling a meeting.

Any thoughts would be greatly appreciated.

1 Like

I’d start by looking at Events Plugin :calendar:.

2 Likes

Thanks but not what I’m looking for.

We work with @angus and he makes wonderful tools but I’m looking for a way to automate workflows across systems which integrate Discourse, not to use discourse as my primary events management system.

Sorry if this wasn’t clear

3 Likes

This is certainly achievable from a Discourse perspective but I don’t know anything about Power Automate. The Discourse API can be used to create posts and the simplest way of using the API for something like this would be by making a web request.

If Power Automate gives you the power to automate (sorry :slight_smile:) constructing the post content using information from the event you’ve created, as well as send a POST web request with arbitrary headers and body, you will be able to create a topic with it.

Discourse API Docs: Creates a new topic, a new post, or a private message

Adding the ics file to the topic is a bit more involved but also achievable. I think you would need to create the upload first and get its short_path from the response, then include Markdown like ![Event_title.ics](short_path) in the constructed post content.

That might not be accurate but that’s the general idea, using the response from creating the upload to add it to the post in the same format your existing ics uploads are in.

Discourse API Docs: Creates an upload

An API key can be created by visiting /admin/api/keys on your instance. It would need granular scope with topics:write and uploads:create enabled and you probably want to select a single user which the topic will appear to be created by.

Note: The uploads:create scope doesn’t exist yet but it’s in the process of being added. You can find discussion about that and track its progress in the following topic and the linked pull request:

2 Likes