Documentation Index

Fetch the complete documentation index at: https://academy.insiderone.com/llms.txt

Use this file to discover all available pages before exploring further.

Get message center data

Prev Next

The getMessageCenterData method allows you to retrieve pushes you sent to your users in the past three months, within a specified range and quantity.

ParameterData Type
limitNumber
startDateDate
endDateDate
your title goes here
Make sure you pass the startDate and endDate values astimestamps.

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);
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 Identifier object. When identifiers are provided, the SDK sends the specified identifiers instead of the current user's Insider ID.

ParameterTypeDescription
limitNumberMaximum number of notifications to return
startDateDateStart date for the notification query range
endDateDateEnd date for the notification query range
identifiersObjectPlain 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.