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 also 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:

Notificare.fetchUserPreferences(function(result) {
  //Handle success
}, function(error) {
  //Handle error
});
const preferences = await Notificare.fetchUserPreferences();

This method will return a list of all User Preferences created for your app. You can then add or remove users to/from segments in each preference.

To add the user to a segment in a preference, invoke the method below:

Notificare.addSegmentToUserPreference(segment, preference, function(result) {
  //Handle success
}, function(error) {
  //Handle error
});
await Notificare.addSegmentToUserPreference(segment, preference);

To remove a user from a segment in a preference, invoke the method below:

Notificare.removeSegmentFromUserPreference(segment, preference, function(result) {
  //Handle success
}, function(error) {
  //Handle error
});
await Notificare.removeSegmentFromUserPreference(segment, preference);

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