If you’d like to trigger a webhook in an external service (such as my favorite automation tool Make), you can easily do this by creating a formula field or a button field that combines the webhook URL + any parameters that you want to send to the webhook.
So, for example, if your webhook URL is https://your_webhook_address.com
, and you want to send it your RecordID, you would create a formula field or a button field with a formula that looks like this:
"https://your_webhook_address.com?RecordID=" & RECORD_ID()
When you use Make, you only need to send it the Record ID, because using the Airtable: Get A Record module, you can easily pull in any other fields that you want from that record.
However, if you needed to send additional fields to your webhook, your formula would look something like this:
"https://your_webhook_address.com?RecordID=" & RECORD_ID()
&
"&email=" & ENCODE_URL_COMPONENT({Email Field})
&
"&name=" & ENCODE_URL_COMPONENT({Name Field})
But this technique will always open up a new browser tab which will show you the webhook response.
Often times, this is exactly what you WANT to happen. You will often WANT your users to see the webhook response, especially if it’s a webhook response that you have specifically customized for the user to see.
And Make gives a tremendous amount of control over webhook responses with their webhook response module. You could even create an entire HTML page as a response! For example, for lengthy automations, I will give my users a webhook response that gives them the estimated time of completion for their automation which is calculated based on the number of records that need to be processed.
But what if you DON’T want to open up a separate browser tab when you trigger the external webhook?
For those of you who would like to trigger an external webhook WITHOUT opening up a browser window, you can do this by triggering an automation in Airtable with the “Run Script” action.
NOTE: When performing a “Run Script” action, you are required to set your input variables in the left margin (see screenshots below). So, for example, in the 2 screenshots below, you can see that I’m referring to my Record ID as myRecord
.
To send just the Record ID to your webhook, your script would look something like this:
let config = input.config();
let url = `https://your_webhook_address.com?RecordID=${config.myRecord}`;
fetch(url);
(Remember that you have to pre-define “myRecord” in the left margin, as you will see in the first screenshot below.)
To send multiple fields to your webhook, your script would look something like this:
let config = input.config();
let url = `https://your_webhook_address.com?RecordID=${config.myRecord}&email=${config.email}&name=${config.name}`;
fetch(url);
Once again, remember that those 3 input variables are defined in the left margin. See screenshot #2 below.
SCREENSHOT #1: SENDING ONE VARIABLE TO A WEBHOOK
SCREENSHOT #2: SENDING MULTIPLE VARIABLES TO A WEBHOOK
Hope this helps!