Skip to main content
Version: 5.11.8

GetSentMessageList

public BackendReturnObject GetSentMessageList();

Description

Looks up the list of messages sent to users.
The list shares a common value with the list of received messages(GetReceivedMessageList).(distinguished by message recipient/sender information) You can keep as many messages as the maximum number set in BACKND Console > Social Management > Settings > Messages, and if you sent a message while the list is full, the oldest message is deleted and the newest message is added to the list.

Example

Synchronous

Backend.Message.GetSentMessageList();

Asynchronous

Backend.Message.GetSentMessageList((callback) => 
{
// Post-process
});

SendQueue

SendQueue.Enqueue(Backend.Message.GetSentMessageList, (callback) => 
{
// Post-process
});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

GetReturnValuetoJSON

It shares a common value with the method that looks up the list of received messages(GetReceivedMessageList) and must be distinguished through the recipient and the sender.

{ 
rows:
[
{
receiver: // Message recipient's inDate
{ S : "2018-12-18T01:58:18.722Z" },
sender: // Message sender's inDate
{ S : "2018-12-27T00:21:31.322Z" },
content: // Message content
{ S : "hello this is user7. How are you doing?" },
inDate: // Message's inDate
{ S : "2018-12-27T00:26:22.083Z" },
senderNickname: // Message sender's nickname
{ S : "user7" },
isRead: // Determines whether the recipient has read the message
{ BOOL : false },
receiverNickname: // Message recipient's nickname
{ S : "ryan" },
isReceiverDelete: // Whether the message recipient has deleted the message
{ BOOL : false },
isSenderDelete: // Whether the message sender has deleted the message
{ BOOL : false }
},
{
receiver: [Object],
sender: [Object],
content: [Object],
inDate: [Object],
senderNickname: [Object],
isRead: [Object],
receiverNickname: [Object],
isReceiverDelete: [Object],
isSenderDelete: [Object]
}
]
}

Sample code

public class MessageItem
{
public string receiver;
public string sender;
public string content;
public string inDate;
public string senderNickname;
public bool isRead;
public string receiverNickname;
public bool isReceiverDelete;
public bool isSenderDelete;

public override string ToString()
{
return $"receiver : {receiver}\n" +
$"sender : {sender}\n" +
$"content : {content}\n" +
$"inDate : {inDate}\n" +
$"senderNickname : {senderNickname}\n" +
$"isRead : {isRead}\n" +
$"receiverNickname : {receiverNickname}\n" +
$"isReceiverDelete : {isReceiverDelete}\n" +
$"isSenderDelete : {isSenderDelete}\n";
}
};
public void GetSentMessageListTest()
{
var bro = Backend.Message.GetSentMessageList();

if(!bro.IsSuccess())
return;

LitJson.JsonData json = bro.FlattenRows();

List<MessageItem> messageList = new List<MessageItem>();

for(int i = 0; i < json.Count; i++)
{
<!-- MessageItem messageItem = new MessageItem(); -->

<!-- messageItem.receiver = json[i]["receiver"].ToString(); -->
<!-- messageItem.sender = json[i]["sender"].ToString(); -->
<!-- messageItem.content = json[i]["content"].ToString(); -->
<!-- messageItem.inDate = json[i]["inDate"].ToString(); -->
<!-- messageItem.senderNickname = json[i]["senderNickname"].ToString(); -->
<!-- messageItem.isRead = json[i]["isRead"].ToString() == "true" ? true : false; -->
<!-- messageItem.receiverNickname = json[i]["receiverNickname"].ToString(); -->
<!-- messageItem.isReceiverDelete = json[i]["isReceiverDelete"].ToString() == "true" ? true : false; -->
<!-- messageItem.isSenderDelete = json[i]["isSenderDelete"].ToString() == "true" ? true : false; -->

<!-- messageList.Add(messageItem); -->
Debug.Log(messageItem.ToString());
}
}

GetSentMessage

public BackendReturnObject GetSentMessage(string messageIndate);

Parameter

ValueTypeDescription
messageIndatestringindate of the sent message to read

