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)?
@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.
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:
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’.