SDK

Segmentation

This is an add-on feature of Notificare. You will need to subscribe to the Users & Authentication add-on and configure this service as described here. Once subscribed, before you can use this functionality, make sure you create User Preferences like explained here.

The following methods are only available when users are authenticated. This functionality will allow you to create a rich user profile based on your users preferences, personal information, etc.

To get a list of preferences for a user, use the following method:

final preferences = await NotificareAuthentication.fetchUserPreferences();

To get a list of user segments, use the following method:

final segments = await NotificareAuthentication.fetchUserSegments();

To add a user to a segment, invoke one of the methods below:

//
// With a user segment
//
final NotificareUserSegment segment = ...;
await NotificareAuthentication.addUserSegment(segment);

//
// With a user preference + option
//
final NotificareUserPreferenceOption option = ...;
final NotificareUserPreference preference = ...;
await NotificareAuthentication.addUserSegmentToPreference(
  preference: preference,
  option: option,
);

To remove a user from a segment, invoke one of the methods below:

//
// With a user segment
//
final NotificareUserSegment segment = ...;
await NotificareAuthentication.removeUserSegment(segment);

//
// With a user preference + option
//
final NotificareUserPreferenceOption option = ...;
final NotificareUserPreference preference = ...;
await NotificareAuthentication.removeUserSegmentFromPreference(
  preference: preference,
  option: option,
);

This functionality will allow you to categorize your users based on their preferences. You can then easily create campaigns using these segments.