Librarian: Building a Serverless Slack App Using Postman and Airtable

At Postman, some of us are avid readers, and we have a nice little library at our office where we share our books. Even though our library is small, finding a book is tedious because we have to manually search for one. We don’t keep track of books that are borrowed. It’s happened before that I want to read a book, but it was borrowed by someone, and I end up ordering a new one.

As a UX designer at Postman, I was familiar with Airtable from their nice graphical interface, making databases intuitive and super easy to work with. I suspected there was a way to use Postman and Airtable together to solve our issue of keeping track of the books in our library.

The Librarian

Enter the Librarian – a serverless slack app using Postman and Airtable to check the availability of a book in the office library. In this case, we are searching for a book using a Slack app, and also storing the books that we have in the Postman office using Airtable as a database.

You can search for your book by typing /bookbug [book-name] in Slack. No switching applications or learning a new UI! ?

If the book is up for grabs, you will see the details of the book –

If the book is with someone, you will know who is reading it currently-

If the book is unavailable, well, it is time to buy a new book –

When you type /bookbug The Hobbit in Slack and hit enter, the message (and its data) is sent to the configured external URL (Postman monitor url in our case) via HTTP POST. The monitor starts the “Librarian” collection run.

Get Started

Create an Airtable base (database)

Create an Airtable base with the schema similar to this base. Airtable provides a nice graphical interface to add entries to the base. You can also click on “Copy base” on the top right of this base to create a copy for yourself. We will use the Airtable API to query this base.

Create a Slack app (frontend)

Log in to your team Slack account and create a Slack app. Then activate and configure a slash command and install this app to your Slack workspace. You will need to enter the Postman monitor URL which we will create below in the Request URL text box.

Run in Postman

Click the orange Run in Postman button to import the sample collection and environment template into your Postman app. Before you can run the Librarian collection, you need to update the Librarian.template environment you downloaded with the Run in Postman button. Add appropriate values to the variables:

Create a Postman monitor

There are currently 2 ways to run a Postman monitor on-demand. You can manually run a monitor from the Postman web dashboard, or you can use the Postman API to run a monitor, but these methods don’t allow you to send a payload. This on-demand Postman monitor – which functions like a webhook – will receive the payload sent by Slack and start the “Librarian” collection run.

Note: Postman webhooks are still under development, and not yet recommended for commercial use.


Need help getting started? Check out the Librarian documentation for step-by-step instructions.


This story has also been shared on the Airtable blog.

What do you think about this topic? Tell us in a comment below.

Comment

Your email address will not be published. Required fields are marked *


This site uses Akismet to reduce spam. Learn how your comment data is processed.