mergeContacts( )


Merges source contacts into a target contact.

Merging contacts has the following effects on the target contact:

  • No target contact data is overwritten or deleted.
  • Arrays (emails, phone numbers, addresses, and labels) from the source contacts are added to the target contact's arrays.
  • If you merge more than one source contact, the 1st source contact specified is added first, then the 2nd, and so on.
  • If there is duplicate information between the target contact and the source contact, the information isn't dupilcated in the target contact's arrays.

Important: Merges cannot be undone. In REST, call Preview Merge Contacts to test before merging.

When you merge contacts, source contacts are typically deleted. However, if a source contact is a site member or a Wix user, the merge will fail because site members and Wix users can't be deleted. This means that site members and Wix users can only be specified as target contacts in a merge.

After merging, calling Get Contact with a deleted source contact ID returns the target contact ID. Specifying a deleted source contact ID is not supported on any other method.

When contacts are merged:

  • The Contact Merged event is triggered.
  • The Contact Updated event is triggered for the target contact. originatedFrom is set to merge.
  • The Contact Deleted event is triggered for each source contact. originatedFrom is set to merge.
Authentication

You can only call this method when authenticated as a Wix app or Wix user identity.

Permissions
Manage Members and Contacts - all permissions
Manage Contacts
Manage Restaurants - 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 specified.


optionsMergeContactsOptions

Merge contacts options.

Returns
Return Type:Promise<MergeContactsResponse>
Did this help?