As you learn new things about your mobile app's users, you may want to save data to their Iterable profiles. Your marketing team can then use this information to send them personalized messages.
Additionally, you may want to update their subscription preferences, so that they only receive content they want.
This guide describes how to save user profile data and update subscription preferences using Iterable's React Native SDK.
Table of contents
Saving user profile data
To save data to a user's Iterable profile, call the static updateUser
method
on the Iterable
class.
-
Method declaration:
static updateUser( dataFields: any, mergeNestedObjects: boolean )
Parameter Name Description dataFields
Data to store on the user's Iterable profile. mergeNestedObjects
Whether to merge top-level objects included in dataFields
with analogous, existing objects on the user profile (iftrue
) or overwrite them (iffalse
). -
Description:
Saves the provided data to the user's Iterable profile. If
mergeNestedObjects
is true, top-level objects indataFields
are merged with their counterparts that already exist on the user's profile; otherwise, they're added.TIP
Read Field Data Types for information about the kinds of data that can be stored in Iterable.
-
Example:
Iterable.updateUser( { "firstName": "Joe", "favorites": { "color": "red", "flavor": "cinnamon" } }, false );
This call adds the
firstName
field andfavorites
object to the current user's Iterable profile. SincemergeNestedObjects
isfalse
, this call will overwrite the existingfavorites
object (if there is one), replacing it with the value in the call (otherwise, it would have merged the twofavorites
objects).
Updating subscription preferences
To update a user's subscribed email lists, unsubscribed channel IDs, unsubscribed
message type IDs (for opt-out message types) and subscribed message type IDs (for
opt-in message types), call the static updateSubscriptions
method on the
Iterable
class.
-
Method declaration:
static updateSubscriptions( emailListIds: Array<number> | undefined, unsubscribedChannelIds: Array<number> | undefined, unsubscribedMessageTypeIds: Array<number> | undefined, subscribedMessageTypeIds: Array<number> | undefined, campaignId: number, templateId: number )
Parameter Name Description emailListIds
The email lists to which the user should be subscribed. unsubscribedChannelIds
The message channels from which the user should be unsubscribed. unsubscribedMessageTypeIds
The message types from which the user should be unsubscribed (for opt-out message types). subscribedMessageTypeIds
The message types to which the user should be subscribed (for opt-in message types). campaignId
The campaign to associate with events generated by this request. Use -1
if unknown or not applicable.templateId
The template to associate with events generated by this request. Use -1
if unknown or not applicable.For
emailListIds
,unsubscribedChannelIds
,unsubscribedMessageTypeIds
, orsubscribedMessageTypeIds
, provide all values relevant to the user— not deltas. For any of these arrays, usenull
to indicate that Iterable should not change the current value on the user's profile.TIP
For more information about message channels and types, read Message Channels and Message Types Overview.
-
Description:
Updates the user's subscriptions.
-
Example:
Iterable.updateSubscriptions( null, [33015,33016,33018], null, null, 12345, 67890 );
This call unsubscribes the user from channels
33015
,33016
and33018
, attributing the change to the campaign with ID12345
and the template with ID67890
.
Further reading
- React Native
- Iterable's React Native SDK (GitHub)
- Iterable's iOS SDK
- Iterable's iOS SDK (GitHub)
- Iterable's Android SDK
- Iterable's Android SDK (GitHub)
- API Overview
Comments
0 comments
Article is closed for comments.