Popular trigger nodes

Commonly used trigger nodes and their role in automation.

Table of contents:

  1. Basics
  1. Trigger on Webhook
  1. Trigger on Schedule
  1. New Row Added
  1. New or Modified Records
  1. New Page in Database
  1. New or Modified Files

1. Basics

To run the scenario, you need to add a trigger node. Scenarios with trigger nodes in active status are executed every 5 minutes, except for the following types:

  • Trigger on Webhook: The scenario starts executing after receiving a request;
  • Trigger on Schedule: The scenario starts executing at a specified time according to the schedule.
  • Trigger on Run Once: The scenario starts executing when you click the Run once button.
  • Triggers with Instant Comment: The scenario starts executing immediately when the trigger event occurs.

Trigger type nodes are displayed in the node selection window under the Triggers tab:

Notion image

2. Trigger on Webhook

To trigger a scenario using the Trigger on Webhook node, you need to send an HTTP request to the URL of the Trigger on Webhook node. The request can contain or not contain data to be passed to the scenario.

For example, let's create a scenario that processes data in JSON format.

Notion image

You need to add three nodes:

  • (1) Trigger on Webhook, for sending data in JSON format using the POST method and triggering the scenario;
{
  "id": 1,
  "first_name": "Jeanette",
  "last_name": "Penddreth",
  "email": "jpenddreth0@census.gov",
  "gender": "Female",
  "ip_address": "26.58.193.2"
}
  • (2) Java Script, for processing the data with code;
Notion image
export default async function run({execution_id, input, data}) {
const SurName = data["{{1.body.last_name}}"];
const Name = data["{{1.body.first_name}}"];
const FullName = Name +' '+ SurName;
const Email = data["{{1.body.email}}"];

    const resultRawJSON = JSON.stringify({
      "FullName": FullName,
      "Email": Email,
    });	

    return {
      resultRawJSON
    }
}
  • (3) Webhook response, for generating the scenario's response to the incoming request.
Notion image

The result of the scenario's operation will be transformed data in JSON format:

Notion image

3. Trigger on Schedule

The Trigger on Schedule node triggers the scenario based on a configured schedule without passing any incoming data to the scenario.

For example, let's create a scenario that:

  • Runs every day at 18:30.
  • Creates a page for a daily report in Notion.
Notion image

You need to add two nodes:

  • (1) Trigger on Schedule, to trigger the scenario daily at a specific time;
Notion image
  • (2) Create Page, to create a page with the current date as the title.
Notion image

The result of the scenario execution is the added page in Notion:

Notion image

4.New or Modified Records

The New or Modified Records node triggers the execution of a scenario when a new record is added to the AirTable database table.

As an example, let's create a scenario that:

  1. Is triggered when a new row is added to the database table.
  1. Takes one of the attributes from the added row and adds it to a Google spreadsheet.
Notion image

You need to add two nodes:

  • (1) New or Modified Records, to trigger the scenario and obtain data about the added row;
Notion image
  • (2) Add Single Row, to add the attribute of the row to the Google spreadsheet.
Notion image

The result of the scenario's execution is the added attribute of the row in a cell of the spreadsheet:

Notion image
Notion image

5. New Row Added

The New Row Added node triggers the scenario when a new row is added to the specified sheet or sheets in a Google spreadsheet.

For example, let's create a scenario that:

  • Is triggered when a new row is added to a Google spreadsheet and retrieves data about that row;
  • Converts and returns the data in JSON format.
Notion image

You need to add three nodes:

  • (1) New Row Added, to trigger the scenario and get detailed information about the added row;
Notion image
  • (2) JavaScript, to transform the row's information into the required format using code;
Notion image
export default async function run({execution_id, input, data}) {
const Row = data["{{1.data.newRow}}"];
const Count = data["{{1.meta.summary}}"];
 
    const resultRawJSON = JSON.stringify({
      "Row": Row,
      "Count": Count,
    });	

    return {
      resultRawJSON
    }
}
  • (3) Webhook response, to return the execution response of the scenario.
Notion image

The result of the scenario execution is a JSON containing the content of the added row and its ordinal number:

Notion image
{"Row":"[\"Catherine Smitt\"]","Count":"New row #6 in Sheet1"}
 

6. New Page in Database

Node New Page in Database triggers the execution of the scenario when a page is added to the Notion database.

For example, let's create a scenario that:

  • Runs when a new page is added to the Notion database;
  • Converts and returns data about the created page in JSON format.
Notion image

You need to add three nodes:

  • (1) New Page in Database, to triggers the scenario and retrieves data about the added page;
Notion image
  • (2) JavaScript, to transform the information into the required format using code;
Notion image
export default async function run({execution_id, input, data}) {
const Row = data["{{1.data.properties.Fruit.title.[0].text.content}}"];
const Edited = data["{{1.data.last_edited_time}}"];
 
    const resultRawJSON = JSON.stringify({
      "Row": Row,
      "Edited": Edited,
    });	

    return {
      resultRawJSON
    }
}
  • (3) Webhook response, to returning the scenario execution response.
Notion image

The result of the scenario execution is a JSON with the necessary attributes of the added page:

Notion image
{"Row":"Pineapple","Edited":"2023-11-01T20:13:00.000Z"}

7. New or Modified Files

The New or Modified Files node triggers the scenario if:

  • a file on Google Drive has been edited;
  • a new file has been added to Google Drive.

For example, let's create a scenario that:

  • runs after adding a new file to Google Drive;
  • returns the current list of file names on Google Drive, taking the added file into account.
Notion image

You need to add three nodes:

  • (1) New or Modified Files, to trigger the scenario when a file is added.
Notion image
  • (2) List Files, to get the current list of folder files and their attributes as an array;
Notion image
  • (3) Iterator, to sequentially process the array from the List Files node;
Notion image
  • (4) SetVariables, to create an array of file names;
Notion image
  • (5) Webhook response, to return the scenario execution response.
Notion image

The result of the execution is an array of file names in the Google Drive folder, including the name of the added file:

["Add new 1","Add new","TestJson.json","TestJson.json"]
Did this answer your question?
😞
😐
🤩