I just went through the process of getting data out of a webhook POST request. I appreciate having full access to webhook data, but it’s inconvenient that there is no simple way to extract data from the “body”.
I received assistance from someone else to write the code that extracts data from the webhook and sends it to the next step. But this should not be that difficult. I think webhooks should parse the data right out of the box.
I agree 100% with this. I feel that the webhook trigger is missing my expectations of what it should do out of the box. I would expect the following features.
The ability to process all URL parameters passed. Ex: ?param1=value¶m2=another
The ability to process the webhook as application/x-www-form-urlencoded and process the body as traditional form based POST data.
The ability to process the webhook as application/json and process the request body as JSON.
Ideally ActivePieces should automatically determine the data type of the request by looking at the Content-Type header in the request.
Users should not be expected to write JS code that will parse the body. This should be something that happens out of the box.
Thanks for getting back to me. I will admit that I did not test #1. I was just stating that I felt that it should work. Both #2 and #3 were not working for me last week. For the form based request, the body was empty. Fo the JSON request, the body was the string of JSON. I had to add a stop that processed the body with a JS code snippet.
The only wayI was able to make it work was using a web form to send a POST/json request to the webhook and write a script to extract data from the body, as shown in the picture below.
In my experience, this process with other automation software is much easier.
Instead of sending data as a json , if I send data via application/x-www-form-urlencoded as @joeworkman is saying I get an empty body. Using this method with Zapier, Integrately, Pubbly, … Gives me a clean list of all the data entered by the user in the form on my website.
I was able to send a traditional POST request and the data does seem to be properly processed. Very odd. I am not sure what was happening in my tests last week.
If I send in the data as JSON, then as you can see below, the body simply contains the JSON. I do think that it would be nice if this was supported out of the box.
Is retrieving a request body from a webhook a premium feature? I am on the free version and I see no way to accept request parameters or a request body in my webhook trigger
Could you kindly share a sample piece of code to extract data from a webhook? It would be greatly appreciated and a tremendous help, as I am currently struggling to receive a data response from any webhook.