Accessing payload sent by Zapier

I’m trying to pass a payload from Zapier to my bot through the Electroneek Integration. There is an option to pass a payload in Zapier, but I’m unsure how to access the payload data in my bot. Ultimately, I want to assign the elements in the payload as variables in Studio Pro.

As an example, I want to access “element1” by referencing the Zapier payload in my Studio Pro environment using “key1”. I am trying to pass it by using the sample payload in Zapier:

I’ve been trying to follow the instructions listed here (Run bot with API and pass variables to bot) which is used for passing a JSON through a webhook variable called webhook_data. Is there an equivalent for a payload passed through Zapier (e.g. zapier_data)?

Any insight @ElectroNeek team?

Hello ElectroNeek team, is there any guidance you can provide to the above? This is a very limiting factor for the Zapier integration

@BD1 Thank you for reaching out. To access the payload data, you should use the same webhook_data . By using .key1 , you should be able to access that specific object inside the JSON payload. You should use webhook_data.key1 to obtain “element1”. Please give it a try and let me know if you encounter any issues.

Hi @Omar_Malave, it looks like it’s returning an “undefined” for that field.

Here is the payload we’re passing in Zapier:

Here is the step in Studio Pro where we assign a variable as the first step in our .neek file:

Here is the step in Studio Pro where we input the variable into a field in the browser:

Here is what is actually typed in (the string it passes is “undefined”):

As you can see, it looks like the variable is stored as “undefined” when it should be “Element1”, from our vantage point it looks like we are following the steps correctly. Can you share where the issue may be?

@Omar_Malave we believe it’s an issue with Zapier payload because the run executes successfully when we manually put a string in the assign variable step:

On the input browser step:

@BD1, I would recommend to print the webhook_data variable into the console to see what exactly Zapier is sending to the bot.

1 Like

For anyone who is encountering this problem, it looks like it’s an issue where it’s passed as a String from Zapier. You will have to parse the JSON before being able to access it in the rest of your Neek file, i.e.:

set your variable by calculating JSON.parse(webhook_data), and then access it as webhook_data[key]

For my example, it was webhook_data['key1'] in order to access ‘Element1’.

1 Like