Start new conversation
Starts a new conversation, or opens a new conversation with a message.
Usage
startNewConversation(
initialMessage?: KusInitialMessage,
customDescribe?: Record<string, string>,
animated?: boolean
): Promise<KusConversation>
To start a new conversation, call startNewConversation
:
import KustomerChat from '@kustomer/react-native';
KustomerChat.startNewConversation();
Parameters
startNewConversation
accepts an optional KustomerInitialMessage
object as a
parameter, and a Record<string, string>
object as a second parameter, as a
custom description map.
import KustomerChat from '@kustomer/react-native';
KustomerChat.startNewConversation(
{
body: 'Hello, I have a question',
direction: 'user',
},
{
'custom.description': 'This is a custom description',
'user.subscribed': 'true', // pass any custom string-string you want
}
);
Return Type
startNewConversation
is a promise that returns a KusConversation
object. When an error is thrown, you can catch
it like you would any other promise.
try {
const conversation = await KustomerChat.startNewConversation();
console.log(conversation.id);
} catch(error) {
console.error(error)
}
KustomerChat.startNewConveration()
.then(conversation => {})
.catch(error => {});
Updated 7 days ago