Open new conversation

Opens a new conversation, or opens a new conversation with a message.

Open a new conversation

To open a new conversation when the customer sends the first message, set the afterCreateConversation callback to run after the customer sends their first message.

Kustomer.openNewConversation(afterCreateConversation: { convo in
    print(convo.id)
})

Open a new conversation with an initial message

📘

initialMessages appear on the mobile chat UI only

The texts you include in the initialMessages array will only appear for the mobile chat interface. The messages will not display for the web chat widget.

Use initialMessages to set chat to open with a series of messages at the start of the conversation.

Kustomer.openNewConversation(
  initialMessages: ["Hello","How can we help?"],
  afterCreateConversation: { conversation in
    print("New conversation created. Conversation id is \(conversation.id)")                          
  }, animated: true)
)

👍

animated: true vs. animated:false

Pass in animated: false to open a new conversation without the chat history. Otherwise, the chat UI displays for the customer their chat history before chat displays the new conversation.


Did this page help you?