Kustomer.openConversationById()
Opens a conversation with the conversation id.
Use Kustomer.openConversationById()
to open the chat widget and take the customer to a specific conversation based on the conversation id.
First, initialize chat fully
Kustomer Chat must finish initializing fully with
Kustomer.start()
before you can execute any additional Web SDK methods.Tip: Call other methods inside the callback of
Kustomer.start()
to ensure Kustomer Chat always completes initialization before the code tries to run other methods.To learn more, see Troubleshooting: Kustomer method calls won't execute.
Examples
// Go to a conversation by conversation id
Kustomer.openConversationById({
conversationId: 'SOME_CONVERSATION_ID'
});
// Go to the conversation and run a callback
Kustomer.openConversationById({
conversationId: 'SOME_CONVERSATION_ID'
}, (response, error) => {
if (error) {
console.error(error);
} else {
console.log('Successfully opened conversation');
}
});
Syntax
Kustomer.openConversationById(options, function(null, error))
Parameter | Type | Description |
---|---|---|
options | Object | Required An object with the conversation ID. If invalid, an error will be returned in the callback. Example: { conversationId: 'CONVERSATION_ID' } |
function(null, error) | Function | Optional A callback that is run after Kustomer.openConversationById completes.error is either undefined or a native JavaScript Error object. |
Updated almost 4 years ago