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:

[[NotificarePushLib shared] fetchUserPreferences:^(NSArray *info) {

  //Handle success

} errorHandler:^(NSError *error) {

  //Handle error
}];
NotificarePushLib.shared().fetchUserPreferences({(_ info: [Any]) -> Void in
    //Handle success
}, errorHandler: {(_ error: Error?) -> Void in
    //Handle error
})

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

[[NotificarePushLib shared] addSegment:(NotificareSegment *)seg toPreference:(NotificareUserPreference *)pref completionHandler:^(NSDictionary *info) {

  //Handle success

} errorHandler:^(NSError *error) {

  //Handle error
}];
NotificarePushLib.shared().add((seg as? NotificareSegment), to: (pref as? NotificareUserPreference), completionHandler: {(_ info: [AnyHashable: Any]) -> Void in
    //Handle success
}, errorHandler: {(_ error: Error?) -> Void in
    //Handle error
})

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

[[NotificarePushLib shared] removeSegment:(NotificareSegment *)seg fromPreference:(NotificareUserPreference *)pref completionHandler:^(NSDictionary *info) {

  //Handle success

} errorHandler:^(NSError *error) {

  //Handle error
}];
NotificarePushLib.shared().remove((seg as? NotificareSegment), from: (pref as? NotificareUserPreference), completionHandler: {(_ info: [AnyHashable: Any]) -> Void in
    //Handle success
}, errorHandler: {(_ error: Error?) -> Void in
    //Handle error
})

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