Inspiration

Facebook Messenger Bots are incredibly useful for communication in emergency situations and where widespread dissemination of information is difficult - such as developing nations. However, in many such places and situations, data networks may not be available, natural disasters may have damaged the necessary infrastructure, or access to smartphones may be limited. This project wanted to find a way to allow more people to access the benefits of Messenger Bots so long as they have a cellular phone and access to text messaging.

This also makes the functionality of Facebook Messenger Bots available to people who may not otherwise use Facebook or Messenger - providing another way for businesses and organisations using bots to engage with a wider audience.

What it does

TextBot plugs into a Facebook Messenger Bot and makes the bot accessible via SMS / text messaging service (which operates on a different frequency to data networks, and is more widely available).

How I built it

TextBot is written in Python and hosted on Heroku. It uses the Facebook Messenger Bot API to provide the basic bot functionality, which is then integrated with Twilio (using custom code) to provide access to the bot's functionality via SMS.

As this uses Twilio, multiple phone numbers can be used and associated with the bot - and these phone numbers can be local to particular countries. For example, if a developer would like their bot to be accessible via text message in both the USA and Australia then two numbers could be setup (which both "virtually" point to the bot): a +1 number (USA) and a +61 number (Australia) so that users in the different countries can text the bot for the cost of a local text message. This is very important if the bot was to be used in developing nations, where users are less likely to have the ability to text international numbers.

Challenges I ran into

This project was the first time that I had used the Facebook Messenger Bot APIs, Twilio, and Heroku. The biggest challenge was converting between the differently formatted payloads for the Facebook Messenger Bots and Twilio SMS gateway - as this project required both sending and receiving payloads in these formats (i.e. inbound and outbound Facebook Messenger Bot messages and Twilio SMS messages).

Accomplishments that I'm proud of

Having a fully working prototype using several technologies and APIs which I have never used prior to this hackathon. I also worked on this project solo, and only came up with the idea while listening to the Community Leaders speaking at the beginning of the competition - who provided the inspiration for this idea.

What I learned

The most valuable aspect which I learned is the power of Facebook Messanger Bots - and the flexibility of what they are capable of doing in terms of rich content and interactions. It was also very interesting to learn how to receive SMS messages within software, process based upon their content (text), and then perform some kind of transformation logic.

What's next for TextBot

This project is very much a proof-of-concept and the SMS logic is tightly integrated with the Messenger Bot logic. There are two keys aspects I would like to improve upon into the future.

  1. Abstract and decouple the SMS logic away from the Messenger Bot code, allowing this to be a true pluggable module which other developers can take to extend their existing bots with SMS functionality with minimal configuration and code changes.

  2. Support additional conversation components. In this project, the only conversation component supported is message templates using buttons. This was chosen as, following discussions with the Facebook mentors, it was clear this is one of the most frequently used components - and it also suits a purely text-based presentation (making for an easier integration into the SMS system). Providing support for other components will be more challenging, as some do not suit a text-based presentation (e.g. assets and attachments) so consideration will need to be given as to how these could be implemented, most likely with some kind of graceful degradation / fall-back.

How to access

The TextBot Messenger Bot can be accessed by messaging "Help Me" to the chat at: https://www.facebook.com/TextBot-207513466520933/ Note: The bot is not published (as it's subject to review) so you may not be able to access it via this page. However, you should be able to access the SMS version from the phone number below.

The TextBot SMS version can be accessed by texting "Help Me" to: +1 415-870-8210

Built With

Share this project:

Updates

Submission history