Integrate your AI agent with Kommunicate
Overview
Kommunicate has the provision to integrate any third-party (Dialogflow, Microsoft AI Agent Framework, IBM Watson etc) or custom-made AI agents in the website. You can deploy your AI agents to automate the repeated tasks and reduce the workload on your human agents. AI agents can handle all the incoming conversations and when unable to answer, they can assign the conversation to humans. In this section, learn how to:
- Integrate with any AI agent platform
- Assign all conversation to the AI agent
- Assign conversation to AI agent based on certain events
- Handoff the conversation to human if AI agent is not able to answer
- Use Rich messages to make conversations interactive
- AI Agent Events
Integrate with any AI agent platform
Kommunicate has built-in support for some AI agent platforms like Dialogflow and provides integration with other AI agent platforms by custom AI agent integration. Here is the list of supported platforms(we will add more platforms in due course) and the detailed instructions for integration:
Once you have integrated the AI agent you can let it handle all the incoming conversations. You can design your AI agent to collect the required detail and handoff the conversation to a human agent if its not able to answer.
Assign all the new conversations to the AI agent by default
Once you have integrated an AI agent, you need to enable the conversation rules for the AI agents.
Go to Kommunicate Dashboard -> Settings -> Conversation rules and enable "Assign new conversations to AI agent" and select the AI agent from drop down list.
Once this is done, all new incoming conversations will be assigned to the selected AI agent. You can test it out by starting a new conversation from your website and see how your AI agent reply. You can always design your AI agent to handoff the conversation to human agents if it's not able to answer.
Assign conversations to specific AI agents based on the webpage
If you wish to assign conversations to specific AI agents based on which webpage the conversation is started from, you can call Kommunicate.updateSettings() method in onInit callback function of our installation script.
For a brief detailed description of it please refer to Kommunicate update settings method.
Assign conversations to specific AI agents based on certain events
You can start group conversations with AI agents using startConversation(conversationDetail, callback).
var conversationDetail = {
"agentId": "<AGENT_ID>", // optional, if you don't pass agent Id, default agent will automatically get selected.
"botIds": ["<BOT_ID>"], // array of AI agent Ids
"assignee": "<ASSIGNEE>" // AI agent or human agent id who you want to assignee the conversation. if nothing is passed, conversation will be assigned to default agent.
};
Kommunicate.startConversation(conversationDetail, function (response) {
console.log("new conversation created");
});
Hand off the conversation to a human if the AI agent is not able to answer
AI agent to human handoff comes in handy when the AI agent is unable to answer the customer or is unable to understand what the customer is saying. There are multiple ways of achieving this and it depends on the AI agent platform. You can refer to the following links to get Detailed information on how to implement the handoff feature on different AI agent platforms.
- AI agent to human handoff in Dialogflow
- AI agent to human handoff in Amazon Lex
- AI agent to human handoff in Custom AI Agent
Set up the "Talk to Human" option
The user can be given an option to directly talk to a human agent.
Here is the example: when the user clicked on the button “Talk to Human,” the AI agent handed off the conversation to the human agent.

