Jump to: navigation, search

Accept

This operation is part of the Chat API section of the Web Services API.

Overview

When a new chat is offered, an agent can either accept or reject a new chat invitation.

This operation accepts an incoming chat.

Accepting a chat allows an agent to start working on that chat.

After successfully executing this operation, a CometD notification will arrive with complete chat history.

Request URL /api/v2/me/chats/{id}
HTTP Method POST
Required Features api-multimedia

Parameters

Parameter Value
operationName Accept
nickname The agent nickname, as displayed to the customer.
saveLAR Possible values are true or false. If true, information about the agent performing the operation is set in the Contact Profile so that it can be used for last agent routing. (optional)

Sample

HTTP Request

POST on /me/chats/0071023821aec011

{
  "operationName":"Accept",
  "nickname":agent-nickname-to-be-displayed-in-chat
}

HTTP Response

{
  "statusCode": 0
}

For details on the statusCode value, please refer to the All Methods sub-section of the Return Values page.

Notification

Here are the list of notifications received after accepting a chat:

Status changed to Chatting

{
    "messageType": "ChatStateChangeMessage",
    "referenceId": 13,
    "notificationType": "StatusChange",
    "chat": {
        "state": "Chatting",
        "capabilities": [
            "Transfer",
            "Complete",
            "Leave",
            "InFocus",
            "SendMessage",
            "SendStartTypingNotification",
            "SendStopTypingNotification"
        ],
        "id": "0000Na9B26EF002X",
        "uri": "http://localhost:8080/api/v2/chats/0000Na9B26EF002X",
        "participants": []
    }
}

Updated participant list

{
    "messageType": "ChatStateChangeMessage",
    "notificationType": "ParticipantsUpdated",
    "referenceId": 13,
    "chat": {
        "state": "Chatting",
        "capabilities": [
            "Transfer",
            "Complete",
            "Leave",
            "InFocus",
            "SendMessage",
            "SendStartTypingNotification",
            "SendStopTypingNotification"
        ],
        "id": "0000Na9B26EF002X",
        "uri": "http://localhost:8080/api/v2/chats/0000Na9B26EF002X",
        "participants": [
            {
                "type": "Agent",
                "nickname": "Marat",
                "participantId": "009052C5E743004C"
            },
            {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052C5E6D6004A"
            }
        ]
    }
}

Chat history up to the point of joining

{
    "messageType": "MessageLogUpdated",
    "notificationType": "NewMessages",
    "messages": [
        {
            "index": 1,
            "type": "ParticipantJoined",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052C5E6D6004A"
            },
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:18.000-0800"
        },
        {
            "index": 2,
            "type": "ParticipantJoined",
            "from": {
                "type": "Agent",
                "nickname": "Marat",
                "participantId": "009052C5E743004C"
            },
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:18.109-0800"
        },
        {
            "index": 3,
            "type": "ParticipantLeft",
            "from": {
                "type": "Agent",
                "nickname": "Marat",
                "participantId": "009052C5E743004C"
            },
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:19.909-0800"
        },
        {
            "index": 4,
            "type": "TypingStarted",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052C5E6D6004A"
            },
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:20.121-0800"
        },
        {
            "index": 5,
            "type": "Text",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052C5E6D6004A"
            },
            "text": "Hello World",
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:20.126-0800"
        },
        {
            "index": 6,
            "type": "ParticipantJoined",
            "from": {
                "type": "Agent",
                "nickname": "Marat",
                "participantId": "009052C5EF51004D"
            },
            "visibility": "All",
            "timestamp": "2014-01-02T14:23:20.171-0800"
        }
    ],
    "chatUri": "http://localhost:8080/api/v2/chats/0000Na9B26EF002X"
}
This page was last edited on July 8, 2020, at 12:50.
Comments or questions about this documentation? Contact us for support!