Skip to main content
Version: 5.7.0

PostChatMessageSimple

Sends a text-only member chat message on behalf of the user. This method provides convenience by simplifying message construction. Returns the id of the message that was created.

ServiceOperation
chatPOST_CHAT_MESSAGE_SIMPLE

Method Parameters

ParameterDescription
channelIdThe chat channel to post to
chatMessageSimple string content for the message. Will be placed inside of a text field of the content section.
recordInHistorySet to false if the message shouldn't be recorded to history. Useful for sending non-conversational messages, like when users join a room, etc.

Usage

http://localhost:3000


string channelId = "22817:gl:CHAT_GROUPFINDER"; // APP_ID:CHANNEL_TYPE:CHANNEL_ID
string chatMessage = "Hey, I am looking for new and experienced users to join our group.";
bool recordInHistory = true;
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 msgId = jsonData["msgId"].ToString();
string logMessage = string.Join(" | ", new [] {msgId});
Debug.Log(logMessage); // 783733181125648
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("[PostChatMessageSimple Failed] {0} {1} {2}", status, code, error));
};
_bc.ChatService.PostChatMessageSimple(channelId, chatMessage, true, successCallback,
failureCallback);
JSON Response
{
"status": 200,
"data": {
"msgId": "783822917533185"
}
}
Common Error Code

Status Codes

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