Below is the example for Dialogflow custom payload to add the above shown menu option for transferring the conversation to a human agent.
{
"message": "How can I assist you today?",
"platform": "kommunicate",
"metadata": {
"contentType": "300",
"templateId": "6",
"payload": [
{
"title": "Talk to Human",
"message": "Talk to Human"
}
]
}
}
Here, the "Talk to Human" should be mentioned as a follow-up intent and the following payload is passed to it.
{
"metadata": {
"KM_ASSIGN_TO": ""
},
"platform": "kommunicate",
"message": "Please stay connected while we connect you to a human agent..."
}
Set "KM_ASSIGN_TO": "<AGENT'S USER_ID>" if you want to assign the conversation to a specific human agent.
For Kompose, you have to create a button "Talk to Human", for that button, create a separate intent and then add the above payload under the 'Custom' section
Use Rich messages to make conversations interactive
Your AI agent can be designed to send rich text messages to make conversations more interactive and useful. Here is a list of rich text messages supported by Kommunicate.
When setting an intent response in the Dialogflow console, click on Add Response under DEFAULT tab and choose Custom Payload. Set below JSON as the response of the intent.
{
"platform": "kommunicate",
"metadata": {
// valid JSON for any type of Kommunicate's Rich message.
}
}
Pass any kind of Kommunicate supported Rich messages
Sample JSON for Suggested Replies
{
"platform": "kommunicate",
"metadata": {
"contentType": "300",
"templateId": "6",
"payload": [{
"title": "Yes",
"message": "Cool! send me more."
}, {
"title": "No ",
"message": "Don't send it to me again"
}]
}
}
AI Agent Events
AI Agent Events signify communication that can't be captured easily through text or voice. Examples include, clicking a 'Buy' button, adding an item to the shopping cart.
If you are using Dialogflow, then visit Dialogflow Custom Events to know more.
Trigger event on AI agent platform
Call the following function to trigger an event on the AI agent platform.
var messagePxy = {
"type": 5,
"contentType": 10,
"message": "Event: " + <EVENT_NAME>,
"groupId": KommunicateGlobal.CURRENT_GROUP_DATA.tabId,
"metadata": {
"category": "HIDDEN",
"KM_TRIGGER_EVENT": <EVENT_NAME>
},
"source": 1
};
Kommunicate.sendMessage(messagePxy);
For example, if we want to trigger the welcome event, this is how we can do.
var messagePxy = {
"type": 5,
"contentType": 10,
"message": "Event: " + "WELCOME",
"groupId": KommunicateGlobal.CURRENT_GROUP_DATA.tabId,
"metadata": {
"category": "HIDDEN",
"KM_TRIGGER_EVENT": "WELCOME"
},
"source": 1
};
Kommunicate.sendMessage(messagePxy);
Replace: <GROUP_ID> with the group id of the conversation in which you want to trigger the message.
GroupId value will be available in ’response’ of Kommunicate.startConversation call. Replace <EVENT_NAME> with the AI agent platform event name.
Working with Actions
Actions are the triggers that tell Kommunicate to perform certain tasks. Kommunicate exposes these actions to give more power to your AI agent. The examples of the actions are:
- Resolve a conversation
- Handoff a conversation to a human agent
- Fetch the availability status of human agents
- Update user detail
Your AI agent can make a action request by passing the action name in the actionRequest parameter in metadata.
Actions are supported with all AI agent platforms. In case of Dialogflow integration, the metadata can be set in a custom payload. In case of a custom AI agent platform it can be returned as the webhook response.
If you are working with Dialogflow fulfillment make sure you are using the correct format as mentioned here.
Resolve the conversation from AI agent
An AI agent can be configured to resolve the conversation when it is appropriate to do. It can be done by making an action request with the value resolveConversation to Kommunicate. Once the request is received Kommunicate will close the current conversation, notify the user and the conversation will be moved to the resolve section of the Kommunicate dashboard.
Here is how action request for resolving the conversation look like:
{
"platform": "kommunicate",
"message": "We are resolving this conversation. Please reach out to us in case of any more queries.",
"metadata": {
"actionRequest": "resolveConversation"
}
}
Auto-tagging the conversation through AI agent
An AI agent can be configured to auto-tag the conversation when it is appropriate to do. It can be done by making an action request with the value addTags and the tags to be added. Once the request is received, the AI agent will auto-tag the conversation in the dashboard.
Here is how action request for auto-tagging the conversation looks like:
{
"platform": "kommunicate",
"metadata": {
"actionRequest": "addTags",
"payload":{
"tags":["Marketing","sales","tech"]
}
}
}
In the example below, the 'Marketing' tag was used for the intent, and the AI agent tagged the conversation as 'Marketing' in the dashboard when the user phrase got triggered.

