How can I extract the useful data from the body?

I can’t map and pass on the data this way. It works with Zapier, but not with this. Can anyone help?


I haven’t had a chance to play with the Advanced Data Mapping yet, but I did use the Code piece to parse text from an email by using RegEx.

My use case I had an email I needed to pull First Name, Last Name, and Class Date as separate variables that I would later need to pass on.

Can you provide more information on your process and what you’ve tried?

Data comes in via webhook trigger, you want to map the data, and then send that data out?

1 Like

Yes, the webhook data comes from an online store, and it’s necessary to extract customer data from it. After all, I solved the unpacking and forwarding of the webhook data to a CRM software with code. It would be nice, though, if there were a solution that Zapier could also handle.

Can you say a little more on how you solved your problem?

I broke down my parsing on this reddit post. I am only just getting started, but came to learn and share.

I sent the codes privately.

1 Like

Hello @Dante ,

The data inside the body field of the webhook appears to be a string. You can use a code piece with the following code to convert it into mappable data. Please pass the body data as a parameter to the code piece using the name body .

export const code = async (inputs) => {
  return JSON.parse(inputs.body);
};

If you have any questions or require further clarification, feel free to ask.

Thanks,
Kishan

1 Like

Thank you, but this does not work. I have already solved this problem.

Thank you for @kishanprmr 's solution. In my case, I needed to access the data key with the code. Now it works.

export const code = async (inputs) => {
return JSON.parse(inputs.data);
};

1 Like

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