Help

Re: Webhook/Zapier is showing "Undefined" on Query String

Solved
Jump to Solution
1561 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Jonathan_Forten
5 - Automation Enthusiast
5 - Automation Enthusiast

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!

1 Solution

Accepted Solutions
Jonathan_Forten
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

See Solution in Thread

3 Replies 3
Jonathan_Forten
5 - Automation Enthusiast
5 - Automation Enthusiast

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.

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.
MatiasTN
5 - Automation Enthusiast
5 - Automation Enthusiast

"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.