Thank you for bringing up this important issue about duplicate user creation. This is actually a known behavior in Intercom that can occur due to several technical reasons. Let me explain what's happening and how to address it.
Why Duplicates Are Created
Intercom's user identification system works with multiple identifiers: email, user_id, and anonymous_id. Duplicates can be created in these scenarios:
If you have an existing user with an email but no user_id, and you make a request with both the same email AND a new user_id, Intercom may create a new user instead of updating the existing one. This is by design to prevent accidental data merging.
When multiple API calls happen simultaneously (which is common in high-traffic applications), two requests might try to create the same user at nearly the same time. The first request might not complete before the second one starts, causing both to think the user doesn't exist.
Sometimes when you search by email to get the Intercom ID, the API call might:
- Time out
- Return an error
- Have temporary connectivity issues
- Face rate limiting
In these cases, your script doesn't get the ID back even though the user exists, so it creates what it thinks is a "new" contact.
Some SDKs implement local caching that might not be immediately updated when users are created through other channels, leading to stale data.
Solutions & Best Practices
Immediate Fixes:
- Implement Retry Logic: Add retry mechanisms with exponential backoff when searching for users
- Use Robust Error Handling: Check for specific error types and handle them appropriately
- Implement Proper Logging: Log all user creation attempts to identify patterns
API Best Practices:
-
Use Consistent Identifiers: Always use the same combination of identifiers (email + user_id)
-
Implement Idempotency: Make your user creation calls idempotent by checking multiple times
-
Handle Rate Limits: Implement proper rate limiting and retry logic
-
Use Webhooks: Consider using Intercom webhooks to get notified of user events instead of polling
// Pseudo-code for robust user handling
async function findOrCreateUser(email, userId) {
try {
// First attempt - search with retry logic
let user = await searchUserWithRetry(email, userId);
if (user) return user;
// If not found, attempt creation
return await createUserWithRetry(email, userId);
} catch (error) {
// Log and handle specific error types
handleUserCreationError(error, email, userId);
}
}
Prevention Strategies:
- Regular Duplicate Cleanup: Implement a process to regularly identify and merge duplicates
- Monitoring: Set up alerts for unusual duplicate creation patterns
- User Journey Mapping: Review your user onboarding flow to identify duplicate creation points
The reason duplicates are entering your onboarding series is likely because they're being treated as "new" users. You can prevent this by:
- Adding filters to your onboarding series based on user creation date vs. account age
- Using custom attributes to track actual user lifecycle stage
- Implementing duplicate detection before triggering campaigns
@Anastasia Markina - I noticed you started a conversation with Fin but didn't respond in time for it to reach a human agent. Did you see Fin's reply, and is everything working properly on your end?
This is definitely a solvable issue, and with the right implementation patterns, you can significantly reduce duplicate creation. The key is implementing robust error handling and retry logic in your integration code.
Hope this helps! Let me know if you need clarification on any of these points.
It is best to reach out to us directly via Messenger in your workspaces so we can definitely investigate why duplicates are created in your particular situation.
Although issue with user duplicates might seem similar in both Ines and Anastasia workspaces the root cause might be totally different in those cases.