First name is particularly useful because it can be used to dynamically personalize the user's experience. Many Pulsate customers send us their user's first name to allow personalizing push notifications / in apps / inbox.
You can change personal user data by using any of these methods:
- updateFirstName to update the user's first name
- updateLastName to update the user's last name
- updateEmail to update the user's email
- updatePhoneNumber to update the user's phone number. Specify the phone number using the E.164 format
- updateGender to update the user's gender. PulsateGender.MALE or PulsateGender.FEMALE
- updateAge to update the user's age
- setPrivacy to subscribe or unsubscribe the user from Pulsate. PulsatePrivacy.SUBSCRIBE or PulsatePrivacy.UNSUBSCRIBE. Unsubscribing means the user will no longer receive any messages from Pulsate.
The data will be stored locally and sent to the Pulsate server the next time synchronization occurs. Developers can force an synchronization by calling the forceAttributeSync method.
Always remember to send user data only after a user session has already started. Developers can use the IPulsateRequestListener onSucess() callback to do that.
val pulsateManager = PulsateFactory.getInstance()
pulsateManager.startPulsateSession(object : IPulsateRequestListener {
override fun onSuccess() {
pulsateManager.updateFirstName("John")
pulsateManager.updateLastName("Smith")
pulsateManager.updateEmail("[email protected]")
pulsateManager.updatePhoneNumber("+1408XXXXXXX")
pulsateManager.updateGender(PulsateGender.MALE)
pulsateManager.updateAge(30)
pulsateManager.setPrivacy(PulsatePrivacy.SUBSCRIBE)
}
override fun onError(e: Throwable?) {
}
})
val pulsateManager = PulsateFactory.getInstance()
pulsateManager.startPulsateSessionForAlias("JohnSmithAlias", object : IPulsateRequestListener {
override fun onSuccess() {
pulsateManager.updateFirstName("John")
pulsateManager.updateLastName("Smith")
pulsateManager.updateEmail("[email protected]")
pulsateManager.updatePhoneNumber("+1408XXXXXXX")
pulsateManager.updateGender(PulsateGender.MALE)
pulsateManager.updateAge(30)
pulsateManager.setPrivacy(PulsatePrivacy.SUBSCRIBE)
}
override fun onError(e: Throwable?) {
}
})