Merging duplicates

Merging duplicates

Mocca does not merge contacts on its own. It lists pairs of contacts that share an email address or a phone number in the Dedup Candidate list, a person reviews them, and only the approved ones are merged.

To review the duplicate list

You need the System Manager or Sales Manager role.

  1. Open /app/dedup-candidate.
  2. Filter by Status = pending (pairs) or needs_review (larger groups, see below).
  3. Open a row. Primary Contact is the older contact, the one that stays. Duplicate Contact is the one that would be merged into it. Reason shows what they share, for example email:ana.lopez@example.com.
  4. Open both contacts (from the Desk or the CRM) and compare them.
  5. Set Status to approved if they are the same person, or rejected if they are not. Save.

Rows left as pending or needs_review are never merged.

Groups that need a closer look

Some shared keys are held back as one needs_review row for the whole group instead of one row per pair:

  • an email or phone shared by more than five contacts, which is usually a shared office or family address;
  • a placeholder-looking phone number, such as a run like 1234567890.

The row lists every member in Members, oldest first, with Group Size. Approving it merges every member into the oldest one, so check them all.

Running the merge

An administrator runs the merge job after the review. It merges only approved rows and sets each to merged (or failed, with the reason in Message). A row that is merged, rejected or failed is never merged again. Pairs found during that run are added as new pending rows for the next review.

What a merge keeps

When a duplicate is merged into the primary contact:

  • Emails, phones and links the primary did not have are copied over as extra rows.
  • External ids the primary did not have move over. If both contacts hold a different id for the same system, the merge stops for that pair: they are probably two people.
  • Consent: the primary’s opt-in flags and source win, and a merge never turns an opt-in on. If either contact is unsubscribed, the merged contact is unsubscribed.
  • Attribution: the earliest first touch and the latest last touch are kept.
  • Name and status stay the primary’s. Middle and last name, company, job title, department, photo and linked user come from the duplicate only where the primary has none.
  • Orders, attendance, tickets and everything else that pointed to the duplicate now point to the primary. The duplicate is deleted, and a snapshot of it is kept on the Dedup Candidate row.