Manage User Preferences
Manage user preferences using different channels in Xtremepush
Manage Preferences using Email and SMS Campaigns
It is possible to add a link to the preference center to allow users to subscribe and unsubscribe to the different preferences from it. To be able to do so, navigate to Settings > Channels > Email Settings and Channels > SMS Settings and enable the Allow user to manage subscription preferences toggle.
After you do so and once you have created the different preferences, the Xtremepush email and SMS preference center will list all of these, which will allow users to opt-in or opt-out from them.

Email preference center showing different preferences to which users can subscribe to.
In email campaigns, users can access the email preference center if you include the following code as a hyperlink to the text:
{{system.url.profile}}
In SMS campaigns, you will need to include the unsubscribe link in your SMS message. That link will allow users to modify their preferences for specific categories.
Update Preferences using File Import and API
It is now possible to update preferences via file import and via API.
It is only possible to set preferences in this way for profile-based channels (email, SMS or profile-based custom channels).
File import
To update preferences via file import, you'll need to include a column per preference and channel in your CSV and set each profile's value to true or false (1
or 0
). When importing Profiles from a CSV you can then map those columns in the file to preferences that exist in the project. The fields can be seen at the bottom of the Map to input column via: Data > Automations > Import (under Preferences).

Mapping of a preference (Financial News) for the email channel.
API
The user profile import external API method can be used to set and update preferences, providing the Name of the specific preferences that need to be updated.
- Consent preferences are specified as a JSON object within the rows array.
- Each communication channel (e.g., SMS, email, custom_channel) is a key with nested preferences.
- The exact preference names must be obtained from the project these imports/updates are intended to be sent to.
- Use integers for consent values (e.g.,
0
for opt-out,1
for opt-in).
curl --request POST \
--url https://external-api.xtremepush.com/api/external/import/profile \
--header 'content-type: application/json' \
--data '{
"apptoken": "YOUR_APPTOKEN",
"columns": [
"user_id",
"consent_preferences"
],
"rows": [
"myuserid",
{
"email": {
"sport_news": 1,
"casino_news": 1
},
"sms": {
"sport_news": 0,
"casino_news": 1
}
}
]
}
Manage Preferences using Push channels (Android, iOS and web)
You can implement your own preference interface in your app or website and use our SDK methods to update the user profile's subscription when they select the different categories.
Device subscription
In order for devices to receive any push campaigns the standard push subscription must be enabled (which it is by default). Review our dedicated guide for more details.
JSONObject prefs = new JSONObject();
prefs.put("news", 1);
prefs.put("marketing", 0);
mPushConnector.updatePushSubscriptionPreferences(this, prefs, this);
let preferences = [
"news": true,
"marketing": false
]
XPush.updatePushSubcriptionPreferences(with: preferences) { (json: [String: Any], error: Error?) in
// handle response
}
[XPush updatePushSubscriptionPreferences: @{
@"news": @YES,
@"marketing": @NO
}
withCompletionHandler: ...];
xtremepush('user', 'update', {
'push_subscription_preferences': {
'news': 1,
'marketing': 0
}
},
function(data) {
console.log('success: ' + JSON.stringify(data))
},
function(data) {
console.log('error: ' + JSON.stringify(data))
}
);
Manage Preferences using On-site Campaigns
It is also possible to subscribe users to specific preferences from on-site campaigns, when they click on a specific button.
For example, you could create a campaign to encourage users to subscribe to your movies' newsletter.

On-site campaign to get users subscribed to a 'movies' email newsletter.
To do so, navigate to Campaigns > Create a campaign > Single-stage > In-App/On-site message > select a pop-up style campaign. Fill in the required details from the Setup, Event, Segment and Schedule tabs. From the Content tab, include two buttons. On your subscription button, set the Subscribe field to the category that you created previously from the Consent Manager page.

How to set up the campaign on the Xtremepush platform.
When users click on that button, they will automatically get subscribed to this category and channel.
Manage Preferences using In-app campaigns
In a similar way as described above, users can opt in for push categories from in-app campaigns. This requires using the deeplink functionality.
To create the in-app campaign, navigate to Campaigns > Single-stage > Create a campaign > In-App/On-site message > select a full-screen or modal campaign type. Include two buttons, and on the desired button, from Action select the Go to deeplink option.
You can register a handler for this on Android and iOS to allow you to take action on the client side based on deeplinks. The deeplink payloads must have enough information to allow your app to make a decision on setting preferences. The deeplink format could be subpref://update?news=1
or subpref://update?news=1&marketing=1
.
See example below:

To review how to configure the handlers on Android and iOS, review the following sections of our Deeplink dedicated guides:
Additionally, here is an example based on parsing the deeplink with the format shown before; that would be a flexible way of setting the subscription preferences from in-app messages.
@Override
public void deeplinkReceived(String link, WeakReference<Context> uiReference) {
try {
//Turn string param into URI and break into relevant components
Uri uri = Uri.parse(link);
String host = uri.getHost();
String protocol = uri.getScheme();
Set<String> preferences = uri.getQueryParameterNames();
//Verify the protocol and host
if (protocol.equalsIgnoreCase("pushsubpref") && host.equalsIgnoreCase("update")) {
//create JSON objects.
//jo is the param we will be passing to the updateUser function
//myPushPreferences is some nested JSON in jo that represents the push params to update
JSONObject jo = new JSONObject();
JSONObject myPushPreferences = new JSONObject();
//loop through URI params then add each key-value pair to our 'myPushPreferences' JSON
for (String key : preferences) {
myPushPreferences.put(key, uri.getQueryParameter(key));
}
jo.put("push_subscription_preferences", myPushPreferences);
// if necessary also set the subscription to 1
jo.put("push_subscription", 1);
//call updateUser function.
//Params are a Context instance, the JSON object we described above, an XPCallbackHandler instance
mPushConnector.updateUser(this, jo, new XPCallbackHandler() {
@Override
public void onSuccess(JSONObject response) {
Log.d("TAG", "Here in on success. response : "+response.toString());
}
@Override
public void onFailure(JSONObject response) {
Log.d("TAG", "Here in on failure. response : "+response.toString());
}
});
}
} catch (Exception e){
}
}
XPush.registerDeeplinkHandler { x in
guard x.hasPrefix("pushsubpref"), let query = URLComponents(string: x)?.queryItems else { return }
var params: [String: String] = [:]
for q in query {
params[q.name] = q.value
}
XPush.updateUser(with: params) { jsonResponse, error in
<#code#>
}
}
[XPush registerDeeplinkHandler:^(NSString *x) {
if !([x hasPrefix:@"pushsubpref"]) {
return;
}
NSMutableDictionary* params = @[].mutableCopy;
for (NSURLQueryItem* q in [NSURLComponents componentsWithString:x].queryItems) {
params[q.name] = q.value;
}
id prefs = @{ @"push_subscription_preferences": params,
@"push_subscription": @(1)
};
[XPush updateUserWith:prefs completionHandler:^(NSDictionary * _Nullable jsonResponse,
NSError * _Nullable error) {
<#code#>
}];
}];
Updated about 1 month ago