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
limitInteger
startDateDate
endDateDate
your title goes here
Make sure you pass the startDate and endDate values astimestamps.

getMessageCenterData for logged-in users

Method signature

Future getMessageCenterData(DateTime startDate, DateTime endDate, int limit) async

Method example

// Call in async method.
final now = DateTime.now();
final yesterday = new DateTime(now.year, now.month, now.day - 1);
List<dynamic> notifications = await FlutterInsider.Instance.getMessageCenterData(yesterday, now, 1);
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

The getMessageCenterDataWithIdentifiers method allows you to retrieve pushes you sent to a specific user in the past three months, within a specified range and quantity.

ParameterData Type
startDateDateTime
endDateDateTime
identifiersFlutterInsiderIdentifiers
limitsint

Method signature

Future getMessageCenterDataWithIdentifiers(DateTime startDate, DateTime endDate, FlutterInsiderIdentifiers identifiers, int limit) async

Method example

final DateTime startDate = DateTime.now().subtract(Duration(days: 7));
final DateTime endDate = DateTime.now();
FlutterInsiderIdentifiers identifiers = new FlutterInsiderIdentifiers();
identifiers.addEmail("example@insiderone.com");
identifiers.addPhoneNumber("+12345678901");
identifiers.addUserID("user_id");
final List<dynamic> messages = await getMessageCenterDataWithIdentifiers(
  startDate,
  endDate,
  identifiers,
  limit,
);