The four kinds
external_id, email and phone become identities on their own. You do not
need the identities array for them. Use that array for a channel handle, or
for a second email address.
Normalization
Kai stores an identity in one form, and matches on that form:- an email address becomes lowercase;
- a phone number keeps its digits only, and loses a
00prefix; - an
externalvalue and achannelvalue keep their case, because they belong to another system.
This is why a WhatsApp conversation and a contact from your CRM meet on the
same record.
Match order
Kai reads the identities in the request and finds the contacts that hold them:- no contact holds any of them: Kai creates a contact, and gives it every identity in the request;
- one contact holds one or more of them: Kai updates that contact, and adds the identities that it does not hold yet;
- two contacts hold them: Kai refuses the write.
Conflicts
The third case returns 409 and names the identities:Send at least one identity
POST /contacts refuses a request that carries no identity. Without one, Kai
has nothing to match on, and a job that runs twice would make a second copy of
every person.