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

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.

Hi @Airtable1
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, @Airtable1!

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:

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.