The getMessageCenterData method allows you to retrieve the pushes that you sent to your users in the past three months in a defined range and quantity.
| Parameter | Data Type |
|---|---|
| limit | Integer |
| startDate | Date |
| endDate | Date |
your title goes here
Make sure that you pass the values for startDate and endDate in timestamps.
getMessageCenterData for logged in users
Method signature
static getMessageCenterData(limit: number, startDate: Date, endDate: Date, callback: Function)Method example
RNInsider.getMessageCenterData(10, startDate, endDate, function (data) { })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 RNInsiderIdentifier 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 | RNInsiderIdentifier | User identifiers to query notifications for a specific user |
| callback | Function | Callback that receives the resulting message center data array |
Method signature
static getMessageCenterDataWithIdentifiers(
limit: number,
startDate: Date,
endDate: Date,
identifiers: RNInsiderIdentifier,
callback: (messageCenterData: any) => void
): void
Method example
const identifiers = new RNInsiderIdentifier()
.addEmail('child@insiderone.com')
.addPhoneNumber('+905551234567')
.addUserID('unique-user-id')
.addCustomIdentifier('account_id', 'parent-account-123')
const end = new Date()
const start = new Date(end.getTime() - 30 * 24 * 60 * 60 * 1000) // 30 days ago
RNInsider.getMessageCenterDataWithIdentifiers(50, start, end, identifiers,
(messageCenterData) => {
// Handle the message center data for the specified user
console.log(`Fetched ${messageCenterData.length} messages`)
})
Your title goes here
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 with a parameter validation warning.