Re: Using Scripting Block to push a webhook on button click

960 0
Showing results for 
Search instead for 
Did you mean: 
6 - Interface Innovator
6 - Interface Innovator

Hey, is it possible to create some Action Buttons to push webhooks with json data with the scripting block?

39 Replies 39

Since the button is an object in the record, clicking the button is tantamount to selecting the record. If the script is properly designed, you should not have to first select the record and then click the button.

If this were the case, why is there a button, a control that requires the user to invoke its connected actions?

If you want this to be magically automated, at the very least you should be using a script automation (which is designed to run automatically), not a script block (which requires manual invocation).

And given that this data is to be sent to Integromate anyway, why not eliminate all this script stuff and simply instrument Integromat to pull the data from these Airtable records when conditions warrant? I think @ScottWorld would agree - lacking more details, you appear to be going around the barn twice to get to the door.

@Bill.French is correct, as always!

@Kai_Dickas All you need to do is click once on your button to send your Record ID to Integromat, and then continue your automation from there.

You simply add the record ID as a parameter to the end of your webhook URL.

@ScottWorld - Kai’s complaint is the very existence of the button itself; would rather have it all automated as near as I can tell from the message.

Oh, I see, then that can be automated through a script in an Airtable automation, that could be triggered by any matching condition.

Once again - no. :winking_face:

… i have a button which starts the script. I was expecting that the script runs automaticly and the record id pushed to integromat.

The button/script – as I understand it - sends data to Integromat when conditions warrant. What’s wrong with that picture?

The button, the script, and the process in Airtable should be entirely eliminated because Integromat is fully capable of (a) detecting the conditions, and (b) acquiring any data it needs to do whatever @Kai_Dickas needs to accomplish in Integromat.

@Bill.French, once again, there are many different ways that he can accomplish his goal. Button, no button, script, no script. It’s all good.

This user expects the process to run automatically which makes me ask - why do you believe a button is all good?

In my view button bad. Furthermore, the data is needed in Integromat; so why not do it all in Integromat?

Ultimately, we have no clue what Kai is doing with a record ID in Integromat, but the requirements expressed seem to suggest a far simpler solution is possible.

Because there are 3 different types of timing scenarios going on here:

  1. IMMEDIATELY/MANUALLY: A button would trigger the scenario immediately in Integromat, because webhooks are processed immediately in Integromat. Whenever he manually clicks on the button in Airtable, it would immediately trigger the scenario. No delays.

  2. DELAYED/AUTOMATED: If he wants Integromat to “watch Airtable” and “automatically trigger” when certain conditions are met, “watching records” takes place on a schedule in Integromat. This schedule is based on the Integromat pricing plan. On the Free Plan, Integromat triggers once every 15 minutes to look for all new changes that have taken place in Airtable (or search for matching records, or whatever he would like to happen when “watching records”). On the Basic Plan, it’s every 5 minutes. On the Standard Plan and above, it’s every 1 minute.

  3. IMMEDIATELY/AUTOMATED: If he uses an Airtable automation to trigger when a condition is met, then the Airtable automation can automatically & immediately run a script which then triggers an Integromat webhook — which would then take place immediately. So this would be the fully automated, fully immediate solution.

p.s. For #3 above, I’m assuming that scripts can trigger webhooks. I don’t know if scripts can do that. Someone would have to let me know if that is possible.

Good point - but, this is entirely possible without a button, right?

  • Data condition causes record to flow into a view, triggering immediate script automation
  • Data change causes immediate script automation

Another good point - once again, no button, no script required. It’s simply a requirements question at that point - e.g., how latency-tolerant is @Kai_Dickas?

Yes - they can. No worries.

BTW, that three-point summary is the perfect outline for a hot tips video. :winking_face:

Oooh, thank you!! That’s a really great idea! :slightly_smiling_face: I haven’t jumped on the ball yet of creating my “Airtable Hot Tips” video series yet (which was originally YOUR idea for me!), but this would be a great one to kickstart the series! :slightly_smiling_face:

Especially if it included a little script snippet to demonstrate how to call an Integromat webhook from a button or an action.

Hi Bill,

thanks for your response.
It seems to be a cache issue. After i cleared the cache of my browser the button works as expected. So the problem is solved.

Have a great start in the week.


Hi Scott,

As Bill said it’s possible, and you can pass the record ID like you would for the Button/Webhook trigger :

let url = "";
let inputConfig = input.config();
await fetch(url + inputConfig["recordID"]);

This allows to trigger Integromat scenarios immediately when specific conditions are met in Airtable, without having to set a periodic schedule in Integromat (thus reducing the operations count & latency).

Screen Shot 2021-01-20 at 4.38.09 AM

Thanks for the JavaScript code!

This is awesome. It seems like every time I’m trying to solve a problem, the solution has just recently been posted in the forum. Thanks for sharing the code and knowledge.

Yep - this is a great example.


You may also want to test to see if the webhook fired and if not, determine the cause of the failure if the process is a mission-critical process.

My current use case isn’t mission critical, but I’m interested in using this for automating other processes in the future in the future.

@Bill.French do you know of a simple way to test to see whether the webhook has fired or not? Would you suggest adding something to the javascript?

I can think of several ways to do this that require way more steps (like adding a step to the initial automation that checks a box, then adding an uncheck box step to the webhook function), but wonder if there’s an easier way in the script itself to check to make sure that the webhook has fired properly.


It’s not really a question of firing; it’s determining what happened after the fire. If it failed or succeeded typically depends on what the response is from the hook. They vary in what (if anything) is returned when the request is made, but in most cases they conform to API standards issuing an HTTP response code.

I just thought I might add what I have done to this as I stole a few things and mashed them together…

I have an automation, when a particular sales status is reached, I want to send a JSON payload with two parameters. Now I know I could send one parameter, but this webhook is actually set off not just by Airtable and there are times that the extra parameters are not in Airtable, e.g. they are sent from the automation.

let url = "<webhookURL obv deleted here>";
let inputConfig = input.config();
let payload = {
"record": inputConfig["recordID"],
"emailType": inputConfig["salesStatus"],

let postOptions = {
method: "post",
headers: {
'Accept' : 'application/json',

body: JSON.stringify(payload)

await fetch(url, postOptions);

So I am passing it, in this instance, the recordID and the salesStatus from my record. You could really continue building out the JSON payload with as much information as you want, although of course you could also grab this by sending just the ID and then grabbing the rest in Integromat…

So people above seem to be getting back results, unsure what they are doing with that exactly though??
e.g. what is this doing?

const postResults = await fetch(url, postOptions);
const jsonPost = postResults.json();
let id = (jsonPost.field + " = " + jsonPost.value);