Get a UserChat's messages

Retrieve a list of message of UserChat with ID.

Parameter

Accessible via URL https://api.channel.io/open/v5/user-chats/{userChatId}/messages and HTTP GET

📘

This method does currently accept application/json only.

ParameterExampleRequiredDescriptionParameter type
userChatId5e65fa8bc2409f0c1fd3RequiredID of UserChatPath
sinceeyJjaGF0S2V5IjoiZ3Jvn0=OptionalEncoded key of the first message to be retrievedQeury
limit25OptionalRestrict the maximum number of messages to be retrievedQuery
sortOrderdesc(or asc)RequiredOrder messages should be listed (descending order means latest message first)Query

Example

GET https://api.channel.io/open/v5/user-chats/5e65fa8bc2409f0c1fd3/messages?limit=10

Response

Returns messages along with related information.

{
  "prev": "string",
  "next": "string",
  "messages": [
    {
      "chatKey": "string",
      "id": "string",
      "mainKey": "string",
      "threadKey": "string",
      "root": true,
      "channelId": "string",
      "chatType": "string",
      "chatId": "string",
      "personType": "string",
      "personId": "string",
      "requestId": "string",
      "language": "string",
      "createdAt": 1656032152433,
      "version": 0,
      "blocks": [
        {
          "type": "bullets",
          "language": "string",
          "value": "string",
          "blocks": [
            null
          ]
        }
      ],
      "plainText": "string",
      "updatedAt": 1656032152427,
      "buttons": [
        {
          "title": "string",
          "colorVariant": "cobalt",
          "url": "string"
        }
      ],
      "files": [
        {
          "id": "string",
          "type": "string",
          "name": "string",
          "size": 0,
          "contentType": "string",
          "duration": 0,
          "width": 0,
          "height": 0,
          "orientation": 0,
          "animated": true,
          "bucket": "string",
          "key": "string",
          "previewKey": "string",
          "channelId": "string",
          "chatType": "string",
          "chatId": "string"
        }
      ],
      "webPage": {
        "id": "string",
        "url": "string",
        "title": "string",
        "description": "string",
        "imageUrl": "string",
        "videoUrl": "string",
        "publisher": "string",
        "author": "string",
        "width": 0,
        "height": 0,
        "bucket": "string",
        "previewKey": "string",
        "logo": "string",
        "name": "string"
      },
      "log": {
        "action": "changeName",
        "values": [
          "string"
        ],
        "triggerType": "string",
        "triggerId": "string"
      },
      "reactions": [
        {
          "emojiName": "string",
          "personKeys": [
            "string"
          ]
        }
      ],
      "form": {
        "inputs": [
          {
            "value": {},
            "readOnly": true,
            "type": "text",
            "label": "string",
            "dataType": "string",
            "bindingKey": "string"
          }
        ],
        "submittedAt": 1656032153409,
        "type": "string"
      },
      "state": "sending",
      "options": [
        "actAsManager"
      ],
      "marketing": {
        "type": "string",
        "id": "string",
        "advertising": true,
        "sendToOfflineXms": true,
        "sendToOfflineEmail": true,
        "exposureType": "fullScreen"
      },
      "supportBot": {
        "id": "string",
        "revisionId": "string",
        "sectionId": "string",
        "stepIndex": 0,
        "buttons": [
          {
            "text": "string",
            "nextSectionId": "string"
          }
        ],
        "submitButtonIndex": 0
      },
      "action": {
        "type": "select",
        "buttons": [
          {
            "key": "string",
            "text": "string"
          }
        ]
      },
      "submit": {
        "id": "string",
        "key": "string"
      },
      "threadMsg": true,
      "broadcastedMsg": true,
      "rootMessageId": "string"
    }
  ],
  "bots": [
    {
      "id": "string",
      "channelId": "string",
      "name": "string",
      "description": "string",
      "nameDescI18nMap": {
        "additionalProp1": {
          "name": "string",
          "description": "string"
        },
        "additionalProp2": {
          "name": "string",
          "description": "string"
        },
        "additionalProp3": {
          "name": "string",
          "description": "string"
        }
      },
      "createdAt": 1656032151723,
      "avatar": {
        "bucket": "string",
        "key": "string",
        "width": 0,
        "height": 0
      },
      "color": "string",
      "avatarUrl": "string"
    }
  ],
  "users": [
    {
      "id": "string",
      "channelId": "string",
      "memberId": "string",
      "veilId": "string",
      "unifiedId": "string",
      "type": "member",
      "name": "string",
      "mobileNumberQualified": true,
      "emailQualified": true,
      "profile": {
        "name": "string",
        "empty": true,
        "email": "string",
        "avatarUrl": "string",
        "mobileNumber": "string",
        "additionalProp1": {},
        "additionalProp2": {},
        "additionalProp3": {}
      },
      "profileOnce": {
        "name": "string",
        "empty": true,
        "email": "string",
        "avatarUrl": "string",
        "mobileNumber": "string",
        "additionalProp1": {},
        "additionalProp2": {},
        "additionalProp3": {}
      },
      "tags": [
        "string"
      ],
      "alert": 0,
      "unread": 0,
      "popUpChatId": "string",
      "blocked": true,
      "unsubscribeEmail": true,
      "unsubscribeTexting": true,
      "hasChat": true,
      "hasPushToken": true,
      "language": "string",
      "country": "string",
      "city": "string",
      "latitude": 0,
      "longitude": 0,
      "web": {
        "device": "string",
        "os": "string",
        "osName": "string",
        "browser": "string",
        "browserName": "string",
        "sessionsCount": 0,
        "lastSeenAt": 1656032153127
      },
      "mobile": {
        "device": "string",
        "os": "string",
        "osName": "string",
        "appName": "string",
        "appVersion": "string",
        "sessionsCount": 0,
        "lastSeenAt": 1656032153127
      },
      "sessionsCount": 0,
      "lastSeenAt": 1656032153129,
      "createdAt": 1656032153129,
      "updatedAt": 1656032153129,
      "version": 0,
      "managedKey": 0,
      "member": true,
      "email": "string",
      "avatarUrl": "string",
      "mobileNumber": "string",
      "systemLanguage": "string"
    }
  ],
  "supportBots": [
    {
      "id": "string",
      "channelId": "string",
      "botName": "string",
      "name": "string",
      "order": 0,
      "pageQuery": {
        "key": "string",
        "type": "boolean",
        "operator": {},
        "values": [
          {}
        ],
        "and": [
          null
        ],
        "or": [
          null
        ]
      },
      "userQuery": {
        "key": "string",
        "type": "boolean",
        "operator": {},
        "values": [
          {}
        ],
        "and": [
          null
        ],
        "or": [
          null
        ]
      },
      "draft": {
        "supportBot": {},
        "sections": [
          {
            "name": "string",
            "actions": [
              {
                "type": "string"
              }
            ],
            "id": "string",
            "steps": [
              {
                "message": {
                  "blocks": [
                    {
                      "type": "bullets",
                      "language": "string",
                      "value": "string",
                      "blocks": [
                        null
                      ]
                    }
                  ],
                  "buttons": [
                    {
                      "title": "string",
                      "colorVariant": "cobalt",
                      "url": "string"
                    }
                  ],
                  "files": [
                    {
                      "id": "string",
                      "type": "string",
                      "name": "string",
                      "size": 0,
                      "contentType": "string",
                      "duration": 0,
                      "width": 0,
                      "height": 0,
                      "orientation": 0,
                      "animated": true,
                      "bucket": "string",
                      "key": "string",
                      "previewKey": "string",
                      "channelId": "string",
                      "chatType": "string",
                      "chatId": "string"
                    }
                  ],
                  "webPage": {
                    "id": "string",
                    "url": "string",
                    "title": "string",
                    "description": "string",
                    "imageUrl": "string",
                    "videoUrl": "string",
                    "publisher": "string",
                    "author": "string",
                    "width": 0,
                    "height": 0,
                    "bucket": "string",
                    "previewKey": "string",
                    "logo": "string",
                    "name": "string"
                  },
                  "form": {
                    "inputs": [
                      {
                        "value": {},
                        "readOnly": true,
                        "type": "text",
                        "label": "string",
                        "dataType": "string",
                        "bindingKey": "string"
                      }
                    ],
                    "submittedAt": 1656032153409,
                    "type": "string"
                  }
                }
              }
            ],
            "type": "string"
          }
        ]
      },
      "revisionId": "string",
      "state": "draft",
      "runMode": "always",
      "start": 0,
      "stop": 0,
      "chatOpen": 0,
      "createdAt": 1656032152405,
      "updatedAt": 1656032152405,
      "userChatExpireDuration": {
        "seconds": 0,
        "nano": 0,
        "negative": true,
        "zero": true,
        "units": [
          {
            "dateBased": true,
            "timeBased": true,
            "duration": {
              "seconds": 0,
              "nano": 0,
              "negative": true,
              "zero": true
            },
            "durationEstimated": true
          }
        ]
      },
      "managerId": "string"
    }
  ],
  "automationRules": [
    {
      "id": "string",
      "channelId": "string",
      "name": "string",
      "run": true,
      "rank": 0,
      "executionCount": 0,
      "triggers": [
        {
          "type": "string"
        }
      ],
      "filter": {
        "key": "string",
        "type": "boolean",
        "operator": {},
        "values": [
          {}
        ],
        "and": [
          null
        ],
        "or": [
          null
        ]
      },
      "staticActions": [
        {
          "type": "string"
        }
      ],
      "stateAction": {
        "type": "string"
      },
      "createdAt": 1656032151775,
      "updatedAt": 1656032151723
    }
  ]
}

Implementation Notes

The number of messages retrieved in this endpoint is restricted by the limit query parameter, and is capped to values in the closed interval [1, 500].

Pagination is supported through the since query parameter along with the next value contained in the root object of the JSON response. Successive queries to this endpoint using the previous next value as the since parameter will ultimately retrieve all messages in the chat.

If the since parameter is left empty, the list retrieved will start with the first message (as specified by the order parameter).