With Intercom Android SDK, we call Intercom.initialize in the Application sub-class.
We only login a user when they login to our app. On our login screen, we have a button that should open an intercom help article. We just call Intercom.client().presentContent(myId) when the user clicks this button.
Recently, this leads to “Something wen wrong. Try again” message. Logging in and logging out fixes the problem.
My question is: Is it required to have a registered user (perhaps an unidentified one) before calling presentContent()?
Best answer by Dara K
Hey @Kiran Rao
Yes, you should assume a user (identified or unidentified) must be logged in before calling presentContent(...).
The Android SDK flow is:
Intercom.initialize(...) in your Application class – sets up the SDK, but does not create/log in a user.
Intercom.client().registerIdentifiedUser(...)orregisterUnidentifiedUser() – creates/logs in the current Intercom user in that app session.
UI calls like presentMessenger(), presentContent(id), etc. – rely on there being a current logged-in user; otherwise you can get errors like the “Something went wrong. Try again” screen.
In your case:
On the login screen, you’re calling presentContent(myId) before any registerIdentifiedUser / registerUnidentifiedUser has run in this session.
After the user logs in (or you log them out/in), the SDK has a valid user context again, so the content loads.
Best practice:
Option A (simplest): When the app starts (or when the login screen is shown), call:
Intercom.client().registerUnidentifiedUser()
so there is always at least an anonymous user before you call presentContent(...).
Option B: Only show that “help article” button after you’ve either:
registered an unidentified user, or
logged in the real user with registerIdentifiedUser.
Yes, you should assume a user (identified or unidentified) must be logged in before calling presentContent(...).
The Android SDK flow is:
Intercom.initialize(...) in your Application class – sets up the SDK, but does not create/log in a user.
Intercom.client().registerIdentifiedUser(...)orregisterUnidentifiedUser() – creates/logs in the current Intercom user in that app session.
UI calls like presentMessenger(), presentContent(id), etc. – rely on there being a current logged-in user; otherwise you can get errors like the “Something went wrong. Try again” screen.
In your case:
On the login screen, you’re calling presentContent(myId) before any registerIdentifiedUser / registerUnidentifiedUser has run in this session.
After the user logs in (or you log them out/in), the SDK has a valid user context again, so the content loads.
Best practice:
Option A (simplest): When the app starts (or when the login screen is shown), call:
Intercom.client().registerUnidentifiedUser()
so there is always at least an anonymous user before you call presentContent(...).
Option B: Only show that “help article” button after you’ve either:
registered an unidentified user, or
logged in the real user with registerIdentifiedUser.