We Have Some Interesting Reads

Facebook Messenger Bots

Facebook Messenger Bots

In a previous article, we introduced chatbots – what they are and how they can be used to take your business’s marketing strategy to the next level. Now we are going to take a look at a step-by-step guide on how to build a Facebook Messenger bot for your business. Facebook Messenger bots have become increasingly popular, well-known for their advanced chatbot capabilities and integrations with Facebook AI learning, making it an intelligent and intuitive system. Using a Messenger bot can help you create an automated experience between your business and your users, allowing your business to scale effectively.

Before getting started with your Facebook Messenger bot, you are required to first determine your use-case. Often with chatbots, especially Messenger bots, it is best practice for your bot to have one key functionality to ensure simplicity and effectiveness when interacting with users. Once you’ve determined your use-case, you can better understand your target audience and build out an appropriate personality and tone for your Messenger bot.  Let’s say that we would like to build a bot to help users make reservations at our restaurant. Our target audience for our particular use-case, would include families, tourists, businesses etc. From this we know that our bot should be friendly and helpful. Our key focus area for our Messenger bot would be to help user’s make restaurant reservations.

In order to build a Messenger bot, you require a Facebook Page representing the identity of your business, a Facebook Developer account so that you can create applications that can be integrated with Facebook and a Facebook App specifically for Messenger, that contains information about the settings of your application including API keys, access tokens and URLs.

For a Messenger bot, a node.js project is required to house your code for your bot, as well as your environment variables to configure your Facebook App. You can obtain information for these environment variables after creating your Facebook App, these include your “Page_ID”, “App_ID”, “Page_Access_Token” and “App_Secret”. Environment variables make it possible for your locally deployed project on your computer, to know which Facebook page and App you are working with. These tokens are required so that you can perform API calls on behalf of your Facebook page from the Facebook App.

Messenger bots use Webhooks and Send/Receive APIs to build automated systems that can interact with users directly. Webhooks are pieces of code that sit in your node.js project and enable various functionalities in your bot, so that it can receive, interpret and respond to user requests. You are required to code Webhooks in accordance with your use case. There are code samples available on Facebook’s GitHub for Messenger bots that can be tailored to your business use-case. Github is a code repository that allows users to collaborate on their coding projects.  If you are going to use a code sample, you are required to have git setup.  You can then use your local environment to set up your user experience. For example, for the restaurant use-case, we would have to code functionality so that the user is able to give us the date/time of their booking, table size and confirm availability, and the bot would then have to send confirmation of their booking.

After coding your webhook, you can host your application locally and verify your token to set your webhooks. After running your application in your local environment, you can use a Platform as a Service (PaaS), such as Heroku, AWS’s Elastic Beanstalk, GCP’s Google App Engine or Firebase, and even Docker or Kubernetes to host your application. In the Messenger App you should then be able to search for your page and start your interaction with your webhook.

As you can see, there are few steps required for you to deploy your first Messenger bot using Facebook’s platforms and developer services. You can use your Messenger bot as a great way to interact with your customers and improve their overall user experience through automation – allowing you to focus on achieving your key business objectives.

Contact us today, to get started on your Facebook Messenger Bot Journey.

Categories

Need a great system built?
Get in touch today!