Getting certain posts to Zapier

Hi there, I’m seeing if we can integrate Discourse with another tool we are using via Zapier. I was hoping to have some webhook triggering event that could be post specific and would send the post information through in the webhook delivery. Tags seem to be at the Topic level and don’t let you be specific to a post. Badges can be granted via a post, but don’t seem to trigger the proper webhook delivery.

Is there a way to do this?

Thanks!

Yes, this can be done by using a Zapier Webhook as the trigger app, and configuring a Discourse Webhook to post to Zapier. The ‘Set up Trigger’ section of Discourse Webhooks and Zapier gives details about how to configure this. Could you read through that topic? If anything is unclear, ask your questions in that topic and we’ll get back to you.

5 Likes

Hi Simon, thanks for the info! :pray:

I did try to set this up with the webhooks, but I could only see the option to send every post to Zapier rather than being able to manually curate which ones to send. So just specific posts being sent through. Do you know if there is a configuration / way to pick posts that can achieve that?

2 Likes

You can limit which posts or topics will trigger the webhook on Discourse in the webhook’s Triggered Categories, Triggered Tags, and Triggered Groups settings. Creating a tag group that has tags that can only be seen or used by staff members could be a good way of limiting the webhook to specific topics.

You can also add a filter step on Zapier to only continue if the topic meets some condition that you specify. There is an example of how to set this up for a user webhook in the ‘Catch the Discourse User Created Event’ section of Create a Salesforce lead via Zapier when a user signs up on Discourse. Setting this up a filter for a topic or a post on Zapier would be a similar process.

My understanding is that if a Zap is allowed to progress as far as its filter step, that event will be counted as a task on Zapier. It would be best to filter out as much as possible on Discourse before sending the request on to Zapier. Filtering by categories, tags, and groups is the best way to achieve this.

3 Likes

Thanks again @simon! I played around with the configuration options that you are talking about, but I couldn’t figure out something at the post level that would let me react to some post specific data change in discourse that would indicate that the post should be sync’ed over to this other system.

I can definitely send over everything for a Topic with a given tag, I’ve seen that work. It does require a higher level of Zapier account in terms of putting together the appropriate zap and handling the resulting number of tasks, which may be ok. What I haven’t figured out though is how some admin in discourse can do something to a post that would trigger a webhook in a way where zapier could tell that a specfic post in the topic should be sent across (rather than all posts in the tagged topic).

I’m completely new to Discourse, so I’m wondering if there is something post specific that I’m missing.

Filtering on a post level is probably going to have to happen on Zapier. What sort of data do you want to use to determine whether or not the Zap is fired?

3 Likes

That’s a spot where my Discourse knowledge definitely falls down. I’m not sure what data is specific to a post, that can be used to specify that the post should be sync’ed, and is passed through to the webhook payload.

Flags serve a different purpose… not sure that would work.
We don’t want to change the user visible post content.
Badges seem possible, but I don’t see them triggering the webhooks.

Any ideas?

My first thought was that filtering either for posts that have been marked as solved, or posts that have been liked by a staff member would work. Unfortunately, neither of those actions trigger a webhook. I think there are good reasons for not triggering a webhook on likes, but possibly something could be developed to trigger a webhook when a topic is marked as solved.

For triggering webhooks on specific posts with the current Discourse functionality, you could try setting up a webhook that fires on Flag Events. On Zapier you could filter the flagged posts by looking for posts that have been flagged as “Something Else” by a specific user on your site.

The easiest way to see the payload that gets passed with a Flag Event is to create a webhook on Discourse with the Flag Event selected as its trigger. For testing this, you can enter any URL into the webhook’s Payload URL field, for example http://example.com. After flagging a post on your site, go to Admin / API / Webhooks and click on the ‘Delivery Status’ link to get to the webhook’s request list.

Click on the Request button to see the payload that has been passed by the webhook.

On Zapier you should be able to access any of the values in the request’s Payload. To filter for posts that have been flagged as “Something Else” by a specific user, you’ll need to check that the request’s flag_type is notify_moderators and that the request’s created_by field is set to the username of the user you would like to trigger your Zapier action.

3 Likes

Ok, I can see how that could work. Would people see that the posts we are talking about here are being flagged? We’d want that specific content for “Something Else” as the flagging reason… which is a bit of black magic as far as the people who’d be wanting to trigger this webhook would be concerned. Is there any way to add actions to a post that could automate those steps (or if we can add actions, a way to simply create an action that gathers the information we want about the post and calls out to a zapier webhook action endpoint with it)?

Thanks for all your help, very much appreciated!

Only staff members can see that a post has been flagged as “Something Else.”

Unfortunately, the message that is added when a post is flagged as “Something Else” is not included in the webhook’s payload. For this reason, I don’t think this is going to be the best approach for you.

An engineer will need to confirm this, but I think it would be fairly straightforward to create a plugin that fired a custom webhook when a staff member clicks a button that is added to the post Admin Actions menu.

3 Likes

This is indeed the case.

3 Likes

Awesome, thank you both for the help.

Would you say that this is the best spot to look at what plugin dev looks like?

Yes, if you would like to develop the plugin yourself, that is the best place to start.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.