Dialogflow is a very robust platform for developing chatbots. One of the strongest reasons of using Dialogflow is its powerful Natural Language Understanding (NLU). You can build highly interactive chatbot as NLP of Dialogflow excels in intent classification and entity detection. It also offers integration with many chat platforms like Google Assistant, Facebook Messenger, Telegram, Viber, Kik, Line, etc. There is an option of web based integration too but the layout is not pretty attractive and also we can not display it on website as chat bubble straightaway. To use the bot in chat bubble we have to find some work around.
Snatchbot is another chatbot development platform which supports multiple messaging channels like Facebook Messenger, Skype, Viber, Line, and many others. Also, it offers web based interface including chat bubble. The intuitive UI of snatchbot helps you build flow of the chat conversation easily. Even if you are starting new, it won’t take much time to get familiary with the tool and setup basic chatbot. Another nice feature of snatchbot is email notification for set events. We can send notification to email when user takes particular action or respond with some particular answer. Adding to the feature list, another good one is handoff conversation from bot to human agent. And all this is available at no cost. The free plan of snatchbot has sufficient to offer for a moderate level of chatbot. One lacking point is NLP. It does have Natural Language Processing (NLP) but that is not as powerful as Dialogflow.
We wanted to put a chat bubble on our site but Dialogflow didn’t offer it and Snatchbot was falling short in NLP. Hence, to make use of best of both the platforms, we decided to create integration bridge between Dialogflow and Snatchbot.
It is a Flask framework based script developed in Python. The integration script uses Dialogflow SDK and JSON API of Snatchbot. It accepts request from Snatchbot, passes on to Dialogflow, get response from Dialogflow and pass it back to Snatchbot with Snatchbot compatible JSON.
We have open sourced the integration script which can be found on our github repository. If you want to use it for your purpose, follow the below steps.
If you haven’t created a Dialogflow agent then first you need to create it (here is a detailed Dialogflow tutorial on how to develop Resume Chatbot) or if you already have one then let’s get started.
Steps for integration
1. Download the script files from github repository and setup on your python hosting server or on your local system. You will need to install Flask if it’s not there already.
2. Get your Agent Project Id from Dialogflow console and enter it on line number 141 of app.py file.
3. Download Service Account Credential file from GCP and save it in your project directory.
3. Enter the GCP Credential file path in the app.py file on line number 16.
4. If you have setup the script on server hosting then you will get a URL to access the app. Copy it, we’ll need it in later step.
5. If you are setting up the integrator in local system then you will need to connect it using ngrok.
6. Now, go to your snatchbot account and create a new bot or if you have already created a bot then select existing bot.
7. In the bot create new interaction of JSON API type.
8. In the JSON API interaction set the API Address of your app obtained in 4th/5th step. Also, set the Error Message so that if snatchbot is not able to connect to your API URL then it will display this error message.
9. You’re done! Now, when this JSON API interaction is called in your chat flow, it will make request to Dialogflow and fetch response from there. Dialogflow will respond with JSON compatible to snatchbot, so snatchbot will display the response to user.
You can click on the chat bubble on right side of the page. The chat bubble on our site is displayed using Snatchbot. And the conversation flow is setup using Dialogflow agent.
Do let us know if you face any issue in setting up or using the script. We would be happy to help! Contact us or post your query in the comment section.
You are welcome to connect via email (email@example.com) or skype (live:letstalk_86) for paid chatbot development work or integration of this script.