Get a list of User's UserChats

Retrieve UserChat of a particular User.

Parameter

Accessible via URL https://api.channel.io/open/v3/users/{userId}/user-chats and HTTP GET

📘

Present parameters in query string

Parameter

Example

Required

Description

Parameter type

userId

12345

Required

ID of User

Path

sortOrder

desc (or asc)

Optional

Sorting order. Default value is desc. (descending order means latest message first)

Query

states

open (or following, holding)

Optional

user chat state filter

Query

sortField

updatedAt (or createdAt, openedAt)

Optional

Sort criteria. Default value is updatedAt.

Query

since

500000

Optional

Epoch time in microseconds of the first message to be retrieved.
If the since parameter is left empty, the list retrieved will start with the first message (as specified by the order parameter).

Query

limit

40

Optional

Restrict the maximum number of direct chats to be retrieved. It should be between 1 to 100. Default value is 25.

Query

Example

GET https://api.channel.io/open/v3/users/12345/user-chats?states=open&sortField=updatedAt&sortOrder=desc&since=500000&limit=40

Response

Returns a set of UserChat along with related information

{
  "messages": [
    {
      "chatKey": "String",
      "id": "String",
      "channelId": "String",
      "chatType": "userChat",
      "chatId": "String",
      "personType": "user",
      "personId": "String",
      "requestId": "String",
      "createdAt": 1584673669359,
      "version": 1,
      "blocks": [
        {
          "type": "text",
          "value": "String"
        }
      ],
      "plainText": "String"
    }
  ],
  "sessions": [
    {
      "key": "String",
      "chatId": "String",
      "chatKey": "String",
      "updatedKey": "String",
      "channelId": "String",
      "alert": 0,
      "unread": 0,
      "readAt": 1584934318715,
      "receivedAt": 1584934318715,
      "updatedAt": 1584934318715,
      "createdAt": 1584673662845,
      "version": 15,
      "personType": "user",
      "personId": "String",
      "chatType": "userChat",
      "bookmark": false,
      "id": "String"
    }
  ],
  "userChats": [
    {
      "id": "String",
      "channelId": "String",
      "stateKey": "String",
      "userId": "String",
      "name": "String",
      "state": "closed",
      "pluginId": "String",
      "sourceUrl": "String",
      "sourceType": "String",
      "sourceId": "String",
      "firstOpenedAt": 1584673669359,
      "openedAt": 1584673669359,
      "createdAt": 1584673662833,
      "frontMessageId": "5e782db094700b408e74",
      "frontUpdatedAt": 1584934320608,
      "deskMessageId": "5e74338557a5882a7545",
      "deskUpdatedAt": 1584934320608,
      "oneStop": false,
      "askedAt": 1584673663000,
      "closedAt": 1584934318617,
      "version": 14
    },
   ]
  "users": [
    {
      "id": "String",
      "channelId": "10",
      "memberId": "String",
      "veilId": "String",
      "name": "String",
      "alert": 8,
      "unread": 8,
      "blocked": false,
      "unsubscribed": false,
      "hasChat": true,
      "hasPushToken": false,
      "language": "en",
      "country": "KR",
      "city": "Seoul",
      "latitude": 37.4954,
      "longitude": 127.0621,
      "sessionsCount": 5,
      "lastSeenAt": 1584673657636,
      "createdAt": 1584145649408,
      "updatedAt": 1584934318716,
      "version": 8,
      "member": false,
      "contact": false,
      "avatarUrl": "String",
      "systemLanguage": "String"
    }
  ],
  "categories": [
  ]
}