Using the Zapier Discourse Zap Templates

Zapier has released 10 official Discourse zap templates. These templates make it possible to connect Discourse with an external application with minimal configuration. You can find them here:

Scroll down that page to see the list of the currently available integrations.

These templates are divided into two types. In the first type, Discourse is the trigger app. These templates allow you to publish Discourse posts to Slack, Mattermost, Discord, Rocket.Chat, Facebook Groups, Facebook Pages, and Twitter. In the second type of template, Discourse is the action app. With these templates you can publish posts from WordPress, and Ghost to Discourse. There is also a template for publishing Twitch live streams to Discourse.

Adding your Discourse credentials on Zapier

To use any of the Zapier Discourse integrations, you will need to add your forum’s base URL, as well as your Discourse username and API Key when you first setup the Zap.

For most cases, the Zap should be configured by a site admin with their Discourse username and API Key. API Keys can be generated on Discourse in the Permissions section of an Admin / User page. API Keys can be retrieved from that page when they are first created, or from the Admin / API page if you need to retrieve them at a later time.

After adding your Discourse credentials to Zapier, click the Continue button. You should see a Success message on the screen.

Configuring which posts the Zap will retrieve

When Discourse is the trigger app, by default all new posts on your site will trigger the Zap. You can limit the Zap to only be triggered for posts created in a specific topic, or to only be triggered for posts created by a specific user, in the optional ‘Edit Options’ step.

Use the step’s Topic dropdown menu to select a specific topic that should trigger the Zap. When this is configured, only posts created in the chosen topic will be retrieved by Zapier. Use the step’s Author dropdown menu to select a username for the Zap. When configured, only posts created by this user will be retrieved by Zapier.

Adding a filter step for finer control over posts

If the ‘Edit Options’ step doesn’t give you enough control over which posts are used to trigger the Zap, you can add an optional Filter step to the Zap. An example of what can be done with a Filter is that you could choose to only have the Zap continue if the post is the first post in a specific category. To add a Filter, click the :heavy_plus_sign: icon that’s below the Trigger, and then select ‘Filter’ from the menu.

The filter will allow you to set the conditions under which the Zap should continue. The example below will only continue if the post is the first post in a topic that is in the category with an ID of 2.

Selecting the Discourse content to publish

When publishing posts from Discourse to another application, Zapier will allow you to select which part of the post you’d like to publish. What you choose to publish will depend on the application you are publishing to. I’ll use publishing a Discourse post to a Facebook Group as an example.

The form’s Message field sets the content that will be published. To publish the full post content, select the ‘Raw’ field from the Message dropdown. To just publish the topic’s title, select ‘Topic Title’ from the dropdown.

Constructing a link to a post or a topic

When publishing a Discourse post to an external application, you may need to construct a link to the post or its topic from the data that is returned from Discourse. To do this, enter your site’s base URL into the field you’re adding the link to, followed by /t/. For example, if your site’s URL is https://discourse.example.com, enter https://discourse.example.com/t/ into the form.

Now open the field’s dropdown menu and select Topic Slug from the menu.

Zapier will add a placeholder for the topic slug to the field.

Now enter a slash (/) after the topic slug placeholder and then select Topic ID from the dropdown menu.

The final result will look similar to the screenshot below.

To construct a link to specific posts in a topic, add another slash (/) to the field and then select Post Number from the menu.

Note that the values of any placeholders you use in setting up the Zap will be replaced by the values passed from Discourse when a new post is published.

Creating integrations without a template

The Zapier templates that are listed on their integrations page are designed to make it easy to connect Discourse with an external application. If you would like to connect Discourse to an application that doesn’t have a template, or if you would like to create a Zap that listens for a Discourse webhook, or makes a POST request to the Discourse API, you can do that by following or modifying one of the guides listed here:

13 Likes