To ensure App Inbox can successfully fetch and display messages, follow the sequence below in your application:
1. Initialize the SDK
Configure the SDK with your project token, API base URL, and any other required settings.
Do not open App Inbox or call any App Inbox fetch methods until SDK initialization has completed successfully.
2. Configure Authentication (if applicable)
If you are using advanced authentication mechanisms such as JWT, customer tokens, or StreamConfig, configure and set the token immediately after SDK initialization and before customer identification.
3. Complete User Login
Run your application's standard login flow and ensure the user has successfully authenticated.
At this stage, your application should know the logged-in customer's identity.
4. Identify the Customer Using a Hard ID
Call the SDK's customer identification method with a hard ID that exists on the customer's Bloomreach profile, such as registered, customer_id, or another configured project hard ID.
Example
identifyCustomer({
"registered": "user@example.com"
})
5. Flush Identification (if required)
If the SDK is configured with a non-immediate flush mode, call the appropriate flush method to ensure the identification event is sent to Bloomreach before attempting to fetch App Inbox messages.
This step can be skipped if your SDK is configured to flush immediately.
6. Open App Inbox or Fetch Messages
After customer identification has been successfully processed, you can:
- Open the built-in App Inbox UI, or
- Call App Inbox data APIs such as
fetchAppInbox()orfetchAppInboxMessages().
Common Issue
If App Inbox is opened before customer identification is completed, the SDK may attempt to fetch messages for an anonymous user. This can result in:
- An empty inbox
- Missing messages
- Errors such as: "missing hard ID" or "Something went wrong :(. We couldn't retrieve your messages."
If you encounter these symptoms, verify that customer identification is complete before triggering any App Inbox fetch operation.