Duplicate contact when apply Intercom messenger | Community
Skip to main content

We've integrated Intercom Messenger into our web application, using JWTs for authenticated users.

The backend flow is designed to find or create an Intercom contact for each user. If a contact doesn't exist, it's created with:
{
  "user_id": "intercomContactId",
  "name": "our_user_email",
  "email": "our_user_email",
  "external_id": "userId_in_our_system"
}
This data is then included in the JWT sent to the frontend. The problem is that after several frontend reloads, Intercom creates multiple new contacts with the same user information.
 

Hey ​@Thinh Tran 👋 Jacques here from Intercom Support. I hope all is well today!

Here are some things that could help you with this duplicate user issue:

  • First, ensure that the user_id in your JWT exactly matches the user_id in your user data. Also confirm your user_id is consistently a string (Intercom expects strings)
  • You could also implement proper JWT refresh logic to prevent fallback to session cookies
  • Ensure Intercom is only booted once per page loa

By implementing these steps, you should be able to prevent the creation of duplicate contacts in Intercom.

If the issue persists, I’d recommend reaching out to our support team so they can have a deeper look at your workspace and what is causing issues!