Jump to: navigation, search

Chat Resource

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

Overview

The chat resource includes properties that describe the current state of the chat and the available operations given the current state. A full description of the properties included on the chat resource and their possible values can be found here.


Request URL /api/v2/me/chats?fields=*
HTTP Method GET
Required Features api-multimedia-chat

Sample Data

Request

GET /api/v2/me/chats?fields=*

CometD Notification

{
            "state": "Chatting",
            "id": "0000Na9B26EF002G",
            "uri": "http://localhost:8080/api/v2/chats/0000Na9B26EF002G",
            "participants": [
                {
                    "type": "Agent",
                    "nickname": "Agent1",
                    "participantId": "009052BDEE4A003E"
                },
                {
                    "type": "Customer",
                    "nickname": "PersonP",
                    "participantId": "009052BDEE39003C"
                }
            ],
           "capabilities": [
              "AttachUserData",
              "UpdateUserData",
              "DeleteUserData",
              "Leave",
              "LeaveAndComplete",
              "Transfer",
              "Invite",
              "Consult"
           ],
          "userData": {
          }
 
}

Messages

You can also receive messages for a particular chat.

Request URL /api/v2/me/chats/{chatId}/messages
HTTP Method GET
Required Features api-multimedia-chat

Optional URL parameters are startIndex and count.

Message Types

Type Description
Text Message text is placed into the text field.
ParticipantJoined A participant joined the chat. The participant's information is placed into the from field.
ParticipantLeft The participant left the chat. The participant's information is placed into the from field.
ParticipantRejoined The participant rejoined the chat. The participant's information is placed into the from field.
TypingStarted The participant started typing. If typing preview is enabled, the message text is placed into the text field.
TypingStopped The participant stopped typing.
PushUrl The participant sent a URL. The URL is placed into the url field.
Notice The notice text is placed into the text field (optional).
TranscriptSaveDone The service message type. The index field always equals -1.

Sample Data

Request

GET /api/v2/me/chats/009052BDEE39003A/messages?startIndex=1&count=10

CometD Notification

{
"messages": [
        {
            "index": 1,
            "type": "ParticipantJoined",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052BDEE39003C"
            },
            "visibility": "All",
            "timestamp": "2013-12-27T13:16:41.000-0800"
        },
        {
            "index": 2,
            "type": "ParticipantJoined",
            "from": {
                "type": "Agent",
                "nickname": "Agent1",
                "participantId": "009052BDEE4A003E"
            },
            "visibility": "All",
            "timestamp": "2013-12-27T13:16:41.018-0800"
        },
        {
            "index": 3,
            "type": "TypingStarted",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052BDEE39003C"
            },
            "visibility": "All",
            "timestamp": "2013-12-27T13:16:41.186-0800"
        },
        {
            "index": 4,
            "type": "Text",
            "from": {
                "type": "Customer",
                "nickname": "PersonP",
                "participantId": "009052BDEE39003C"
            },
            "text": "dddd",
            "visibility": "All",
            "timestamp": "2013-12-27T13:16:41.187-0800"
        }
    ]
}

Feedback

Comment on this article:

blog comments powered by Disqus
This page was last modified on January 22, 2016, at 11:56.