If you want to use Dialogflow agent in facebook messenger then it can be done easily using Dialogflow integrations. But the catch is that you need to create a Facebook App and get it verified. The verification process not only checks for chatbot functioanlity but also requires Business Verification. In business verification process you need to upload proof of business registration. So it gets difficult to publish a chatbot without a registered business.
One work around to bypass business verification is to use chatfuel bot. Chatfuel bot doesn’t require verification on messenger. You can create a bot on chatfuel and simply connect your facebook page with it. The bot starts workings instantly.
But in our case the chatbot is developed using Dialogflow so we need to integrate Dialogflow with Chatfuel. We have created this simple script in Python using Flask which is an integration between Chatfuel and Dialogflow. It works as a bridge between Chatfuel and Dialogflow converting response from Dialogflow and turn it into chatfuel compatible JSON. So, now your chatbot can work on Facebook Messenger.
You can download the script from our GitHub Repository.
1. Get your Agent Project Id from Dialogflow console
2. Download Service Account Credential file from GCP.
3. Enter the file path downloaded above in the app.py file on line number 16.
4. Run your code using Ngrok if you are using this integrator from local machine and copy the Ngrok url.
5. Go to Chatfuel Dashboard and open your existing chatbot or create a new chatbot.
6. Go to the Default Answer block and remove all existing cards and add a new JSON API card. In the JSON API card URL textbox, enter the Ngrok URL.
7. That’s it, now you can test your NLU powered chatbot on messenger.
Using this integrator we made our Railway Buddy chatbot work on Facebook Messenger without business approval. You can check the bot at Railway Buddy on Facebook Messenger.
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 comments.