Webhook feature - extract data from body

Extract data from Webhook body

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.

Any thoughts?

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&param2=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.

Hi, I’m not sure if I understood the feature request. Could you provide an example?

@joeworkman

  1. This is already supported under queryParams.
    image

  2. This is already supported and it’s returned in the body.
    image

  3. If you send the body as JSON, it will be inside the body and will be shown in the data to insert. I’m not sure what’s missing there.

Could you provide an example? I feel like something is missing.

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.

I will run my tests again.

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.

Hi @joeworkman

It should be processed as json, can you give me the curl command or how to reproduce the following issue?

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

We dont have premium features in pieces or core.

What is the http method? Get method doesn’t have body as far as I remember

Hello Davide,

I hope you’re doing well.

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.

Thank you in advance for your support.

Best regards,

Kaleem Ahmad