Get messages in a Group
GET messages via groupId
Retrieve a list of messages in a Group
by groupId
Parameter
Accessible via URL https://api.channel.io/open/v5/groups/{groupId}/messages
and HTTP GET
This method accepts
application/json
Parameter | Example | Required | Description | Parameter Type |
---|---|---|---|---|
groupId | 1234 | Required | Id of Group | Path |
since | 1401231818 | Optional | Unix timestamp value of the first message to be retrieved | Query |
limit | 25 | Optional | Restrict the maximum number of results - min : 1 - max : 500 - default : 25 | Query |
sortOrder | desc | Required | Order of messages (descending order means latest message first) - Available values : asc, desc, both - Default value : desc | Query |
Example
GET https://api.channel.io/open/v5/groups/1234/messages?since=1401231818&limit=25&sortOrder=asc
GET messages via groupName
Retrieve a list of messages in a Group
by groupName
Parameter
Accessible via URL https://api.channel.io/open/v5/groups/@{groupName}/messages
and HTTP GET
This method accepts
application/json
Parameter | Example | Required | Description | Parameter Type |
---|---|---|---|---|
groupName | justGroup | Required | Name of Group | Path |
since | 1401231818 | Optional | Unix timestamp value of the first message to be retrieved | Query |
limit | 25 | Optional | Restrict the maximum number of results (range[1, 500]) Default value : 25 | Query |
sortOrder | desc | Required | Order of messages (descending order means latest message first) Available values : asc, desc, both Default value : desc | Query |
Example
GET https://api.channel.io/open/v5/groups/@justGroup/messages?since=1401231818&limit=25&sortOrder=asc
Response
Response
Returns messages within a group 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"
}
]
}
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).
Updated about 1 year ago