Help with script to send Integromat webhook data

Hi,

I’m new to Airtable scripting and am just learning my way around through hit & trial. I don’t have any javascript experience either, but I’ve used python in the past. I’m trying to write an Airtable script that sends data to my Integromat webhook trigger. So far I’ve been gotten the following:

// Webhook URL
let webhook = 'https://hook.integromat.com/integromaturl'; // replace with actual integromat URL

// Table to send data from
let tableName = 'Master Client';

// Fields to bind and send
let fieldsToSend = [
    'Client ID',
    'Client Name',
    'Email',
    'Created Time',
    'Last Modified'
]

I guess I’m stuck with what to do after this. My intent is to use the Airtable automation such that when a new record is created in this table (Master Client), I want this script to run.

But what do I need to add to my script so that Airtable sends the information in my ‘fieldsToSend’ variable to my ‘webhook’ variable. All I seem to have done in my script is to create and assign variables – it doesn’t really do anything.

Sorry if this is stupid and really basic, I’m literally just figuring this out from scratch.

Any help would be much appreciated.

Thank you.

Don’t bother with all that - just send over the record Id and use integromat’s get record function to grab the actual data.

Okay, but how do I do that? I want a script to trigger sending to a webhook instantly and not use the Integromat scheduled triggers.

So I’ll reduce the variable down to just the record ID, but what else do I need to put in the script to send a POST (I think that’s what it is) request?

If you are doing this as an automation you need to setup an input variable for the script using the airtable record ID that you want to send as the data - in this example i’ve called it “inputRecord” (this will vary depending on your approach, but it’s usually the record id from step one / the trigger of your automation).

Generate your webhook url in integromat and insert it into line 5 of the following code:

let inputConfig = input.config();
let recordID = inputConfig.inputRecord;
console.log(recordID);
let url="*integromat webhook url goes here*"
console.log(url);
let request= url.concat('?recordID=',recordID)
console.log(request);
await fetch(request);

Hope that helps!

5 Likes

Thanks. I’ll try this out and let you know how it goes. Really appreciate it.

1 Like

Thank you. This worked perfectly.

1 Like

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.