PrideBot is a reminder that pride is both worldwide and never-ending πŸ³οΈβ€πŸŒˆ

Just one text will help you find a parade. Or a festival. Or a carnival. Or a cruise. Whatever floats your boat.

Griffin Solot-Kehl
Jun 28th, 2019
Share

Photograph by Samuel Wantman, distributed under a CC BY-SA 4.0 license.

Latching onto an idea

Here in San Francisco, Pride Weekend is right around the corner, and in order to celebrate, I decided to build PrideBot, a bot that will text you the soonest pride event in the city you give it.

Glamorous results

PrideBot is built using Apify’s Task API as a way to gather event data combined with Twilio’s SMS API, using Transposit as the backend. You can see all of PrideBot’s code on Transposit here: https://console.transposit.com/t/transposit-sample/pridebot

When you text PrideBot at +1 (415) 301-3658, it will pull the most recent dataset produced by the Apify task (which is run weekly), and attempt to match the city in your message to an event in that dataset. If there is a match, it will choose the most recent one and reply back to your phone with all of the information you need.

Behind the process

To get the a searchable list of events, I needed a source, as well as and a way to parse them into a digestible format. This allows me to use a matching algorithm to send the best response. To do this, I wrote a custom Apify task to scrape this pride calendar for all of the future events. Apify allows me to essentially turn any website I want into an API with their scrapers. You can view the task code here.

Twilio gives us a solution for the text messages by giving us a phone number for the bot, the messaging API to send texts, and their ability to give us the data of a received message with webhooks.

Getting Apify and Twilio to work together in Transposit was simple and convenient, as it requires no dedicated server and allows you to easily test the components individually (and see their outputs) while you develop. We can update our Apify dataset every week (or as often as we choose) by using a Scheduled Task in Transposit to call the task. Using a webhook, it can also run a function every time Twilio receives a new message by directing Twilio to our webhook URL. Being able to debug and view responses to our API calls easily with the Transposit console took out all the guesswork from integrating the two connectors together.

Towards the future

PrideBot is one example of what can be done with Transposit integrations and Twilio. Our webhook system makes it simple to create a Twilio bot, where you can use any of our connectors to make it your own. I hope to continue tweaking PrideBot to be the best little bot it can be with added features and improved location matching. If you want to create your own bot, go fork PrideBot on Transposit and go crazy! πŸ³οΈβ€πŸŒˆ

Share