Changing `userID` after launch


#1

We’ve been using Intercom in our app for years, but now we’d like to make a change to the identifying value that it passes to Intercom.registerUser(withUserID: userID). We’re planning to attach the old identifying value as a new property - say customID - via Intercom.updateUser().

If we move forward, what would happen to our user data if we made the change to registerUser? Our guess is that Intercom would create a new user (since userID is different).

Alternatively, is it possible to alter the userID for active users with an approach like this?

  1. Pass the old/current value - say “oldID” - to registerUser
  2. Use updateUser to change that value:

    let userAttributes = ICMUserAttributes()
    userAttributes.userId = newID
    userAttributes.customID = oldID
    Intercom.updateUser(userAttributes)

Please let us know what effects these changes could have on our data. I’m happy to provide more details if that helps. Thanks!


#2

Hey @Ogel :wave:

Yep that’s correct, Intercom will create a new user if you pass in a different user_id to the registerUser method. It’s not possible to change user_ids through the mobile SDKs as you’ve described unfortunately.

You could do it via our REST API though. You’ll need to issue an update user request using the internal Intercom id to identify the user and with the new user_id supplied as a parameter.

Would this be an option?

Something to be aware of if you go down this route is that the SDKs have a user store which caches user identities and will persist across upgrades of your mobile app. Only calling the logout method or deleting the app will clear the store.

So if you want to change your user_id scheme, you’ll need to write some migration logic to clear the old user identities. Something like this for example:

onLaunch() {
  firstLaunchNewVersion?() {
    Intercom.logout();
    Intercom.registerUser(withUserID: newID);
  }
}

Hope this helps! Let me know if you’ve any further questions.

Cheers,
Matthew