Search community channel messages
Nexconn stores up to 7 days of message history across all community channel subchannels by default. Use this API to retrieve subchannel messages within a specified time range. You can optionally filter by sender user ID.
This API is typically used by community channel operators for back-office message search. It supports:
- Querying messages in a community channel subchannel within a time range
- Filtering messages sent by a specific user
Nexconn also provides a real-time message routing service that forwards message copies to your designated app server. For setup details, see Message routing.
Query scope
- Time range: The maximum time span per query is 14 days. After activating community channel service, cloud message storage defaults to 7 days. Extended storage (3 months, 6 months, or 1 year) is available as a paid option. See Activating community channel service for details.
- Subchannel type: The API supports querying messages from both public and private subchannels. Public subchannels include custom subchannels and the default
RCDefaultsubchannel. The API does not restrict queries to private subchannel messages — your app backend may need to distinguish subchannel types independently. See Private subchannel overview for more details.
Request method
POST: https://Base URL/v4/community-channel/history-message/list
Rate limit: 100 requests per minute
Signature required: All server API requests require signature verification. See API request signature.
Request body
The request body is in application/json format and contains a JSON object with the following structure:
| Parameter | Type | Required | Description |
|---|---|---|---|
channelId | String | Yes | The community channel ID. Must already exist. |
subchannelId | String | Yes | The subchannel ID. |
startAt | Number | Yes | Query start time. Unix timestamp in milliseconds. |
endAt | Number | Yes | Query end time. Unix timestamp in milliseconds. Must be greater than startAt, with a maximum span of 14 days. |
fromUserId | String | No | Sender user ID. Omit to query messages from all users. If provided, only messages from this user are returned. |
pageSize | Number | No | Page size. Defaults to 20. Maximum 100. |
Request example
POST /v4/community-channel/history-message/list HTTP/1.1
Host: api.sg-light-api.com
App-Key: uwd1c0sxdlx2
Nonce: 14314
Timestamp: 1408710653491
Signature: 45beb7cc7307889a8e711219a47b7cf6a5b000e8
Content-Type: application/json
{
"channelId": "wxlGroup",
"subchannelId": "wxlBusChannel",
"startAt": 1666251303434,
"endAt": 1666251311996,
"fromUserId": "123",
"pageSize": 10
}
Response
The response body contains a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
code | Number | Status code. 0 indicates success. See status codes. |
result | Object | The result object. |
result.messages | Array of objects | List of messages, sorted by timestamp in ascending order. |
result.messages[i].channelId | String | The community channel ID. |
result.messages[i].subchannelId | String | The subchannel ID. |
result.messages[i].fromUserId | String | The sender's user ID. |
result.messages[i].messageUID | String | The message UID. |
result.messages[i].sentAt | Number | Message sent time. Unix timestamp in milliseconds. |
result.messages[i].messageType | String | Message type. See Message type overview. |
result.messages[i].channelType | Number | Channel type. Community channel type is 10. |
result.messages[i].content | String | Message content in JSON format. Structure depends on messageType. See Message type overview. |
result.messages[i].hasMetadata | Boolean | Whether the message is metadata-enabled. true = metadata-enabled, false = not metadata-enabled. |
result.messages[i].metadata | String | Message metadata content as a JSON key-value string, e.g., "{\"key1\":{\"v\":\"value\",\"ts\":110908544521}}". Key: max 32 characters, supports letters, numbers, and + = - _. Value: max 4096 characters. |
Response example
HTTP/1.1 200 OK
Content-Type: application/json; charset=utf-8
{
"code": 0,
"result": {
"messages": [
{
"channelId": "wxlGroup",
"subchannelId": "wxlBusChannel",
"fromUserId": "123",
"messageUID": "C3UH-8KMU-O038-22SK",
"sentAt": 1666251311995,
"messageType": "RC:TxtMsg",
"channelType": 10,
"content": "{\"content\":\"abce\"}",
"hasMetadata": false,
"metadata": ""
},
{
"channelId": "wxlGroup",
"subchannelId": "wxlBusChannel",
"fromUserId": "123",
"messageUID": "C3UH-8IK2-G018-22SK",
"sentAt": 1666251303434,
"messageType": "RC:TxtMsg",
"channelType": 10,
"content": "{\"content\":\"abc\"}",
"hasMetadata": false,
"metadata": ""
}
]
}
}