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 | Number |
| startDate | Date |
| endDate | Date |
getMessageCenterData for logged-in users
Method signature
getMessageCenterData(limit: number, startDate: Date, endDate: Date): Promise <any>;Method example
const startDate = new Date(Date.now());
const endDate = new Date(Date.now() + 86400000);
const mData = await window.Insider.getMessageCenterData(100, startDate, endDate);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 Identifier object. When identifiers are provided, the SDK sends the specified identifiers instead of the current user's Insider ID.
| Parameter | Type | Description |
|---|---|---|
| limit | Number | 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 | Object | Plain object of user identifiers produced by window.Insider.identifier().getIdentifiers() |
Method signature
getMessageCenterDataWithIdentifiers(
limit: number,
startDate: Date,
endDate: Date,
identifiers: object
): Promise<any>;
Method example
const identifiers = window.Insider.identifier();
identifiers.addEmail('child@insiderone.com');
identifiers.addPhoneNumber('+905551234567');
identifiers.addUserID('unique-user-id');
identifiers.addCustomIdentifier('account_id', 'parent-account-123');
const endDate = new Date();
const startDate = new Date(endDate.getTime() - 30 * 24 * 60 * 60 * 1000); // 30 days ago
const data = await window.Insider.getMessageCenterDataWithIdentifiers(
50,
startDate,
endDate,
identifiers.getIdentifiers()
);
console.log(`[INSIDER][messageCenter]: Fetched ${data.length} messages`, data);
If the provided RNInsiderIdentifier contains no identifiers, the SDK automatically falls back to the current user's Insider ID. Passing null or undefined for any parameter causes the call to be skipped and a parameter validation warning to be issued.