Help

Re: Help with script to send Integromat webhook data

Solved
Jump to Solution
3248 0
cancel
Showing results for 
Search instead for 
Did you mean: 
Burner
7 - App Architect
7 - App Architect

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.

1 Solution

Accepted Solutions
Joe_Hewes
7 - App Architect
7 - App Architect

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!

See Solution in Thread

6 Replies 6
Joe_Hewes
7 - App Architect
7 - App Architect

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?

Joe_Hewes
7 - App Architect
7 - App Architect

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!

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

Thank you. This worked perfectly.

Hey Joe, what if all you need from the trigger record is the RecordID and one other single line text field? Wouldn’t it be more efficient to send both pieces of data in the webhook vs expending another operation on the Get Record module? 

Can you please show us how that second line of data can be written into the AT script?