Skip to main content
Version: 5.7.0

GetMessagesPage

Given a json context object, returns a page of messages for this user. Note also returns an encoded context object that is used in the follow-up GetMessagesPageOffset api call.

Some of the more useful fields for context queries are:

FieldDescription
msgboxThe messagbox the message is in
mbCrThe date the message was sent / arrived
message.fromWho the message is from
message.toWho the message is to

Context example - search inbox

This context searches for all messages in the "inbox", sorts them by creation (i.e. arrival time, newest first) and returns them using the default pagination.

{
"context": {
"searchCriteria": {
"msgbox": "inbox"
},
"sortCriteria": {
"mbCr": -1
}
}
}

Context example - search by party

This context searches for all messages sent to/from the specified profile, sorts them by creation time, and returns them in batches of 10.

{
"context": {
"searchCriteria": {
"$or": [
{ "message.from.id": "aProfileId" },
{ "message.to": { "$in": ["aProfileId"] } }
]
},
"sortCriteria": {
"mbCr": -1
},
"pagination": {
"rowsPerPage": 10,
"pageNumber": 1
}
}
}
ServiceOperation
messagingGET_MESSAGES_PAGE

Method Parameters

ParameterDescription
contextA context object that controls the searchCriteria, pagination and sorting of the results to be returned.

Usage

http://localhost:3000
string context = "{\"pagination\":{\"rowsPerPage\":10,\"pageNumber\":1},\"searchCriteria\":{\"msgbox\":\"inbox\",\"read\":false},\"sortCriteria\":{\"mbCr\":1,\"mbUp\":-1}}";
SuccessCallback successCallback = (response, cbObject) =>
{
Debug.Log(string.Format("Success | {0}", response));
};
FailureCallback failureCallback = (status, code, error, cbObject) =>
{
Debug.Log(string.Format("Failed | {0} {1} {2}", status, code, error));
};

_bc.MessagingService.GetMessagesPage(context, successCallback, failureCallback);
JSON Response
{
"data": {
"context": "eyJzZWFyY2hDcml0ZXJpYSI6e30sInNvcnRDcml0ZXJpYSI6eyJtYkNyIjoxLCJtYlVwIjotMX0sInBhZ2luYXRpb24iOnsicm93c1BlclBhZ2UiOjEwLCJwYWdlTnVtYmVyIjoxLCJkb0NvdW50IjpmYWxzZSwic2tpcFJlY291bnQiOmZhbHNlfSwib3B0aW9ucyI6bnVsbCwicmVzdWx0Q291bnQiOjJ9",
"results": {
"count": 2,
"page": 1,
"items": [
{
"mbVer": 1,
"mbUp": 1731088457811,
"read": false,
"msgCr": 1731088457661,
"msgVer": 1,
"mbCr": 1731088457811,
"msgId": "3c0bec30-f384-42a0-a051-06ca3c9d57fa",
"msgUp": 1731088457661,
"message": {
"from": {
"id": "5940bea5-6b56-4766-8fb0-bf709b6da4ae",
"name": "me"
},
"sentAt": 1731088457463,
"to": ["004df8e8-a746-4162-94fb-8915583f6f6c"],
"content": {
"subject": "Chat and messaging features are here!",
"text": "Check out the new chat and messaging features!"
}
},
"msgbox": "sent"
},
{
"mbVer": 1,
"mbUp": 1731260617490,
"read": false,
"msgCr": 1731260617419,
"msgVer": 1,
"mbCr": 1731260617490,
"msgId": "582d81bc-2cc6-4773-a4fe-e94edd0952f4",
"msgUp": 1731260617419,
"message": {
"from": {
"id": "004df8e8-a746-4162-94fb-8915583f6f6c",
"name": "other"
},
"sentAt": 1731260617404,
"to": ["5940bea5-6b56-4766-8fb0-bf709b6da4ae"],
"content": {
"subject": "send message to me!",
"text": "Check out the new chat and messaging features!"
}
},
"msgbox": "inbox"
}
],
"moreAfter": false,
"moreBefore": false
}
},
"status": 200
}
Common Error Code

Status Codes

CodeNameDescription
40601FEATURE_NOT_ENABLEDMessaging feature is not enabled for app.