Skip to main content

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
tip

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 RCDefault subchannel. 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:

ParameterTypeRequiredDescription
channelIdStringYesThe community channel ID. Must already exist.
subchannelIdStringYesThe subchannel ID.
startAtNumberYesQuery start time. Unix timestamp in milliseconds.
endAtNumberYesQuery end time. Unix timestamp in milliseconds. Must be greater than startAt, with a maximum span of 14 days.
fromUserIdStringNoSender user ID. Omit to query messages from all users. If provided, only messages from this user are returned.
pageSizeNumberNoPage size. Defaults to 20. Maximum 100.

Request example

HTTP
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:

FieldTypeDescription
codeNumberStatus code. 0 indicates success. See status codes.
resultObjectThe result object.
result.messagesArray of objectsList of messages, sorted by timestamp in ascending order.
result.messages[i].channelIdStringThe community channel ID.
result.messages[i].subchannelIdStringThe subchannel ID.
result.messages[i].fromUserIdStringThe sender's user ID.
result.messages[i].messageUIDStringThe message UID.
result.messages[i].sentAtNumberMessage sent time. Unix timestamp in milliseconds.
result.messages[i].messageTypeStringMessage type. See Message type overview.
result.messages[i].channelTypeNumberChannel type. Community channel type is 10.
result.messages[i].contentStringMessage content in JSON format. Structure depends on messageType. See Message type overview.
result.messages[i].hasMetadataBooleanWhether the message is metadata-enabled. true = metadata-enabled, false = not metadata-enabled.
result.messages[i].metadataStringMessage 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
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": ""
}
]
}
}