Help

Who can help me with an example of a script how to send an Airtable record ID to a Zapier Webhook

Topic Labels: Automations
2103 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Jaco
5 - Automation Enthusiast
5 - Automation Enthusiast

I want to use an API to trigger Zapier as waiting for a record to enter a view might sometimes take too long for a near real-time sync operation. So I want to pass the record id of the record that needs to be processed by Zapier.

I have no script code experience but I should be able to understand the code from how to get the incoming parameter and pass this to the webhook code. And same for the webhook URL.

Thanks for your help.

4 Replies 4

Hi @Jaco
Add a formula field and input: Record_ID() to see the id for each record.
image

If you are connecting to the Airtable API you can GET the ID: REST API - Airtable

If you are using Airtable scripting:

let table = base.getTable("My Table");
let queryResult = await table.selectRecordsAsync({fields: []});
let record = queryResult.records[0];
output.text(record.id);

Welcome to the community, @Jaco!

You can always just use a button field for this. Just attach the URL (with the Record ID appended) into an “Open URL” button field, and then click on the button to trigger your webhook.

Your formula would look something like this:

"https://example.com?RecordID=" & RECORD_ID()

Alternatively, you can do this with a script in an automation… it would look something like the screenshot below:

Screen Shot 2022-08-04 at 3.05.07 PM

And here is the code from that screenshot:

let config = input.config();
let url = `https://example.com?RecordID=${config.myRecord}`;
fetch(url);

p.s. Zapier has a lot of limitations compared to Make.com. One of the limitations is that Zapier doesn’t give the ability for you to set a custom webhook response, whereas Make.com does allow custom webhook responses. This is one of the many (many) reasons that I prefer Make over Zapier.

Jaco
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi Scott, this was very helpful to get started with scripting in Airtable.
I would also like to thank you for pointing me to Make.com. I already noticed a few additional benefits and will start exploring to move over from Zapier to Make.com

@Jaco You’re welcome! Yeah, the more you play with Make.com, the more you realize that it can do hundreds (possibly thousands?) of things that Zapier can only dream of doing.

It’s a very empowering platform! :grinning:

The only real downside is that their help documentation is very weak, so a lot of the product discovery has to come through your own personal experimentation.