Dialogflow connector: handoff to human agent example
What if, during a conversation with your Dialogflow agent, you want the user to opt for a switch to a human agent?
The simplest thing that you can do is adding a specific intent to your Dialogflow agent that will switch to a human agent with a specific instruction in the reply.
Train the ‘talk to agent’ intent
Open your Agent’s Dialogflow console. Add a new intent. Let’s call this intent ‘Talk to agent’. We’ll train this intent with a single phrase (more phrases can be added as a convenience).
Now the intent will reply with:
We are putting you in touch with an operator \agent
Copy and paste this text in the Responses section of the “Talk to agent” intent:
The \agent keyword, at the end of the reply phrase, will never be shown to the enduser. Moreover “\agent” must be only word on the last line of the reply message.
\agent is an instruction for Tiledesk to switch the conversation to humans. As soon as Tiledesk see this instruction in the text it will remove the current chatbot (the Dialogflow agent) from the corresponding conversation and will try to invite a human, following the current department rules. If no agents are available the conversation will wait in the “unserved” queue until an agent becomes available again.
To test the new “Talk to agent” intent we also place a button under every DF reply (using Microlanguage) to allow the user to ask for an agent after each reply. Let’s train, for instance, the Default Welcome Intent Intent to show this optional button (using Microlanguage you can easily add a button with * symbol (starting a new line) followed by one space and the button text)
Hi! How are you doing? * Just questions * Talk to an agent
From now on every welcome intent reply the widget will show the “Talk to agent” button.
If we tap the button Talk to agent the corresponding “Talk to agent” intent will be invoked, the intent reply message is displayed in the conversation and the user will be routed to an agent on the current department (following the department routing rules, opening hours and agents availability).
Do you have any feedback on this article? Please send us your feedback writing an email to firstname.lastname@example.org