Post commits via webhook inside a topic as reply

Hey guys,
I searched but couldn’t find the proper direction.

I want to automatically post a reply inside a topic as soon as I pushed a commit on a github repository - automatically via a webhook.

I work with Integromat and already successfully did something similar with topics

I have setup an API in Discourse, a webhook in Github, a HTTP POST scenario in Integromat but I’m missing the final piece to make it work.

My current attempt looks like this which does not work.

I think because Discourse does not know what to do with the POST request.
I mean there is /new-message? and /new-topic? but not /new-reply?

Maybe it’s something trivial, thanks in advance for your help!

You can find out how to construct your request by reverse engineering the Discourse API. Basically you open your network inspector, post a reply to a topic and see what happens under the hood:

1 Like

Thanks a lot @bartv
Just doing it right now :slight_smile:

Only question would be: are ALL fields mandatory to make a reply POST call? It’s quite a lot and some fields can’t be filled by me dynamically I think or are prone to mistakes!? (the id: for example)

In Zapier for example I made once a successful Topic POST Webhook with only those data fields
image

I doubt they’re all required. Just try it :slight_smile:

1 Like

Just as info it is not failing because of the data fields but because of bad csrf.
See here:

@blake Does this mean I need to set the api_username and api_key in the Header?

My current progress which fails:

3 Likes

Yep, you will need to set the Api-Username and Api-Key in the header. Be sure to change the _ to a -. You will also need to remove the credentials from the body.

2 Likes

Awesome, thank you very much @blake!
That was it.

For someone searching for hours via Google and Search as I did, that’s it:

2 Likes

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