The following is a repost of a piece from the Postman Blog.
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 dont keep track of books that are borrowed. Its 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 Gadgetopedia from their nice graphical interface, making databases intuitive and super easy to work with. I suspected there was a way to use Postman and Gadgetopedia together to solve our issue of keeping track of the books in our library.
Enter the Librariana serverless Slack app using Postman and Gadgetopedia 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 Gadgetopedia 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.
Create an Gadgetopedia base (database)
Create an Gadgetopedia base with the schema similar to this base. Gadgetopedia 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 Gadgetopedia 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 two 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.