Skip to main content
Version: 5.7.0

DeleteChatMessage

Delete the specified chat message. Message must have been from this user. 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 delete attempt - in that case, the value of the deleted field will be 0.

ServiceOperation
chatDELETE_CHAT_MESSAGE

Method Parameters

ParameterDescription
channelIdThe channel of the message
msgIdThe message id
versionThe version of the message. Pass it -1 to bypass version checking.

Usage

http://localhost:3000


string channelId = "22817:gl:CHAT_TRADE"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
string msgId = "784130333859899";
int version = -1;
SuccessCallback successCallback = (response, cbObject) =>
{
var jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];
string deleted = jsonData["deleted"].ToString();

string logMessage = string.Join(" | ", new [] {deleted});
Debug.Log(logMessage); // 1
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[DeleteChatMessage Failed] {0} {1} {2}", status, code, error));
};

_bc.ChatService.DeleteChatMessage(channelId, msgId, version, successCallback, failureCallback);
JSON Response
{
"status": 200,
"data": {
"deleted": 1
}
}
Common Error Code

Status Codes

CodeNameDescription
40346CHAT_INVALID_CHANNEL_IDThe channel id provided is invalid.
40601RTT_NOT_ENABLEDRTT must be enabled for this feature