Sahil Khosla Profile picture
Chief Instructor & Founder @nocode_uni // Helping SMBs across the globe automate busy work so they can scale. // Previously @deloitte @expedia

Dec 3, 2021, 13 tweets

My experience building a @SlackHQ bot using @tray and @airtable as the #nocode tools.

Giant Thread 🧵 👇

1/ I have been meaning to build a Slack bot for a while and have done several proofs-of-concept in the bast. But every single time I have failed to actually ship it just because it requires a managed back-end and that just adds too much effort for a simple side-project at work.

2/ 📚 Introducing — The Dictionary Bot

The idea is simple. Look up a list of acronyms and return what it stands for. For example

3/ At a high level, I need the following for the bot to work:

- A Slack App (with Slash commands enabled)
- A URL that’s called whenever the Slash command is triggered
- Some kind of a Database to hold the Acronym definitions
- Ability to respond to the Slash Command

4/ Implementation - Backend with Tray

Tray.io is essentially built around workflows (think of it as a function) that can be called via various “triggers”. In my case a Slash command from Slack.

5/ To connect the workflow to the Slash command, it was just a matter of obtaining the unique URL for my Dictionary Bot workflow in Tray.io and providing it in the settings on my Slack app.

6/ Once connected and authenticated (which was done by providing Tray.io with a ‘signing secret’ from Slack), I was already able to start invoking the (/define) command from Slack and see the Tray workflow getting triggered.

7/ Airtable as the DB

The next step was to identify where to store my data so that it can be easily queried from the Tray.io. Think of Airtable as a glorious G Sheet that allows you to query your data over an out-of-the-box API.

It’s hard to believe, I know.

8/ With the data now available, all I had to do was create authentication for my Airtable account (which was trivial). The connector very conveniently provides the ability to filter your data by a formula which in my case was simply:

9/ Pretty much at this point, I had the output from the table that I wanted and was ready to craft a response to be sent back to Slack.

10/ Turns out, each Slash command request comes with a unique response_url that you can use to send a response and it’s sent to the same channel where the request originated — pretty convenient.

11/ And voila, the Slack bot was ready to be tested end-to-end and I did not even have to write a single line of code! 🎉

12/ It was quite enjoyable to build with @tray and @airtable and take my idea from inception to production within a matter of hours!!

What do you think? Thoughts? Questions?

Share this Scrolly Tale with your friends.

A Scrolly Tale is a new way to read Twitter threads with a more visually immersive experience.
Discover more beautiful Scrolly Tales like this.

Keep scrolling