Skip to main content
Version: 5.7.0

SysGetRecentChatMessages

tip

This method is available in Cloud Code scripts only.

Returns a list of max \<n> messages from history.

ServiceOperation
chatSYS_GET_RECENT_CHAT_MESSAGES

Method Parameters

ParameterDescription
channelIdThe chat channel to retrieve messages from
maxReturnMaximum number of messages to return

Usage

http://localhost:3000
// Cloud Code only. To view example, switch to the Cloud Code tab
JSON Response
{
"status": 200,
"data": {
"messages": [
{
"date": 1529947494687,
"ver": 1,
"msgId": "783333117279792",
"from": {
"id": "f0bdf734-f5ed-4617-8f40-62795dc82932",
"name": "Paul Winterhalder",
"pic": null
},
"chId": "55555:gl:brainCloudDev",
"content": {
"text": "This is a test"
}
},
{
"date": 1529948166604,
"ver": 1,
"msgId": "783333461301297",
"from": {
"id": "3b87aaa8-b47a-4096-9809-ce0da77ae60d",
"name": "",
"pic": null
},
"chId": "55555:gl:brainCloudDev",
"content": {
"text": "Hello world"
}
}
]
}
}
Common Error Code

Status Codes

CodeNameDescription
40601RTT_NOT_ENABLEDRTT must be enabled for this feature
40603CHAT_UNRECOGNIZED_CHANNELThe specified channel is invalid
40616CLOUD_CODE_ONLYMethod only available via cloud code