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.