Dialogflow chatbot¶
A chatbot is a practical way to handle routine, repetitive questions so your human agents can focus on harder problems. Dialogflow is a widely used natural-language platform from Google for building such bots, and ChannelX ships with a native integration. This guide walks through creating a Dialogflow bot and connecting it.
Building a Dialogflow bot¶
- Open the Google Dialogflow Console and click Create Agent. This guide uses Dialogflow Essentials.
- Create intents that match how you want the bot to respond. Every project starts with two defaults — Default Fallback Intent and Default Welcome Intent — and you can add as many of your own as your use cases need.
That covers the basic bot. Next you'll create a service account so ChannelX can talk to it.
Creating a service account¶
- In the Google Cloud Console, open the project tied to your agent (click the Project ID in the agent's settings).
- Go to IAM & Admin → Service Accounts and click Create Service Account.
- Give it a name and description.
- Grant it the Dialogflow API Client role, then finish.
- Open the new service account, go to the Keys tab, click Add Key, choose JSON, and create it. Download the key file and keep it somewhere safe.
Connecting Dialogflow to ChannelX¶
- Go to Settings → Applications → Dialogflow and click Configure.
- Click Add a new hook. In the dialog, enter the Project ID, paste the full contents of the JSON key file into the Project Key file field, and choose the inbox the bot should run on.
That's it. Test the website inbox to confirm the bot answers the first query.
Advanced intents¶
Handoff intent¶
When a customer asks for a human, the bot needs to tell ChannelX to hand the conversation over.
Create an intent named something like Handoff Intent with training phrases such as "Talk to an agent" or "Speak with an agent." Give it a Custom Payload response:
{
"action": "handoff"
}
When this intent fires, ChannelX switches the conversation to open and passes it to an agent.
Interactive messages¶
The integration also supports interactive messages in the website inbox: options, cards, and articles. Create an intent with the right training phrases and a Custom Payload response. Here's an options message:
{
"content_type": "input_select",
"content": "Select your favorite food from below",
"content_attributes": {
"items": [
{ "value": "I like sushi", "title": "Sushi" },
{ "title": "Biryani", "value": "I like biryani" },
{ "title": "Pizza", "value": "I like pizza" }
]
},
"private": false
}
When the customer picks an option, the chosen value flows back to Dialogflow, so you can wire up follow-up intents — for instance, an intent trained on "I like biryani" to react when that option is selected.
Note
Interactive messages are currently supported only in the website inbox.
Returning a conversation to the bot¶
Because Dialogflow conversations start as pending, the bot triages first. After a handoff, the status becomes open and the bot stops replying. If an agent wants the bot to take over again, they set the status back to pending, and the bot resumes.