Start new conversation
Starts a new conversation, or starts a new conversation with a message.
Start a new conversation
Kustomer.startNewConversation(afterCreateConversation: { convo in
print(convo.id)
})
Open a new conversation with an initial message
KUSInitialMessage
This struct takes a string for the "body" of the message and a direction which can be either .agent or .user, depending on which "side" of the conversation you wish the message to appear from.
Use initialMessage
to set chat to open with a messages at the start of the conversation.
Kustomer.startNewConversation(
initialMessage: KUSInitialMessage(body: "Hi, I need help", direction: .user),
afterCreateConversation: { conversation in
print("New conversation created. Conversation id is \(conversation.id)")
},
animated: true
)
Agent
initialMessage
appears on the mobile chat UI onlyIf the message you include as the
initialMessage
is from the .agent direction it will only appear for the mobile chat interface. The messages will not display for the web chat widget.
Start a new conversation and immediately add description parameters
If your organization has custom parameters for its Conversation Klass that you wish to set on every conversation you can do so without calling Kustomer.describeConversation
. Pass the key-value pairs you wish to use in the customDescribe
parameter of the startNewConversation
function.
Kustomer.startNewConversation(customDescribe: ["customStr" : "Custom String"])
Please note that these parameters (and their specific key) must match those set up in your organization just like the
Kustomer.describeConversation
function.
animated: true
vs.animated:false
Pass in
animated: false
to open a new conversation without the chat history. Otherwise, the chat UI displays the customer chat history before displaying the new conversation.
Updated almost 2 years ago