Write to Airtable from a Slack command
code
• December 11, 2018
I built a Slack app that asks your workspace channel a random question every weekday. Members can submit questions via a Slack command if they wish. It’s great for ice breakers, to spark conversation, or to have something to look forward to every morning.
The best part is that it’s built on a few of my favorite tools:
- Glitch holds and executes all the code I wrote to make the app work.
- Airtable stores the data for the questions.
- Slack is where the conversation happens.
- Zapier triggers the daily post.
Check out the README on Glitch to learn how I set up each service for the app.
Under the hood
Adding questions
- To submit questions, members use the Slack slash command:
/quiggles what's for lunch today?
- The Slack command triggers the Glitch project to write the question as a row in the Airtable base.
- Upon successful addition of the question, the member receives an ephemeral Slack message back.
Asking questions
- I created a Zapier zap that will run at 11 am every weekday. It’s action is to POST to a webhook URL that’s pointed at my Glitch project.
- Once my project receives an authorized message from Zapier, it will pull all the rows from my Airtable base and select a random question (that hasn’t been asked yet).
- Next, my project marks the selected question as asked by adding a timestamp in the
date_asked
column in Airtable. - Finally, Quiggles posts the question in Slack.
I dive deeper into how I setup each service in the README of the Glitch project.
And in case you’re wondering, I wouldn’t take the million dollars. I love treats too much to be disappointed 50% of the time.