Push Cell values to webhook URL

Topic Labels: Automations
1646 6
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I’m trying to write my first SIMPLE script. I’m looking to push cell values to a webhook URL.

I have 3 fields: NAME, MESSAGE and URL.

Could someone please help me with doing this. I have the webhook URL and I’m looking to create an automation that runs each morning at a specific time to look at records within a VIEW. IF found, send the 3 fields for that record to that URL.

Thank you very much!

6 Replies 6

You could pass the values of your fields to the webhook by formatting them as JSON. If you create an Input Variable for each of those three fields, the script could look something like this:

let hook = "insert webhook here"

let {name, message, url} = input.config()

let obj = {
  name: name,
  message: message,
  url: url

let data = JSON.stringify(obj)

await fetch(hook + "?" + data);

^ the above assumes you’re processing just one record. If you need to search through a View and send data to the webhook for each record in that View, that would require a different setup.

4 - Data Explorer
4 - Data Explorer

Thank you very much. If I ran an automation with this, wouldn’t the automation look at the records in this view and then process the script for each record?

If you use the trigger “When record enters a view”, it would process every record that enters the view, so processing one record at a time (so Kamille’s script should work imo).

Thank you for the help. Being a newbie and not understanding the code, I’m getting errors.

Here is my table:

And the code with the error:

let hook = "My webhook URL Not Shown"
let {Message Name, Message, Link URL} = input.config()

let obj = {

  name: 'Message Name',

  message: 'Message',

  url: 'Link URL'}

let data = JSON.stringify(obj)

await fetch(hook + data);

Kamille’s script expects a triggering record. However, it sounds like you want a scheduled automation, which does not have a triggering record.

How to change things depends on

  • will there always be exactly one record in the view at the set time, or could there be zero records or many records?
  • if there are multiple records, do you want to send all of them in one request, or should there be a new request for each record?
  • if you need one request per record, will there always be less than 50 records, and how interested are you in learning coding?

If you need one request per record, one method is to use two automations and a single control record in a different table that is linked to your main table.

The first automation is scheduled to run at a specific time and it has two actions. The first action is to “find records” in the view. The second action is to update your control record’s linked record field with those found records. You may need to hardcode the record ID of the control record or do a different “find records” action to get its record ID.

Creating the link from the control record will also set the backlink field in the actual records. The next automation should trigger “when record meets conditions” with the condition of having a value in the linked record field. This automation can use Kamille’s script. Be sure to setup the input variables in the left panel of the script editor. Then have another action that removes the link to the control record.

The first error will be when you’re declaring variables:
let {Message Name, Message, Link URL} = input.config() → variable names can’t have a space between them

The second problem (not error I think) is then when you’re assigning the variables as values in the object:

let obj = {

  name: 'Message Name',

  message: 'Message',

  url: 'Link URL'}

In the object, you have pairs of key (left) + value (right). The value shall be the value from the input config (which you have to define on the left side before). You put quotation marks around the values, which basically makes them a string. But what you want is the variable you declared before from above (without quotation marks).