Answered

User data is getting mixed up

  • 12 June 2023
  • 1 reply
  • 82 views

In the Android project I'm working on, we're noticing that user data is getting mixed up. Why could this be happening? Every time a user logs into the application, we perform a login to Intercom using the following code:

 

operator fun invoke(user: UserModel, intercomHash: String) {
    val userAttributes = createUserAttributes(user)
    val registration = Registration.create().withUserId(user.id)
    Intercom.client().setUserHash(intercomHash)
    Intercom.client().loginIdentifiedUser(registration, object : IntercomStatusCallback {
        override fun onFailure(intercomError: IntercomError) {
            /*
                The Intercom login will fail with error code 3002 if the user is already logged in.
             */
        }

        override fun onSuccess() {
            Intercom.client().updateUser(userAttributes)
        }
    })
}

private fun createUserAttributes(user: UserModel) = UserAttributes.Builder()
    .withEmail(user.person.emailAddress)
    .withPhone(user.person.phoneNumber)
    .withName(user.person.name.fullName)
    .withCustomAttribute(CUIT_CUIL, user.person.identification.cuitCuil)
    .withCustomAttribute(FIRST_NAME, user.person.name.firstName)
    .withCustomAttribute(LAST_NAME, user.person.name.lastName)
    .withCustomAttribute(EMAIL, user.person.emailAddress)
    .withCustomAttribute(DNI, user.person.identification.dni)
    .withCustomAttribute(TRACKING_ID, user.trackingId)
    .build()



And if the user unlinks their account, we use 

Intercom.client().logout()



Please note that we're using version 15.1.0 of the Intercom SDK.

icon

Best answer by Racheal 16 June 2023, 03:01

View original

1 reply

Userlevel 4
Badge +5

Hey @JuanFraga Racheal from the support engineer team here👋 

 

We’ll need a bit more context here, such as user examples and what exactly is getting mixed up. I’ll go ahead and forward this conversation in to support. Keep an eye out for their response!

Reply