Control conversations
By default, Tori tries to keep the visitor on the conversation they were last using. If the visitor has never used the chat before, Tori starts a new conversation.
Start fresh on initial load
Use resume-conversation="false" when a page should always start with a new conversation, even if Tori finds an earlier one.
<tori-popup app-id="APP_ID" agent-id="AGENT_ID" resume-conversation="false" ></tori-popup>
This only affects the initial conversation selection.
Start a new conversation from JavaScript
Both elements expose startNewConversation() after the chat UI has loaded:
<button id="start-over">Start a new conversation</button>
<tori-popup
id="tori"
app-id="APP_ID"
agent-id="AGENT_ID"
></tori-popup>
<script>
const tori = document.getElementById("tori");
document.getElementById("start-over").addEventListener("click", () => {
const conversationId = tori.startNewConversation();
console.log("New conversation:", conversationId);
});
</script>
You can also call startNewConversation() on <tori-chatbox>.