Skip to main content
Version: 5.7.0

GetChatMessage

Retrieves a chat message object from history. If the message cannot be found, that data section returned will be empty.

ServiceOperation
chatGET_CHAT_MESSAGE

Usage

http://localhost:3000


string channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
string msgId = "783820066133040";
SuccessCallback successCallback = (response, cbObject) =>
{
Dictionary<string, object> jsonMessage = (Dictionary<string, object>)JsonFx.Json.JsonReader.Deserialize(response);
Dictionary<string, object> jsonData = (Dictionary<string, object>)jsonMessage["data"];

var date = jsonData["date"].ToString();
var name = ((Dictionary<string, object>)jsonData["from"])["name"].ToString();
var text = ((Dictionary<string, object>)jsonData["content"])["text"].ToString();
string logMessage = string.Join(" | ", new [] {date, name, text});
Debug.Log(logMessage); // 1530898566666 | RedBomber | Anyone looking for a group?
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[GetChatMessage Failed] {0} {1} {2}", status, code, error));
};
_bc.ChatService.GetChatMessage(channelId, msgId, successCallback, failureCallback);
JSON Response
{
"data": {
"date": 1530898566666,
"ver": 1,
"msgId": "783820066133040",
"from": {
"id": "a7b7de02-8432-4547-8c40-9af94537fce0",
"name": "RedBomber",
"pic": null
},
"chId": "22817:gl:CHAT_TRADE",
"content": {
"text": "Anyone looking for a group?"
}
},
"status": 200
}
Common Error Code

Status Codes

CodeNameDescription
40601RTT_NOT_ENABLEDRTT must be enabled for this feature
40603CHAT_UNRECOGNIZED_CHANNELThe specified channel is invalid

Method Parameters

ParameterDescription
channelIdThe channel of the message
msgIdThe message id