MS Power automate and discourse

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