Appends contactInfo
to an existing contact or creates a new contact if it doesn't already exist.
The appendOrCreateContact()
function returns a Promise
that resolves to a contact ID and identity type when a contact is found or created.
When called, appendOrCreateContact()
accepts an object with contact information and follows the steps below.
When one of the conditions is met, this process ends and the specified
data is handled:
appendOrCreateContact()
reconciles with the member's associated contact.appendOrCreateContact()
tries to reconcile any specified email addresses and/or phone numbers with an existing contact.appendOrCreateContact()
reconciles with the new contact.appendOrCreateContact()
tries to reconcile the visitor's session identity with an existing contact.appendOrCreateContact()
does not require member authentication,
so it does not return the entire contact object.
The contact's data can be retrieved with
getContact()
.
If an existing contact is found:
emails
, addresses
, phones
, and labelKeys
.Note:
If the reconciled contact belongs to a member
who isn't currently logged in to the site,
identityType
is returned as "NOT_AUTHENTICATED_MEMBER"
.
In that case, no contact properties are modified.
If a new contact is created:
Contact's information. To reconcile with an existing contact, a phone or email must be provided, or the current session identity must be attached to a contact or member.
If no existing contact can be found, a new contact is created with the specified information.