Skip to workflow content
Vora
← Workflow library

Crm Hygiene

Prepare an email-based duplicate review

Prepare a review queue for contacts sharing a normalized email address. The packet preserves contact IDs, separates invalid addresses and leaves merge decisions with the operator.

Experimental native example · local preview · revision 1

WORKFLOW PREVIEW

See how it works

2 nodes · 1 connections

Use + and − to zoom, F to fit. Press Enter on a node to inspect it.

Private preview. These tested drafts are available for inspection. Adding them to a Vora workspace is still being tested.

What you need

  • An authorized export of at most 500 contacts with unique record IDs.
  • A reviewer who can inspect the source records and distinguish shared mailboxes from actual duplicates.
Follow the workflow step by step
  1. Supplied agency data

    Receive the explicitly supplied manual input packet.

  2. Prepare an email-based duplicate review

    Group contact IDs sharing a trimmed lowercase email and quarantine invalid addresses for review. No records are merged, deleted or persisted.

Setup and review

  • Supply contact IDs and emails in their original input order.
  • Test a case/whitespace collision, a unique address and an invalid address.
  • Inspect duplicateGroups and resolve identity in the CRM before considering any merge.

Inspect every node

Expand a node to inspect its complete settings. Review the runtime and adoption evidence before installing it.

Supplied agency data · wfManualTrigger
{
  "label": "Supplied agency data"
}
Prepare an email-based duplicate review · code
{
  "label": "Prepare an email-based duplicate review",
  "code": "\nfunction obj(value, keys, required = keys) {\n  if (!value || typeof value !== 'object' || Array.isArray(value)) throw new Error('Expected object');\n  if (Object.keys(value).some(key => !keys.includes(key))) throw new Error('Unknown input field');\n  if (required.some(key => !Object.hasOwn(value, key))) throw new Error('Missing required input field');\n  return value;\n}\nfunction text(value, name, max = 200, allowEmpty = false) {\n  if (typeof value !== 'string' || value.length > max || (!allowEmpty && !value.trim())) throw new Error('Invalid ' + name);\n  return value.trim();\n}\nfunction list(value, name, max = 500) {\n  if (!Array.isArray(value) || value.length > max) throw new Error('Invalid ' + name);\n  return value;\n}\nfunction int(value, name, min = 0, max = Number.MAX_SAFE_INTEGER) {\n  if (!Number.isSafeInteger(value) || value < min || value > max) throw new Error('Invalid ' + name);\n  return value;\n}\nfunction amount(value, name) {\n  if (!Number.isFinite(value) || value < 0 || value > 1000000000) throw new Error('Invalid ' + name);\n  return value;\n}\nfunction email(value) { return /^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value); }\nfunction day(value) {\n  if (typeof value !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}$/.test(value)) throw new Error('Invalid calendar date');\n  const ms = Date.parse(value + 'T00:00:00Z');\n  if (!Number.isFinite(ms) || new Date(ms).toISOString().slice(0, 10) !== value) throw new Error('Invalid calendar date');\n  return ms;\n}\nfunction instant(value) {\n  if (typeof value !== 'string' || !/^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}(\\.\\d{3})?Z$/.test(value)) throw new Error('Invalid UTC timestamp');\n  const ms = Date.parse(value);\n  const normalized = value.includes('.') ? value : value.replace('Z', '.000Z');\n  if (!Number.isFinite(ms) || new Date(ms).toISOString() !== normalized) throw new Error('Invalid UTC timestamp');\n  return ms;\n}\nfunction uniqueIds(items) {\n  const ids = items.map(item => text(item.id, 'item ID', 120));\n  if (new Set(ids).size !== ids.length) throw new Error('Duplicate item ID');\n  return ids;\n}\nfunction ratioBps(numerator, denominator) {\n  const n = BigInt(numerator) * 10000n;\n  const d = BigInt(denominator);\n  const quotient = n / d;\n  const floor = n < 0n && n % d !== 0n ? quotient - 1n : quotient;\n  const result = Number(floor);\n  if (!Number.isSafeInteger(result)) throw new Error('Unsafe calculated ratio');\n  return result;\n}\n\n\nconst x = obj(context.input, ['batchId','contacts']);\nconst batchId = text(x.batchId, 'batch ID', 120), contacts = list(x.contacts, 'contacts');\ncontacts.forEach(item => obj(item, ['id','email']));\nconst ids = uniqueIds(contacts), groups = new Map(), invalidContactIds = [];\ncontacts.forEach((item,index) => {\n  const address = text(item.email, 'email', 320, true).toLowerCase();\n  if (!email(address)) { invalidContactIds.push(ids[index]); return; }\n  if (!groups.has(address)) groups.set(address, []);\n  groups.get(address).push(ids[index]);\n});\nconst duplicateGroups = [], uniqueContactIds = [];\nfor (const [address,contactIds] of groups) {\n  if (contactIds.length > 1) duplicateGroups.push({email:address, contactIds});\n  else uniqueContactIds.push(contactIds[0]);\n}\nreturn {batchId, duplicateGroups, uniqueContactIds, invalidContactIds};\n",
  "outputVar": "result",
  "timeout": 1000,
  "memoryLimit": 16
}
Input and output contracts

