Integrations
Google Dialogflow messaging

Google Dialogflow messaging

Conversations SMS WhatsApp

Connecting Google Dialogflow with Conversations takes just minutes. With this integration, you can take advantage of the AI features in Dialogflow. For WhatsApp, all message types are fully supported. All conversations being processed by the bot is visible in All work.

What you will need

See Create an Account for more information on Infobip accounts.

Integration

Go to your Google console account (opens in a new tab), and then create and upload a JSON API key.

Google Dialogflow chatbot connector

All fields other than the API key are based on the data available in Google Dialogflow.

In Conversations, if you want to transfer a conversation to an agent, there is an option to configure an intent in Dialogflow that performs the transfer. When an intent is detected, the conversation is moved to an agent, routed through ACD and assigned to an agent.

Once you complete the setup, then in Conversations you'll see the chatbot setting in Third-party chatbots.

Using Google Dialogflow in Conversations

Here's how to get started and use Google Dialogflow in Conversations.

Send SMS messages

For a call center agent to send text messages, they must be configured in Dialogflow for text fullfilments, as shown here:

Google Dialogflow - fullfilment

Send rich messages

Once you have configured your chatbot, you should be able to send messages using the WhatsApp media template. In your Dialogflow console, specify the message in agent fullfilment. You can find your WhatsApp templates (opens in a new tab) via our API.

WhatsApp Media message templates

When sending a basic text message you should use text fulfillment. However, when you want to use the WhatsApp media template you should use Custom payload fulfillment (opens in a new tab).

Custom payload

Below is the general format of the template, the headers to use for text, images and video, and buttons.

As you can see there are several additional parameters that have to be provided regarding of which format of header template has.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader":{
                "format":"TEXT/DOCUMENT/IMAGE/VIDEO/LOCATION",
                Additional parameters that depend on format
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
            },
            "mediaTemplateButtons": [
                {
                    "type":"URL/QUICK_REPLY",
                    "parameters":["param1"]
                }
            ]       
        }
    }
 

Otherwise specify placeholder as in the example below.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader":{
                "format":"TEXT",
                "placeholder":"placeholder"
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
            },
        }
 

For sending images, specify the image URL.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader":{
                "format":"IMAGE",
                "url":"imageUrl"
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
        }
    }
 

For sending videos, specify the video URL.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader":{
                "format":"VIDEO",
                "url":"videoUrl"
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
        }
    }
 

For sending documents, specify the document URL and file name.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader":{
                "format":"DOCUMENT",
                "url":"documentUrl",
                "filename":"filename.pdf"
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
        }
    }
 

For sending location, specify latitude and longitude.

json
 
    {
        "channel":"WHATSAPP",
        "content":{
            "type":"MEDIA_TEMPLATE",
            "templateName":"testTemaplateName",
            "language": {
                "code":"en"
            },
            "mediaTemplateHeader": {
                "format": "LOCATION",
                "latitude": "19.19",
                "longitude": "20.20"
            },
            "mediaTemplateBody": {
                "placeholders": ["parameter1", "parameter2"]
        }
    }
 

For using buttons, both button types (URL and QUICK_REPLY) can have only one parameter.

json
 
    "mediaTemplateButtons": [
                {
                    "type":"URL/QUICK_REPLY",
                    "parameters":["param1"]
                }
            ]       
 

If your URL button does not have a placeholder then just skip it, as there's no need to specify it in mediaTemplateButtons.

Need assistance

Explore Infobip tutorials

Encountering issues

Contact our support

What's new? Check out

Release notes

Unsure about a term? See

Glossary

Research panel

Help shape the future of our products
Service Terms & ConditionsPrivacy policyTerms of use