Description

Retrieves information of one sent message.

Example

Synchronous

// Get the inDate of the message to read.  
BackendReturnObject bro = Backend.Message.GetSentMessageList();
string messageIndate = bro.Rows()[0]["inDate"]["S"].ToString();

//Reads the content of the message to read.
BackendReturnObject bro2 = Backend.Message.GetSentMessage(messageIndate);
string content = bro2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();

Asynchronous

// Get the inDate of the message to read.  
Backend.Message.GetSentMessageList(callback =>
{
string messageIndate = callback.Rows()[0]["inDate"]["S"].ToString();

//Reads the content of the message to read.
Backend.Message.GetSentMessage(messageIndate, callback2 =>
{
string content = callback2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();
});

});

SendQueue

// Get the inDate of the message to read.  
SendQueue.Enqueue(Backend.Message.GetSentMessageList, callback =>
{
string messageIndate = callback.Rows()[0]["inDate"]["S"].ToString();

//Reads the content of the message to read.
SendQueue.Enqueue(Backend.Message.GetSentMessage, messageIndate, callback2 =>
{
string content = callback2.GetReturnValuetoJSON()["row"]["content"]["S"].ToString();
});

});

Return cases

Success cases

When the lookup is successful
statusCode : 200

returnValue : refer to GetReturnValuetoJSON

GetReturnValuetoJSON

{ 
row:
{
receiver: // Message recipient's inDate
{ S : "2018-12-18T01:58:18.722Z" },
sender: // Message sender's inDate
{ S : "2018-12-27T00:21:31.322Z" },
content: // Message content
{ S : "hello this is user7. How are you doing?" },
inDate: // Message's inDate
{ S : "2018-12-27T00:26:22.083Z" },
senderNickname: // Message sender's nickname
{ S : "user7" },
isRead: // Determines whether the recipient has read the message
{ BOOL : false },
receiverNickname: // Message recipient's nickname
{ S : "ryan" },
isReceiverDelete: // Whether the message recipient has deleted the message
{ BOOL : false },
isSenderDelete: // Whether the message sender has deleted the message
{ BOOL : false }
}
}

Sample code

public class MessageItem
{
public string receiver;
public string sender;
public string content;
public string inDate;
public string senderNickname;
public bool isRead;
public string receiverNickname;
public bool isReceiverDelete;
public bool isSenderDelete;

public override string ToString()
{
return $"receiver : {receiver}\n" +
$"sender : {sender}\n" +
$"content : {content}\n" +
$"inDate : {inDate}\n" +
$"senderNickname : {senderNickname}\n" +
$"isRead : {isRead}\n" +
$"receiverNickname : {receiverNickname}\n" +
$"isReceiverDelete : {isReceiverDelete}\n" +
$"isSenderDelete : {isSenderDelete}\n";
}
};
public void GetSentMessageTest()
{
var bro = Backend.Message.GetSentMessage("2022-03-14T07:21:01.953Z");

if(!bro.IsSuccess())
return;

LitJson.JsonData json = bro.GetFlattenJSON();

<!-- MessageItem messageItem = new MessageItem(); -->

<!-- messageItem.receiver = json["row"]["receiver"].ToString(); -->
<!-- messageItem.sender = json["row"]["sender"].ToString(); -->
<!-- messageItem.content = json["row"]["content"].ToString(); -->
<!-- messageItem.inDate = json["row"]["inDate"].ToString(); -->
<!-- messageItem.senderNickname = json["row"]["senderNickname"].ToString(); -->
<!-- messageItem.isRead = json["row"]["isRead"].ToString() == "true" ? true : false; -->
<!-- messageItem.receiverNickname = json["row"]["receiverNickname"].ToString(); -->
<!-- messageItem.isReceiverDelete = json["row"]["isReceiverDelete"].ToString() == "true" ? true : false; -->
<!-- messageItem.isSenderDelete = json["row"]["isSenderDelete"].ToString() == "true" ? true : false; -->

Debug.Log(messageItem.ToString());
}