0

I'm working on a POC using the Salesforce CHAT API and I already have this process:

  1. Create a chat session (Live Agent is able to start the conversation)

  2. Pull and push messages into the chat

But so far from the documentation I'm not able to monitor if an specific session Id has already finished (Maybe live agent finished the conversation). I saw this endpoint https://hostname/chat/rest/Chasitor/ChatEnd but basically only allows to finish the conversation from the client.

Wondering if someone has solved a similar solution.

Thanks in advance

1 Answer 1

1

Seems I found a solution for this. There's no an specific API call we need to use in order to monitor the session, but the /chat/rest/System/Messages endpoint basically is our point of check. In this case if a message is posted from the agent the message will look like this:

{
    "messages":
    [
        {
            "message":
            {
                "chasitorIdleTimeout":
                {
                    "isEnabled": false
                },
                "items":
                [],
                "name": "C",
                "sneakPeekEnabled": true,
                "userId": "0056S00000HgI51"
            },
            "type": "ChatEstablished"
        },
        {
            "message":
            {
                "agentId": "0056S00000HgI51",
                "name": "C",
                "schedule":
                {
                    "responseDelayMilliseconds": 0.0
                },
                "text": "Hi message here."
            },
            "type": "ChatMessage"
        }
    ],
    "offset": 110410469,
    "sequence": 2
}

And for example if the conversation is terminated by the agent then we should see a response like this one:

{
    "messages":
    [
        {
            "message":
            {
                "attachedRecords":
                [],
                "reason": "agent"
            },
            "type": "ChatEnded"
        }
    ],
    "offset": 110425621,
    "sequence": 4
}

So the way to keep track if a conversation remains active is using the Type field along with the sequence.

Hope this helps.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .