SysDeleteChatMessage
tip
This method is available in Cloud Code scripts only.
Delete the specified chat message. Message can be from any user (or the system). Version must match (or pass -1 to bypass version enforcement).
Returns the number of messages that were deleted. Since the history rolls over, it is possible that the message had already expired before the deletion attempt - in that case, the value of the deleted
field will be 0
.
Service | Operation |
---|---|
chat | SYS_DELETE_CHAT_MESSAGE |
Method Parameters
Parameter | Description |
---|---|
channelId | The channel of the message |
msgId | The message id |
version | The version of the message. Pass it -1 to bypass version checking. |
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 version = 1;
var chatProxy = bridge.getChatServiceProxy();
var postResult = chatProxy.sysDeleteChatMessage(channelId, msgId, version);
if (postResult.status == 200) {
// Success!
}
{
"service": "chat",
"operation": "SYS_DELETE_CHAT_MESSAGE",
"data": {
"channelId": "55555:gl:bcDev",
"msgId": "the-message-id",
"version": 1
}
}
JSON Response
{
"status": 200,
"data": {
"deleted": 1
}
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40346 | CHAT_INVALID_CHANNEL_ID | The channel id provided is invalid. |
40601 | RTT_NOT_ENABLED | RTT must be enabled for this feature |
40616 | CLOUD_CODE_ONLY | Method only available via cloud code |