Please note that this SDK relates to LivePersons legacy chat product which receives limited support and will be deprecated in the future.

It is recommended to build future integrations on top of the corresponding messaging SDK instead.

Method to notify the agent that the visitor has ended the chat. The method publishes the new state as the response.

Request

Properties

Value Description Type Required
disposeVisitor If set to true will not retrieve this session's data on refresh. Boolean Optional

Note: This will also cause the onStop event to be triggered from the server.

Sample code

var failedRequest = myChat.endChat({
    success: myChat.chatEnded,
    error: myChat.chatEndFailed,
    context: myChat,
    disposeVisitor: true
});

if (failedRequest && failedRequest.error) {
    alert(failedRequest.error);
}

Response

Sample response

{"state":"ended","time":"20:37:44 GMT+0300 (Jerusalem Daylight Time)"}