Introducing Airbnb Bot
The Slack bot craze is in full effect so I thought I might as well build a bot of my own.
Meet Airbnb Bot. Give it a place, such as “Tahiti”, and get back popular Airbnbs in that location. Tapping on a result links you into the listing in the Airbnb app (if you have it installed) so you don’t have to log in to Airbnb to book the place.

Click here to add Airbnb Bot to your Slack
I used Botkit, URX, Heroku and MongoDB to get this bot up and running and encountered a couple “gotchas” in the process.
First, my bot kept going offline because the Heroku dyno kept falling asleep and needed to be recharged using Heroku Scheduler (more on this below).
Second, because Heroku doesn’t let node applications write to the file system, the built-in storage provided by Botkit containing teams who have installed my bot gets erased each time the Heroku server restarts. I used MongoDB to solve this issue (instructions below).
So if you want to use Botkit’s framework for your bot (which you probably do if you’re a bot noob like myself) and Heroku to host it, than follow these steps:
Heroku Scheduler
- Go to your Herkou Scheduler Dashboard at: https://scheduler.heroku.com/dashboard
- Add a new job to run a script in your project that wakes up your dyno every 10 minutes


3. Create a ping.js file in your project, which can be as simple as:


OK, that should keep your bot awake. Now here’s how to create a MongoDB database that your bot writes to each time a new user installs it.
Adding MongoDB with Botkit
- Add MongoLab to your Heroku add-ons in Resources*:


*A MONGOLAB_URI will automatically get added to your Config Variables in the “Settings” tab of your Heroku Dashboard.
2. Add this handy MongoDB storage driver for Botkit to your project.
3. Set the mongoURI and mongoStorage in your bot.js file. If you’re using Botkit’s Slack Button format (which enables you to make your bot available to multiple teams via a Slack Button), than the beginning of your bot.js file should look something like this:


Cool! Now each time someone installs your bot, their permissions will get written to your MongoDB storage and they will stay there (even after your Heroku server restarts).
Let me know if you have any questions or feedback on Airbnb Bot: [email protected]