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 as timestamps.
getMessageCenterData for logged-in users
Method Signature
public void getMessageCenterData(int limit, Date startDate, Date endDate, 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);
}
});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.
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
}
});| 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