SysUpdateChatMessage
tip
This method is available in Cloud Code scripts only.
Update the specified chat message. Message can have been from any user (or system). Version provided must match (or pass -1 to bypass version enforcement).
Service | Operation |
---|---|
chat | SYS_UPDATE_CHAT_MESSAGE |
Method Parameters
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. |
contentJson | Replacement content for the message |
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 chatProxy = bridge.getChatServiceProxy();
var newContent = {};
newContent.text = "This is updated message text";
var updateResult = chatProxy.sysUpdateChatMessage(channelId, oldMsg.id, oldMsg.ver, newContent);
if (updateResult.status == 200) {
// Success!
}
{
"service": "chat",
"operation": "SYS_UPDATE_CHAT_MESSAGE",
"data": {
"channelId": "55555:gl:bcDev",
"msgId": "the-message-id",
"version": 1,
"content": {
"text": "New plain text message",
"custom": {
"somethingNew": "amazing"
}
}
}
}
JSON Response
{
"status": 200,
"data": {}
}
Common Error Code
Status Codes
Code | Name | Description |
---|---|---|
40346 | INSUFFICIDENT_PERMISSIONS | The channel id provided is invalid. |
40595 | CHAT_MESSASAGE_NOT_FOUND | The specified message cannot be found |
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 |