Top Brands

Build Your First Chatbot using Facebook Messenger Platform

Yes you heard it right! You can now enhance customer experience at your Business with conversational bots. Facebook Messenger offers very powerful messenger platform to build personalized bot for your Business. The simple and easy conversational interface provides customers with immediate responses.

I am sure there will be many questions in your mind by now! What is a Chatbot? How it can empower my Business achieving higher Revenues and hard savings? How will it give my customers a personalized assistance?

So let’s get started with what exactly is a Chatbot? Chatbot is an artificial conversational messenger which provides powerful conversation and sharing capabilities and makes it easy offer instant customer support. Chatbots can be setup in two different ways - Artificial Intelligence based or Knowledge Base driven. You can also read more about chat-bots in great detail.

Now, we got familiar with that basic question- What is Chatbot?, here comes the other question- how it will me empowering my business and give users a prompt and personalized comfort?

Let’s consider a business case here, assume you are running an E-commerce website. The marketplace servers more than 20 thousand daily visitors but with a very low conversion ratio i.e 5-10 closable orders a day.

Now here is the thing, the bot can help you sell more if you're running an e-commerce store.

As we know ,everyone likes to check out all the details about the product, he or she interested to buy in a physical store but that is certainly not possible in an online store.

So why not to create a Chatbot on Facebook messenger platform to drive better engagement with website visitors in real-time, and respond to customer queries, to make them feel more personalized and connected to your e-commerce platform.

Similarly, there are many other related customer service examples that are built using Facebook Messenger platform such as CNN (The Cable News Network is an American basic cable and satellite television news channel owned by the Turner Broadcasting System division of Time Warner.) , KAYAK( is a fare aggregator and travel metasearch engine operated by the The Priceline Group)

I know things are getting Interesting now, you can’t wait any more, so let’s get started with our first Chatbot built over Facebook messenger platform.

So here is a Step by Step Guide for setting Facebook Messenger Chatbot-

Prerequisites

UBUNTU 16.04 VPS with NGINX , PYTHON , PIP , GUNICORN

FACEBOOK DEVELOPER ACCOUNT

SSL CERTIFICATE FOR DOMAIN

Assuming you have all the above pre-requisites ready up and running, here we start with commands:

SSH into your VPS and create a directory ./messenger in /var/www/

sudo mkdir -p /var/www/messenger

Go to link messenger.py and Copy Messenger.py file and create in messenger directory

Setup messenger.py file to listen on 443 on Nginx and use gunicorn to configure the sock file to pass in proxy settings

You can have a look at the following Nginx Conf file and adjust according to your settings messenger-nginx.conf

If you are not sure how to setup the above 4 steps then here are some useful references.SSL CONFIG: lets encrypt

Now Choose the a facebook page from the list of pages you created on facebook and incase you don’t have any page then add a new page accordingly.

Setup Webhooks now by selecting the services. So in this you will need to provide 2 inputs 1st is Secure facebook callback Url which we just created initially and 2nd is Verify Token. Be careful with the Verify token becuase you will need to use the same in your messenger.py which is available on messenger.py

Now that you have verified all the inputs click on verify and save.

Remember facebook will not allow you to save until you secret_token matches on both messenger.py and this Input.

Once all the inputs are correct you will be redirected and success message of complete will be there

Now Subscribe to the newly created page below and we are done thats’it.

Remember the APP is not published yet, so only user logged in Facebook can access this functionality. If you need to add more users then you can add them as Testers and Developers until your APP is Live for public.

For Making your APP live you will need to submit for review to facebook. Currently in the above code on github we have set our bot to reply with same message which you will be type.

Example -->

You : hello there!

Bot : you wrote hello there!

You : OK!

Bot : you wrote OK!

Now you can edit the messenger.py file according to your Business Logic and echo on basis of Artificial Intelligence Or Knowledge base.

Techpillar.com

At TechPillar you can browse, compare, evaluate technology products on a single platform without going to multiple OEM's website. You can easily search products and narrow down your requirement with the specifics. Through our handy featured filters you can refine your search and choose the right product suiting the business requirement. Products are listed with detailed overview, warranty details, licensing information and full length of specifications. With quick comparisons you can view products from different OEM products compared in a single pane.

Check out our knowledge base with latest articles, as they help you spot the latest must-haves and the savviest steals. Or participate in our Blogs section to get answers to your open queries.

Buying, Implementation, AMC, Support services, Best price, Right system integrator ? be rest assured, we have an authorised partner base who would help you close your requirements in much professional way. Also, you will he hand holded by TechPillar team till the closure of your requirement.

You can reach out to us for any of your IT infra requirement and we can help you get the right solution with best quote.