The getMessageCenterData method allows you to retrieve pushes you sent to your users in the past three months, within a specified range and quantity.
| Parameter | Data Type |
|---|---|
| limit | Integer |
| startDate | Date |
| endDate | Date |
your title goes here
Make sure you pass the startDate and endDate values astimestamps.
getMessageCenterData for logged-in users
Method Signature
public void getMessageCenterData(int limit, Date startDate, Date endDate, MessageCenterData messageCenterData)fun getMessageCenterData(
limit: Int,
startDate: Date,
endDate: Date,
messageCenterData: MessageCenterData
)
Method Example
Insider.Instance.getMessageCenterData(20, new Date(1546300800), new Date(), new MessageCenterData() {
@Override
public void loadMessageCenterData(JSONArray messageCenterData) {
// Handle here
Log.d("[INSIDER]", "[getMessageCenterData]: " + messageCenterData);
}
});val startDate = Date(1546300800000L) // 1 Jan 2019, in milliseconds
val endDate = Date()
Insider.Instance.getMessageCenterData(20, startDate, endDate) { messageCenterData ->
Log.d("[INSIDER]", "[getMessageCenterData]: $messageCenterData")
}
Sample Response
Below is a sample response for this method.
[getMessageCenterData]: [{"camp_id":4423,"camp_type":"Single Push","created_at":"2022-05-18T11:36:47Z","deep_links":{"key":"value"},"message":"My great message","title":"My amazing title","variant_id":9743},{"camp_id":169,"camp_type":"Recurring Push","created_at":"2022-05-17T13:50:12Z","message":"This is another message","title":"This is another title","variant_id":9735},{"camp_id":4352,"camp_type":"Single Push","created_at":"2022-04-18T16:03:34Z","image_url":"https:image.png","message":"This is my message","title":"This is my title","variant_id":9599}]Your title goes here
The getMessageCenterData method functions with a user-based mechanism. For example, if user A and user B log into the app on the same device, each user will see the push notifications they received.
Retrieve data with custom identifiers
You can also retrieve Message Center data for related users (e.g., child accounts under a parent account) by passing an InsiderIdentifiers object. When identifiers are provided, the SDK sends the specified identifiers instead of the current user's Insider ID.
Method signatures
public void getMessageCenterData(
int limit,
Date startDate,
Date endDate,
InsiderIdentifiers identifiers,
MessageCenterData messageCenterData
)
fun getMessageCenterData(
limit: Int,
startDate: Date,
endDate: Date,
identifiers: InsiderIdentifiers,
messageCenterData: MessageCenterData
)
Method examples
InsiderIdentifiers identifiers = new InsiderIdentifiers()
.addEmail("user@example.com")
.addPhoneNumber("+905551234567")
.addUserID("unique-user-id")
.addCustomIdentifier("account_id", "parent-account-123");
Insider.Instance.getMessageCenterData(20, startDate, endDate, identifiers, new MessageCenterData() {
@Override
public void loadMessageCenterData(JSONArray messageCenterData) {
// Handle the message center data for the specified user
}
});val identifiers = InsiderIdentifiers()
.addEmail("user@example.com")
.addPhoneNumber("+905551234567")
.addUserID("unique-user-id")
.addCustomIdentifier("account_id", "parent-account-123")
Insider.Instance.getMessageCenterData(20, startDate, endDate, identifiers) { messageCenterData ->
// Handle the message center data for the specified user
}
| Parameter | Type | Description |
|---|---|---|
| limit | int | Maximum number of notifications to return |
| startDate | date | Start date for the notification query range |
| endDate | date | End date for the notification query range |
| identifiers | InsiderIdentifiers | User identifiers to query notifications for a specific user |
| messageCenterData | MessageCenterData | Callback interface to receive the resulting JSONArray |
Your title goes here
If identifiers is null or empty, the SDK automatically falls back to the current user's Insider ID