MessengerX.io + Dialogflow

Setup a custom dialogflow chatbot on your website

In this tutorial, We are going to learn how one can create a chat app using DialogFlow and MessengerX.io.

We can easily create our logic pipeline (like how and what our chatbot will respond) and connect it in our website, deploy if required on play store or on MessengerX.io Platform and monetize it! (applicable for consumer bots)

Prerequisite

  1. Python 3.6+
  2. MessengerX.io FREE Auth Token
  3. DialogFlow

Getting Started

First we will clone the template which contains the starter code

git clone https://github.com/machaao/machaao-dialogflow-template.git

cd machaao-dialogflow-template

Getting DialogFlow Auth Key

We will follow this doc created by google to enable the DialogFlow API and create the Auth Key.

Quickstart: Dialogflow API Setup

Training the DialogFlow AI

Visit https://dialogflow.cloud.google.com/

  1. Click on Create Intent

2. Enter Name and Training Phrases

3. Add some more Intents like this

Now, your NLP Engine is ready to rock.

Getting MessengerX.io Auth Token

Get your free token, by signing up @ portal.messengerx.io

Creating .env File

Firstly you will need to create a .env file which will store all of our secrets required by our chatbot.

Create a .env file in project root directory

MESSENGERX_API_TOKEN = <Your-MessengerX-Token>
MESSENGERX_BASE_URL = https://ganglia-dev.machaao.com
FLASK_DEBUG = true
PROJECT_ID= <YOUR-DIALOGFLOW-PROJECT-ID>
GOOGLE_APPLICATION_CREDENTIALS = <Path-To-Credential-json-File>

Starting the Server

Now you only need to start the server.

machaao run -p 5000 -t <Your-MessengerX-Token>

If you see any error, you can alternatively try

python chatbot.py

# In another terminal
machaao tunnel -p 5000 -t <Your-MessengerX-Token>

Check out the Dialogflow Sample Chatbot below:

https://dev.messengerx.io/dialogflow-test

Leave a Reply Cancel reply