How to Host a Python and Flask Facebook Messenger Bot on Heroku
With the rise of bots, people can create new tools to help make people’s lives easier. In the first part of this bot series, we discussed how to make a Facebook Messenger bot using Python, Flask, and Ngrok. However, for a bot in production, having all the requests processed on your personal computer won’t work well. That’s where a hosting service like Heroku can come in. Services like Heroku’s allow you to host your program on their servers making it available for people to access 24/7. In this guide, we will talk about how to migrate a Facebook Messenger bot from being run on Ngrok to Heroku. For the purposes of this guide, we’ll use Heroku’s free hobby tier.
Register an Account with Heroku
Building Facebook Messenger Bots with Python in less than 60 minutes
Chatbots are magical. Bots can be an amazing product that allow people to create new experiences, from reporting personal news to delivering women’s healthcare information. When I first learned about bots, I never imagined I would be able to make one on my own. However, I quickly dug into the Facebook Messenger documentation and began learning how with a bit of Python 3 and Flask, one could get a bot up and running in no time.
We’ll cover everything from the basics of how bots work to building our own basic Facebook Messenger bot. Specifically, we’ll be making a basic version of Black Girl Magic Bot, a Facebook Messenger bot that sends users images, playlists, and generally uplifting messages to remind them just how amazing they are. If you’re interested into digging the code for the bot, you can fork it and play with it via ...