mergeContacts( )


Merges source contacts into a target contact.

Merging contacts has these effects on the target contact:

  • No target contact data is overwritten or deleted.
  • Arrays (emails, phones, addresses, and labels) are merged from the source contacts into the target contact.
  • If merging more than one source contact, the 1st source is given precedence, then the 2nd, and so on.

Source contacts are deleted when merging. However, if a source contact is a site member or collaborator, the mergeContacts() function fails because site collaborators and members can't be deleted. Site members and collaborators can only be target contacts.

After merging, if you call the getContact() function with a deleted source contact ID, the target contact ID is returned. This is only supported when calling getContact(). Previously deleted source contact IDs can't be passed in any other function.

Authentication

This function requires elevated permissions and runs only on the backend and on dashboard pages.

Permissions
Manage Contacts
Manage Members and Contacts - all permissions
Learn more about app permissions.
Method Declaration
Copy
Method Parameters
targetContactIdstringRequired

Target contact ID.


targetContactRevisionnumberRequired

Target contact revision number, which increments by 1 each time the contact is updated. To prevent conflicting changes, the target contact's current revision must be passed.


optionsMergeContactsOptions

Merge contacts options.

Returns
Return Type:Promise<MergeContactsResponse>
Was this helpful?
Yes
No