DEV Community

Derrick Sherrill for WayScript

Posted on

Send Notifications when Airtable Events occur to Slack and email

Introduction

Do you have a need to receive a notification anytime a new row is added or change in your Airtable? In this post, we will be exploring this use case harnessing WayScript to create notifications on both Slack and Email

Prerequisites

You will need to have an Airtable account and generate an API key. To learn more about how to do that to can refer to the following documentation

You will also need to create a base with a proper table name like the example below

You will also need an active Slack account which can be linked to WayScript, for more info check out this resource

Finally, we will need to import the Time Trigger, Airtable, Slack, and Send Email packages which can be done easily through the WayScript libraries tab

For this post we will also use the Time Trigger and Send Email packages as well as the Variable Storage and If modules which you can read more about through the following resources:

Getting Started

Simply, click the ‘+ New Script’ button found in the top right corner to start creating your new workflow.

Now, let’s add and enable a simple Time Trigger

Create Variable Storage

We will need to use the Variable Storage to store persistent data to track our Airtable changes

Get Airtable Records

Next, we need to retrieve our Airtable rows to compare with our persistent data to check for new rows or changes

We also want to set our Airtable output as follows so we can compare with persistent data

Check for Differences

We can use a simple Python one-liner to check for differences and output a variable for our condition statement

 variables[ 'diff' ] = list( set( variables[ 'Fields_JSON' ) - set( variabled[ 'data' ] ) )

If Differences Exist

Now that we have checked for differences we add an if statement to see if any found

Send Slack Notification

Sending a slack notification takes little effort with WayScript

Send Email

Sending an email with WayScript is just as easy

Synchronize Airtable Changes

Finally, we will want to synchronize our Airtable changes and persistent data for the next run variables[ 'data' ] = variables[ 'Fields_JSON' ]

Result

Finally, our result should be a notification in Slack

As well as an Email

As always, if you have any questions, comments, feedback, or suggestions, please let us know on WayScript or through our discord. If you would like to view this WayScript simply follow the link Airtable Notifications to Slack and Email.

Top comments (0)