SUPPORT.TWILIO.COM END OF LIFE NOTICE: This site, support.twilio.com, is scheduled to go End of Life on February 27, 2024. All Twilio Support content has been migrated to help.twilio.com, where you can continue to find helpful Support articles, API docs, and Twilio blog content, and escalate your issues to our Support team. We encourage you to update your bookmarks and begin using the new site today for all your Twilio Support needs.

Missing Intercom User Jwt Causing Error When Messenger Security Is Enforced

Issue

When initializing the Intercom SDK via analytics.js, you encounter the following authentication error message from the Intercom widget:

Missing user_hash or intercom_user_jwt. A valid user_hash or intercom_user_jwt is required to authenticate users when Messenger Security is enforced

 

Product

Segment

 

Cause

This error occurs when Intercom Messenger Security is turned on or enforced within your Intercom workspace settings. When this security setting is active, Intercom mandates that a signed JSON Web Token (JWT) or a user hash accompany client-side initialization to verify the user's identity. If your analytics.js implementation does not explicitly pass this token during setup or identity calls, the Intercom messenger widget will block authentication and throw this error.

 

Resolution

To resolve this issue, you must supply the signed JWT inside the integrations options parameter of your analytics.identify() call.

Follow these steps to update your implementation:

  1. Configure your backend server to generate a secure, signed JWT for the authenticated user according to Intercom's specification guidelines.

  2. Update your client-side tracking code to pass this token directly into the Intercom destination object within your analytics.identify call using either intercom_user_jwt or intercomUserJwt:

analytics.identify('user-id', {
  email: 'user@example.com'
}, {
  integrations: {
    Intercom: {
      intercom_user_jwt: 'YOUR_JWT_TOKEN_HERE'
    }
  }
});
  1. Leveraging the Intercom Web Mode (Actions) destination, ensure that your Identify User action mapping is configured to map this incoming custom integration option.

    • This is configured on the Identify User mapping that is created with the destination

Note: If you need to perform additional post-load tasks or manipulate the widget directly, you can wrap your logic using the analytics.ready() callback method, which ensures the Intercom instance has fully booted.

 

Note: A user hash can be passed in the same manner as the user JWT by replacing intercom_user_jwt with either user_hash or userHash.

 

Additional Information 

Have more questions? Submit a request
Powered by Zendesk