Airtable Webhooks with Slack + Pipedream
We love Airtable here at Pipedream. But Airtable lacks one killer feature — webhooks.
We took advantage of Airtable’s Slack notifications and built a way to send webhooks to an HTTP endpoint every time a record is created or updated in a base. It takes 10 minutes to setup and it’s free.
For example, if you create this record:
you’ll receive a webhook notification to your HTTP endpoint with a payload like this:
If you have any questions at all on how this works, please leave a comment below — I’m more than happy to help.
Let’s get started!
What are webhooks?
Webhooks enable an app to push updates about in-app activity to you in real time. Do you use Stripe and want an immediate notification each time you charge a customer? There’s a webhook for that!
Without webhooks, you’d have to poll Stripe’s API for new charges every few minutes. You’ll have periods where no new charges process, but you’re still hitting the API every few minutes to check for updates. Webhooks save you from having to poll in this manner. You get updates as they happen.
We wanted Airtable to send us a notification each time a new record was created or updated so we could take action on those changes. For example, we might want to send a Slack notification when a field is updated to a specific value (e.g. when a Status field is set DONE), or just keep a record of all changes in an external system.
How this works
Airtable doesn’t support webhooks, but they do support Slack notifications for updates to records.
We’ll send notifications to Slack, send those messages to Pipedream to transform the Slack message to a custom JSON payload, then route that payload to your HTTP endpoint.
Airtable -> Slack
First, setup Airtable Slack notifications for your base. We created a new Slack channel, #airtable, dedicated to receiving Airtable updates.
Make sure to select the option to receive updates for “All activity in the base”, like so:
Slack -> Pipedream -> Your endpoint
We’re going to create a Slack app to listen for new messages in the #airtable channel and send them to a Pipedream endpoint URL. If you can’t create an app in your workspace, you can create a new workspace dedicated to receiving Airtable updates and create an app there.
Getting the app working end-to-end involves a few steps, but I’ll walk you through each one below.
Create a new Slack app here, choosing a descriptive name and the correct Slack Workspace:
Select the Event Subscriptions section, under the Features header:
Enable the app to listen for events in this workspace:
In a new tab, open this Pipedream pipeline. If you don’t have a Pipedream account, you’ll be asked to create one. Once you do, you’ll have a new copy (a “fork”) of the pipeline in your account, with your own endpoint URL you can start sending data to immediately. We’ll use Pipedream to receive events (new messages) from Slack, then send them to your final HTTP endpoint.
Pipedream is a service to run basic automations — we call them “pipelines”. Send data to a pipeline, perform some actions on it. It’s like Zapier, but optimized for receiving, transforming, and routing webhooks. It’s also free for pipelines that run fewer than 60 times a minute, and you can create as many pipelines as you want.
Once you fork this pipeline, you’ll notice a message in the footer:
I’ve written this pipeline to:
- Accept Slack messages
- Grab the Airtable updates from them
- Send those to an HTTP endpoint you own
So we need an HTTP endpoint for step #3. If you have an endpoint URL where you want to send data, enter that in the Endpoint field of the final step of the pipeline:
If you don’t have a URL to send data to right now, you can use a service like RequestBin to create an HTTP endpoint you can send any requests to and immediately view them in your browser. Pretty cool!
Once you enter a URL in that field, save your pipeline by pressing the green Save button near the bottom.
Now, copy the Source URL at the top of the pipeline:
This URL is specific to your pipeline and private to you. Any events sent to this URL will trigger the pipeline, running the steps below.
Back in Slack, paste this URL into the Request URL section of your Event Subscription and save your changes to the Slack app.
You typically have to return a specific response for Slack to validate you own your endpoint, but Pipedream handles that for you. Slack should verify your endpoint immediately:
Now we’re going to configure Slack to send messages to Pipedream. Workspace Events subscribe us to event across all channels, but we want notifications only for our #airtable channel.
To do this, we’ve got to:
- Create a bot user
- Subscribe to messages in channels where we’ve added the bot
- Add the bot to our #airtable channel
Under the Subscribe to Bot Events header, click the link to Add a bot user:
Change the name and details if you wish, and save the change.
Once the user is created, you’ll now be able to Add Bot User Event and select message.channels from the list:
Finally, back in the Basic Information section of the app, click Install App to Workspace:
Now go into the #airtable channel and invite your bot:
Testing the webhook
Now that your app has been installed to the #airtable channel, new Airtable Slack notifications should hit Pipedream, and Pipedream will send a webhook to your endpoint.
Add or update a record in your base, and wait just a few minutes. Slack notifications from Airtable aren’t immediate, but I found they came in within 2 or 3 minutes.
Once you get a new Slack notification, check your Pipedream pipeline to confirm a new event was received and was sent to your HTTP endpoint:
And I see the event show up in my RequestBin 🎉:
Additionally, you can add the base ID, the time the record was created, and other metadata by making an Airtable API call each time the Pipedream pipeline runs. You can run any Node.js code (JavaScript) in a Pipedream pipeline. See this pipeline for an example of how that works.
Limitations
I ran across a few limitations with Airtable’s Slack notifications that affect our webhooks:
- They’re sent in batch every few minutes. On average, updates came in within 2 or 3 minutes.
- Airtable didn’t notify me via Slack when records were deleted.
- I also couldn’t identify the base / app ID to which a given notification was tied from the Slack message itself.
I reached out to Airtable Support about the latter two issues and they’ve taken note of the feature requests.
Improving this pipeline
We didn’t go into the Pipedream pipeline in depth, but there’s a lot going on there:
- We ran Node.js code (JavaScript) to filter out messages from the Slack channel that aren’t from Airtable.
- We executed an Action to extract the Airtable-specific updates from the Slack message, which involves a bit more Node.js code, packaged up as an action you can select from the Pipedream UI.
- Finally we sent the Airtable update to your HTTP endpoint, as we saw.
Just like Zapier or other automation platforms, you can build complex workflows using Pipedream. But here, we’re putting code first and letting developers author their own actions to develop highly advanced automations. And you don’t have to manage any infrastructure or cloud functions to run them.
Best of all, Pipedream is free for any pipelines that process 1 request / second or less. That’s over 2.5 million events per pipeline per month, and you can run as many pipelines as you want!
Your pipeline is a copy of the original. You own it and it’s yours to improve. Get creative and let us know what you built!
Please read the docs or reach out if you have any questions at all, or leave a comment below and I’ll get back to you.
Thanks for reading!