Input

{
  "type": "object",
  "properties": {
    "batchId": {
      "type": "string",
      "maxLength": 120
    },
    "contacts": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "maxLength": 120
          },
          "email": {
            "type": "string",
            "maxLength": 320
          }
        },
        "required": [
          "id",
          "email"
        ],
        "additionalProperties": false
      },
      "maxItems": 500
    }
  },
  "required": [
    "batchId",
    "contacts"
  ],
  "additionalProperties": false
}

Output

{
  "type": "object",
  "properties": {
    "batchId": {
      "type": "string",
      "maxLength": 120
    },
    "duplicateGroups": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "email": {
            "type": "string",
            "maxLength": 320
          },
          "contactIds": {
            "type": "array",
            "items": {
              "type": "string",
              "maxLength": 120
            },
            "maxItems": 500
          }
        },
        "required": [
          "email",
          "contactIds"
        ],
        "additionalProperties": false
      },
      "maxItems": 500
    },
    "uniqueContactIds": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 120
      },
      "maxItems": 500
    },
    "invalidContactIds": {
      "type": "array",
      "items": {
        "type": "string",
        "maxLength": 120
      },
      "maxItems": 500
    }
  },
  "required": [
    "batchId",
    "duplicateGroups",
    "uniqueContactIds",
    "invalidContactIds"
  ],
  "additionalProperties": false
}

Choose an output for this job

This business workflow also has 15 delivery formats. Compare their inputs, output examples and limits.

Compare implementations for this job

Example input and result

These examples use synthetic data.

Input

{
  "batchId": "contacts-01",
  "contacts": [
    {
      "id": "c1",
      "email": " Team@Example.test "
    },
    {
      "id": "c2",
      "email": "team@example.test"
    },
    {
      "id": "c3",
      "email": "other@example.test"
    }
  ]
}

Expected result

{
  "batchId": "contacts-01",
  "duplicateGroups": [
    {
      "email": "team@example.test",
      "contactIds": [
        "c1",
        "c2"
      ]
    }
  ],
  "uniqueContactIds": [
    "c3"
  ],
  "invalidContactIds": []
}

Success means: Group contact IDs sharing a trimmed lowercase email and quarantine invalid addresses for review. No records are merged, deleted or persisted.

When something goes wrong

  • Repeated contact IDs stop the batch. Fix the export identity and repeat. Invalid addresses are listed separately for correction. A collision is a review signal; it must never authorize deletion or merging on its own.

Limits and costs

  • Normalization only trims whitespace and lowercases the address. It does not strip plus tags, dots or apply provider-specific alias rules. No CRM record changes.
  • No paid model calls or metered third-party operations are declared in this pure graph. Vora plan availability, compute and quotas still apply; pricing has not been verified by this batch.

USE IN VORA

Prepare an email-based duplicate review

Review this workflow’s steps and required inputs. Get access to Vora before setting it up in your workspace.

Workspace installation is being connected. This page lets you inspect the workflow; it does not create or run one.

Required input fields
{
  "additionalProperties": false,
  "properties": {
    "batchId": {
      "maxLength": 120,
      "type": "string"
    },
    "contacts": {
      "items": {
        "additionalProperties": false,
        "properties": {
          "email": {
            "maxLength": 320,
            "type": "string"
          },
          "id": {
            "maxLength": 120,
            "type": "string"
          }
        },
        "required": [
          "id",
          "email"
        ],
        "type": "object"
      },
      "maxItems": 500,
      "type": "array"
    }
  },
  "required": [
    "batchId",
    "contacts"
  ],
  "type": "object"
}