Class BatchProfileAttributeEditor
Profiles centralize data and events from multiple sources (Apps, Websites, APIs) in a single place based on the Custom ID. They also store a profile's email address and email subscriptions.
The Batch Profile Attribute Editor allows you to update profiles to:
Set attributes Set email subscription status and email address Set a language & region
-
Field Summary
-
Method Summary
Modifier and TypeMethodDescriptionaddToArray
(String key, String value) Add a string value in the specified array attribute.addToArray
(String key, List<String> values) Add a list of strings in the specified array attribute.removeAttribute
(String key) Removes a custom attribute.
Does nothing if it was not set.removeFromArray
(String key, String value) Removes a string from an array attribute.removeFromArray
(String key, List<String> values) Removes a list of strings from an array attribute.void
save()
Save all of the pending changes made in that editor.setAttribute
(String key, boolean value) Set a custom profile attribute for a key.setAttribute
(String key, double value) Set a custom profile attribute for a key.setAttribute
(String key, long value) Set a custom profile attribute for a key.setAttribute
(String key, String value) Set a custom profile attribute for a key.setAttribute
(String key, URI value) Set a custom profile attribute for a key.setAttribute
(String key, Date value) Set a custom profile attribute for a key.setAttribute
(String key, List<String> value) Set a custom profile attribute for a key.setEmailAddress
(String email) Set the profile email address.Set the profile email marketing subscription state.setLanguage
(String language) Set the language of this profile.
Overrides the detected installation language.setPhoneNumber
(String phoneNumber) Set the profile phone number.Set the region of this profile.
Overrides the detected installation region.Set the profile SMS marketing subscription state.
-
Field Details
-
TAG
- See Also:
-
-
Method Details
-
setLanguage
Set the language of this profile.
Overrides the detected installation language.- Parameters:
language
- lowercase, ISO 639 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setRegion
Set the region of this profile.
Overrides the detected installation region.- Parameters:
region
- uppercase, ISO 3166 formatted string. null to reset.- Returns:
- This object instance, for method chaining
-
setEmailAddress
Set the profile email address.Note: This method requires to already have a registered identifier for the user or to call
Batch.Profile#identify(String)
method before this one.- Parameters:
email
- Email address string- Returns:
- This object instance, for method chaining.
-
setEmailMarketingSubscription
Set the profile email marketing subscription state.Note that profile's subscription status is automatically set to unsubscribed when they click an unsubscribe link.
- Parameters:
state
- State of the subscription- Returns:
- This object instance, for method chaining.
-
setPhoneNumber
Set the profile phone number.Note: This method requires to already have a registered identifier for the user or to call
Batch.Profile#identify(String)
method before this one.Example:
Batch.Profile.identify("my_custom_user_id") Batch.Profile.editor().setPhoneNumber("+33123456789").save()
- Parameters:
phoneNumber
- A valid E.164 formatted string. Must start with a `+` and not be no longer than 15 digits without special characters (eg: "+33123456789"). Null to reset.- Returns:
- This object instance, for method chaining.
- See Also:
-
setSMSMarketingSubscription
Set the profile SMS marketing subscription state.Note that profile's subscription status is automatically set to unsubscribed when they send a STOP message.
- Parameters:
state
- State of the subscription- Returns:
- This object instance, for method chaining.
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null. Note that since timezones are not supported, this will typically represent UTC dates.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null or empty. Must be a string not longer than 64 characters. For better results, you should make them upper/lowercase and trim the whitespaces.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null or empty. Must be a valid URI not longer than 2048 character.- Returns:
- This object instance, for method chaining
-
setAttribute
Set a custom profile attribute for a key.- Parameters:
key
- Attribute key, can't be null. It should be made of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- Attribute value, can't be null or empty. Must be a valid List not longer than X items.- Returns:
- This object instance, for method chaining
-
removeAttribute
Removes a custom attribute.
Does nothing if it was not set.- Parameters:
key
- Attribute key- Returns:
- This object instance, for method chaining
-
addToArray
Add a string value in the specified array attribute. If empty, the collection will automatically be created.- Parameters:
key
- The array attribute to add the value to. Cannot be null. Must be a string of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.value
- The value to add. Cannot be null or empty. Must be a string no longer than 64 characters.- Returns:
- This object instance, for method chaining
-
addToArray
Add a list of strings in the specified array attribute. If empty, the collection will automatically be created.- Parameters:
key
- The array attribute to add the value to. Cannot be null. Must be a string of letters, numbers or underscores ([a-z0-9_]) and can't be longer than 30 characters.values
- The strings to add. Cannot be null or empty. Must be strings no longer than 64 characters and max 25 items- Returns:
- This object instance, for method chaining
-
removeFromArray
Removes a string from an array attribute. Does nothing if the tag does not exist.- Parameters:
key
- Array attribute namevalue
- The value to remove- Returns:
- This object instance, for method chaining
-
removeFromArray
Removes a list of strings from an array attribute. Does nothing if the tag does not exist.- Parameters:
key
- Array attribute namevalues
- The values to remove- Returns:
- This object instance, for method chaining
-
save
public void save()Save all of the pending changes made in that editor. Note if Batch is not started, your changes will be enqueue until it start. Once you called "save", you need to get a new editor in order to make further changes.This action cannot be undone.
-