Skip to main content

Hi,

We are currently integrating the chat SDK into our apps, and while reviewing the documentation, we came across the Identify Users page.

We have a few questions regarding the use of userId for identification, as we do not have user phone numbers in all cases and were hoping to use userId instead of email.

Specifically, we would like clarification on the following:

  1. What is the userId?

    • Is it an ID that we define within our system, or is it the contact ID generated by Front?
  2. Behavior when using a custom userId:

    • If the userId is defined by us, will Front create a new contact when it encounters the userId for the first time, regardless of the email or phone provided in the contact object?
    • If so, how can we prevent the creation of duplicate contacts? We already have a large number of contacts in Front and want to avoid duplication.
  3. Behavior when userId is defined by Front:

    • If the userId is generated by Front, will it simply add the email and phone provided in the contact object to the existing contact?

Having complete clarity on how userId works would be extremely helpful for us in implementing this integration effectively.

Thank you in advance for your assistance!

What is the userId?

Whatever you want, as long as it is consistent. Commonly, developers will set the userId as the logged-in user’s ID from their application (given that emails can change, where a user ID tends to be a persistent and unique identifier). 

 

If the userId is defined by us, will Front create a new contact when it encounters the userId for the first time, regardless of the email or phone provided in the contact object?

 

Front Contact records effectively have two parts; “Contact” and “Contact Handles” - a whole Contact is made up of contact details (name, custom fields, etc), and any number of contact handles.

When you use a `userId` to identify a Front Chat recipient, Front creates a new Front-Chat type Contact Handle, with that ID as the identifier. You can of course also pass an email with the identified contact details. Front deduplicates Contact records based on email and phone handles (no two contacts records can share an email or phone). 
So for an example, if you have an existing Contact with email: jason@example.com, then that user chats in via verified chat; the new Front Chat handle will be added to the existing jason@example.com contact record. 

 

How can we avoid duplicate contacts?

 

If possible, use integrations like our CRM Sync tools to ensure contacts already exist in Front. If a verified user starts a chat (and you send their email!) that chat will be linked to the existing contact profile. 

Front will not create duplicates, provided you send the user’s email with the chat identify info.

 

Hope that helps!


How can we send the phone number to the identity method?


Also, it’d be awesome if you guys open/public sourced your integrations so that people can borrow logic. I had to write 100s of lines to get it to work and there was a lot of trial and error involved.


Sending a phone number in the identity call not supported at present ( but feel free to submit a request to support that here https://community.front.com/ideas )

 

Regarding open-sourcing integrations, was there anything specific you were building that you would like to have had examples for?

 

Thanks


Sending a phone number in the identity call not supported at present

Can we set the chat handle by the contacts Core API and use the same one in chat SDK to avoid duplication? If so, what will be the name of the handle source? can’t find it in the docs.   https://dev.frontapp.com/reference/contacts


Unfortunately not - the front_chat type contact handle is reserved as read-only via the API, so it can only be set by new chats being received. 


Regarding open-sourcing integrations, was there anything specific you were building that you would like to have had examples for?

Adding handles to existing contacts and just deduping the contacts. I eventually figured it out.

But, it’ll be nice to copy the code directly or ask AI to translate it to another language.


Reply