Conversation
Launch conversation
Before creating a conversation, you need to log in. To launch the conversation, create a conversation object and pass it to the buildConversation function. The conversation is created/launched based on the parameters of this object.
Build Conversation
There are multiple ways to build a conversation:
With Chat Widget
You can directly click on the Chat Widget to create a conversation.
With Code
You can build a conversation with code as well, in which you can pass some custom data to build the conversation.
dynamic conversationObject = {
'conversationTitle': '<Pass_Conversation_Title>',
'clientConversationId': '<Client_Conversation_ID>',
'agentIds': ['<AGENT_ID>'], // List of agentIds. AGENT_ID is the emailID used to signup on Kommunicate
'botIds': ['<BOT_ID>'], // List of botIds. Go to Manage Bots(https://dashboard.kommunicate.io/bots/manage-bots) -> Copy botID
'messageMetadata': {'key1': 'Value1'}, // you can pass multiple key-value pairs.
'conversationAssignee': '<AGENT_ID/BOT_ID>' // To set the conversation assignee, pass AgentId or BotId.
}; // all the values are optional, you can also pass an empty object that will also create the conversation.
KommunicateFlutterPlugin.buildConversation(conversationObject)
.then((result) {
print("Conversation builder success : " + result.toString());
}).catchError((error) {
print("Conversation builder error occurred : " + error.toString());
});
Open Particular Conversation
To open any specific conversation of the logged-in user, you can use this function:
KommunicateFlutterPlugin.openParticularConversation("<Conversation_ID>"); // conversationID you will receive in the result of build conversation. The conversationID is unique for every conversation.
Open Conversation List Screen by Code
To open the conversation list screen by code, you can use this function:
KommunicateFlutterPlugin.openConversations();
Send Messages by Code
To send a message without opening a conversation from the widget, you can use this function:
KommunicateFlutterPlugin.sendMessage({
"channelID": "$coversationIDValue", // conversationID you will receive in the result of build conversation. The conversationID is unique for every conversation.
"message": "$messageText"
});