Save the date! Join us on October 16 for our Product Ops launch event. Register here.
Aug 02, 2021 10:24 AM
I am attempting to send information from Airtable to Zapier and ultimately a message to a client.
I am using the Automations > When Record Is Created trigger to Run Script. I am using the script from this article:
Instant Webhooks with Zapier and Airtable
My automation says it runs successfully in Airtable, and my Zapier says the Catch Hook runs successfully, but my QueryString is returning everything “Undefined”
Basically none of the data is being sent from Airtable to Zapier.
let url = "[ZapWebhook]"; // Replace the [ZapWebhook] with the webhook provided from the Zap Trigger step.
let config = input.config(); // This allows the Input Variables to be used in the code.
await fetch(url + "?RecordID=" + config.RecordID + "&FirstName=" + config.FirstName + "&LastName=" + config.LastName + "&Phone=" + config.Phone + "&Email=" + config.Email); // Concatenates the webhook URL with query string parameters and Input Variable values.
^^^ code being used if you don’t want to click the link.
Thanks!
Solved! Go to Solution.
Aug 03, 2021 06:14 AM
This is solved.
When typing the script in, on the left hand side, you will see a place to define the input variables. You’ll need to name the variables and define them there.
Aug 03, 2021 06:14 AM
This is solved.
When typing the script in, on the left hand side, you will see a place to define the input variables. You’ll need to name the variables and define them there.
Aug 03, 2021 07:49 AM
My gut says that you need to URL-encode some of your data elements. The record ID can probably pass as-is, but I would definitely encode the rest, especially the email. Try this for the third line:
await fetch(url + "?RecordID=" + config.RecordID + "&FirstName=" + encodeURIComponent(config.FirstName) + "&LastName=" + encodeURIComponent(config.LastName) + "&Phone=" + encodeURIComponent(config.Phone) + "&Email=" + encodeURIComponent(config.Email)); // Concatenates the webhook URL with query string parameters and Input Variable values.
Sep 25, 2023 01:53 PM
"undefined" will happen when you miss-reference an input.
For example if you define a RecordID input, but then reference it in your code as:
config.recordID
The misspelling / typo will cause that variable to be undefined.