B-iggy is trying to automate posting a reply inside a Discourse topic via a webhook whenever a commit is pushed on a GitHub repository using Integromat. They have set up the API in Discourse, a webhook in GitHub, and an HTTP POST scenario in Integromat but are missing the final piece to make it work.
Bartv suggests reverse engineering the Discourse API by inspecting the network requests when posting a reply manually. B-iggy follows this advice and discovers that not all fields are mandatory for a reply POST call.
However, B-iggy encounters an issue with bad CSRF, which blake resolves by advising to set the Api-Username and Api-Key in the header and remove the credentials from the body. B-iggy successfully implements this solution and shares the final working setup.
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:
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)
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.