DialogFlow

Build a Dialogflow-WhatsApp Chatbot

There are times and channels where the use of Natural Language Processing (NLP) can positively impact the customer experience. One such channel is the world's most popular messaging app, WhatsApp. Therefore, this article will show you how to build a chatbot using Googleโ€™s NLP software Dialogflow in combination with our WhatsApp API.

Build Your Dialogflow Agent

First and foremost, you need to create your Dialogflow agent. In short, โ€œagentโ€ is Dialogflow is, essentially, the bot you are building. We have to start here:

Next, create the name, pick the time zone and language for your agent. Select your Google Project. It's required. This ID will be used later.

Its main building components are intents which help the agent identify what the user actually wants to do.

Each intent requires training phrases (all the different ways a user can ask for the same thing) and, of course, the responses (always create more variations to keep repeat conversations natural.

When all that is set up, go to the intents section using the menu on the left and start creating the intents.

Create phrases (as many as you can) that users will write to you:

Prepare the answers (preferably a variety of them) that the bot will use in its response:

Connecting integration in dashboard

  1. Connect any number to Whapi.Cloud.

  2. Go to your personal cabinet of Whapi.Cloud to the Integrations section and select DialogFlow there.

  3. Get the token by granting permission to our app to process your bot in DialogFlow.

  4. Use the API documentation to work with DialogFlow.

Warning, this is not a chatbot builder. This is an integration built for developers!

API Endpoint

POST https://tools.whapi.cloud/integrations/google_dialog_flow/send

The request will require specifying a Header with the name Authorization and the value "Bearer {your_channel_token}"

Body:

{
    "token": "YOUR_Google_auth_TOKEN",
    "message": "Hello",
    "bot_id": "YOUR_DialogFlow_ProjectID"
}

In response you will receive a result generated by DialogFlow, use it to send a message from the bot to your clients!

Last updated