SysGetChatMessage
tip
This method is available in Cloud Code scripts only.
Retrieves a chat message object from history. If the message cannot be found, that data
section returned will be empty.
Service | Operation |
---|---|
chat | SYS_GET_CHAT_MESSAGE |
Method Parameters
Parameter | Description |
---|---|
channelId | The channel of the message |
msgId | The message id |
Usage
http://localhost:3000
- C#
- C++
- Objective-C
- Java
- JavaScript
- Dart
- Cloud Code
- Raw
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
// Cloud Code only. To view example, switch to the Cloud Code tab
var channelId = "55555:gl:bcDev";
var msgId = "123456789";
var chatProxy = bridge.getChatServiceProxy();
var postResult = chatProxy.sysGetChatMessage(channelId, msgId);
if (postResult.status == 200) {
// Success!
}
{
"service": "chat",
"operation": "SYS_GET_CHAT_MESSAGE",
"data": {
"channelId": "55555:gl:bcDev",
"msgId": "the-message-id"
}
}
JSON Response
{
"status": 200,
"data": {
"date": 1529978814276,
"ver": 1,
"msgId": "783349152909363",
"from": {
"id": "004a7d0c-4e96-474b-972b-7794e0eec8d5",
"name": "",
"pic": null
},
"chId": "22682:gl:brainCloudDev",
"content": {
"text": "Hello world",
"rich": {
"somethingCustom": "wow"
}
}
}
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |
40603 | CHAT_UNRECOGNIZED_CHANNEL | The specified channel is invalid |
40616 | CLOUD_CODE_ONLY | Method only available via cloud code |