Skip to main content

GetRecentChat

public BackendReturnObjectGetRecentChat(ChannelType channelType, string channelinDate);
public BackendReturnObjectGetRecentChat(ChannelType channelType, string channelinDate, int limit);

Parameters

ValueTypeDescriptionDefault
channelTypeChannelTypeType of the channel. ChannelType.Public(normal) or ChannelType.Guild(guild)-
channelIndatestringChannel's inDate-
limitint(Optional) Number of game information rows to call. Maximum is 30. When set to 0, returns 300

Description

This is an asynchronous method that can be called at any time, separate from recent history call events.
Even before entering a channel, you can use this method to view the recent chat history.

In the key value upon return, channel_uuid value is the channel's inDate, and inDate is the time the message is sent.

  • Only chats from the public/guild channel are loaded; whispers, announcements, and all chat are not included.
  • Up to 30 chats can be loaded for the message history.
  • Chats within 1 - 2 minutes might not be loaded.
  • The message filter is applied, but not the user block.
  • Messages that have passed 48 hours from the time of sending cannot be called.(same as the console's BACKND Chat history viewing).

Example

Synchronous

// Gets the chat channel list.  
BackendReturnObject bro = Backend.Chat.GetGroupChannelList("Group name");

//Gets the UUID of the chat channel.
string channelIndate = bro.GetReturnValuetoJSON()["rows"][0]["inDate"].ToString();

//Gets the general chat channel's recent chat history using the uuid(only 25)
BackendReturnObject result = Backend.Chat.GetRecentChat(ChannelType.Guild , channelIndate , 25);

for(int i=0; i< result.Rows().Count; i++)
{
string nickname = result.Rows()[i]["nickname"].ToString();
string message = result.Rows()[i]["message"].ToString();

Debug.Log(nickname + " : " + message);
}

Asynchronous

// Gets the chat channel list.  
Backend.Chat.GetGroupChannelList("Group name", callback =>
{
if(callback.IsSuccess())
{
//Gets the UUID of the chat channel.
string channelIndate = callback.GetReturnValuetoJSON()["rows"][0]["inDate"].ToString();

//Gets the general chat channel's recent chat history using the uuid(only 25)
Backend.Chat.GetRecentChat(ChannelType.Guild , channelIndate , 25, callback2 =>
{
if(callback2.IsSuccess())
{
//When successful...
}
});
}
});

SendQueue

SendQueue.Enqueue(Backend.Chat.GetGroupChannelList, "Group name", callback => 
{
if(callback.IsSuccess())
{
//Gets the UUID of the chat channel.
string channelIndate = callback.GetReturnValuetoJSON()["rows"][0]["inDate"].ToString();

//Gets the general chat channel's recent chat history using the uuid(only 25)
SendQueue.Enqueue(Backend.Chat.GetRecentChat,ChannelType.Guild , channelIndate , 25, callback2 =>
{
if(callback2.IsSuccess())
{
//When successful...
}
});
}
});

Return cases

Success cases

When loaded successfully
statusCode : 200
message : Success returnValue : refer to GetReturnValuetoJSON

Error cases

When the channel does not exist
statusCode : 400
errorCode : UndefinedParameterException
message : undefined channel, channel cannot be found

When the channelinDate does not exist
statusCode : 400
errorCode : NotFoundException
message : log not found, log cannot be found

When the chat history does not exist
statusCode : 404
errorCode : NotFoundException
message : log not found, log cannot be found

GetReturnValuetoJSON

{
"rows":
[
{
"channel":0,
"channel_uuid": "2021-01-12T08:42:39.086Z", // The channel's inDate
"inDate":"2020-10-27T02:40:42.580549Z", // Time the message was sent
"message":"Hello",
"nickname":"a1"
},
{
"channel":0,
"channel_uuid":"2021-01-12T08:42:39.086Z",
"inDate":"2020-10-27T02:40:43.780942Z",
"message":" Nice to meet you",
"nickname":"b1"
}
]
}