{
  "id": "087IgnQi8H0zFN2e",
  "name": "Tomba - Lead Callback Tracker",
  "tags": [],
  "nodes": [
    {
      "id": "9e87fdad-6f63-42da-b191-8c2df5b01ce8",
      "name": "Sticky Note",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -608,
        -176
      ],
      "parameters": {
        "width": 480,
        "height": 864,
        "content": "## Tomba - Lead Callback Tracker\n\n### How it works\n\nThis workflow receives lead data through a webhook and processes each lead in sequence. For every lead, it searches Tomba for phone information by domain, formats the result, updates a Google Sheet, and notifies a sales representative in Slack. The Slack step loops back to continue processing remaining leads until the batch is complete.\n\n### Setup steps\n\n- Configure the Webhook URL and ensure incoming payloads include the lead fields required by the Tomba lookup and formatting code.\n- Connect Tomba credentials and verify the lookup is configured to use the correct domain field from each lead.\n- Connect Google Sheets credentials and select the target spreadsheet, sheet, and row-matching or update behavior.\n- Connect Slack credentials and configure the destination channel or representative mapping for notifications.\n- Review the code node to confirm it formats the Tomba response into the exact fields expected by Google Sheets and Slack.\n\n### Customization\n\nAdjust the batch size in the loop, change the Tomba lookup field, modify the formatting code for custom lead properties, or route Slack messages to different reps based on territory, company size, or lead owner."
      },
      "typeVersion": 1
    },
    {
      "id": "6894baf2-d032-43cc-956d-aa0b30be20cc",
      "name": "Sticky Note1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -48,
        -176
      ],
      "parameters": {
        "color": 7,
        "width": 432,
        "height": 336,
        "content": "## Receive and iterate leads\n\nStarts the workflow from an incoming webhook request and feeds the submitted leads into a batch loop so each lead can be processed one at a time."
      },
      "typeVersion": 1
    },
    {
      "id": "1cc7afb6-354d-4723-a084-a0628a51b49b",
      "name": "Sticky Note2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        432,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 336,
        "content": "## Enrich lead contact data\n\nLooks up phone information for each lead using Tomba based on the lead domain, then formats the returned data for downstream storage and notification steps."
      },
      "typeVersion": 1
    },
    {
      "id": "7b5690b8-3087-4d94-82aa-0ad4605dfa37",
      "name": "Sticky Note3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        880,
        -160
      ],
      "parameters": {
        "color": 7,
        "width": 400,
        "height": 336,
        "content": "## Update sheet and notify\n\nWrites the enriched lead details back to Google Sheets and sends a Slack notification to the assigned representative before returning control to the loop for the next lead."
      },
      "typeVersion": 1
    },
    {
      "id": "291f1435-f240-4c82-98df-975de55157ee",
      "name": "Batch Process Leads",
      "type": "n8n-nodes-base.splitInBatches",
      "position": [
        240,
        0
      ],
      "parameters": {
        "options": {}
      },
      "typeVersion": 3
    },
    {
      "id": "87f61e73-8eea-4f3d-88be-7a7341b7c833",
      "name": "Lookup Phone by Domain",
      "type": "n8n-nodes-tomba.tomba",
      "position": [
        480,
        16
      ],
      "parameters": {
        "full": true,
        "domain": "={{ $json.body[\"Company domain\"] }}",
        "resource": "phone",
        "phoneSearchType": "domain"
      },
      "credentials": {},
      "typeVersion": 1
    },
    {
      "id": "19783487-4f96-4021-89b6-daf507a78130",
      "name": "Format Leads for Sheets",
      "type": "n8n-nodes-base.code",
      "position": [
        688,
        16
      ],
      "parameters": {
        "jsCode": "const webhookData = $('When Data Posted to Webhook').first().json.body;\nconst phoneData = $input.first().json;\n\nconst fullName = webhookData[\"Full name\"] || \"\";\nconst email = webhookData[\"Email\"] || \"\";\nconst companyName = webhookData[\"Company name\"] || \"\";\nconst companyDomain = webhookData[\"Company domain\"] || \"\";\n\nconst phone = phoneData.intl_format || \"Not Found\";\nconst phoneValid = phoneData.valid || false;\n\nreturn [{\n  json: {\n    full_name: fullName,\n    email: email,\n    company: companyName,\n    domain: companyDomain,\n    phone: phone,\n    phone_valid: phoneValid,\n    country_code: phoneData.country_code || \"\",\n    line_type: phoneData.line_type || \"\",\n    slack_notified: \"Yes\",\n    status: phoneValid ? \"Contacted\" : \"No Phone Found\",\n    slack_message: `\ud83d\udd25 *New Lead Alert!*\\n*Name:* ${fullName}\\n*Company:* ${companyName}\\n*Email:* ${email}\\n*Domain:* ${companyDomain}\\n*Phone:* ${phone}\\n\\nCall them NOW! \u260e\ufe0f`\n  }\n}];"
      },
      "typeVersion": 2
    },
    {
      "id": "2b3f7f90-4b9a-4a9d-a19b-c697533edb1b",
      "name": "Update Lead Info in Sheets",
      "type": "n8n-nodes-base.googleSheets",
      "position": [
        928,
        16
      ],
      "parameters": {
        "columns": {
          "value": {
            "Phone": "={{ $json.phone }}",
            "Domain": "={{ $('Batch Process Leads').item.json.Domain }}",
            "Status": "={{ $json.status }}",
            "Slack Notified": "={{ $json.slack_notified }}"
          },
          "schema": [
            {
              "id": "Full Name",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Full Name",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Email",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Email",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Company",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Company",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Domain",
              "type": "string",
              "display": true,
              "removed": false,
              "required": false,
              "displayName": "Domain",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Phone",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Phone",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Slack Notified",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Slack Notified",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "Status",
              "type": "string",
              "display": true,
              "required": false,
              "displayName": "Status",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            },
            {
              "id": "row_number",
              "type": "number",
              "display": true,
              "removed": true,
              "readOnly": true,
              "required": false,
              "displayName": "row_number",
              "defaultMatch": false,
              "canBeUsedToMatch": true
            }
          ],
          "mappingMode": "defineBelow",
          "matchingColumns": [
            "Domain"
          ],
          "attemptToConvertTypes": false,
          "convertFieldsToString": false
        },
        "options": {},
        "operation": "update",
        "sheetName": {
          "__rl": true,
          "mode": "list",
          "value": "gid=0",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QcEvBG5WqHxfEvSzKifykfJPQKlf8Ql608izRwiW9SA/edit#gid=0",
          "cachedResultName": "leads"
        },
        "documentId": {
          "__rl": true,
          "mode": "list",
          "value": "1QcEvBG5WqHxfEvSzKifykfJPQKlf8Ql608izRwiW9SA",
          "cachedResultUrl": "https://docs.google.com/spreadsheets/d/1QcEvBG5WqHxfEvSzKifykfJPQKlf8Ql608izRwiW9SA/edit?usp=drivesdk",
          "cachedResultName": "Tomba - Lead Callback Tracker"
        }
      },
      "typeVersion": 4.7
    },
    {
      "id": "2bc3bc4d-fe61-43d2-ba80-a31b8dfdc50e",
      "name": "Alert Rep via Slack",
      "type": "n8n-nodes-base.slack",
      "position": [
        1136,
        16
      ],
      "parameters": {
        "text": "={{ $('Format Leads for Sheets').item.json.slack_message }}",
        "select": "channel",
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "otherOptions": {}
      },
      "typeVersion": 2.4
    },
    {
      "id": "bf5291e0-7c6c-4b8b-a9cf-c2b785c882fd",
      "name": "When Data Posted to Webhook",
      "type": "n8n-nodes-base.webhook",
      "position": [
        0,
        0
      ],
      "parameters": {
        "path": "GHL",
        "options": {},
        "httpMethod": "POST"
      },
      "typeVersion": 2.1
    }
  ],
  "active": false,
  "settings": {
    "binaryMode": "separate",
    "executionOrder": "v1"
  },
  "versionId": "cd3f3b50-655e-4594-8e37-3bb77bc8a09b",
  "nodeGroups": [],
  "connections": {
    "Alert Rep via Slack": {
      "main": [
        [
          {
            "node": "Batch Process Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Batch Process Leads": {
      "main": [
        [],
        [
          {
            "node": "Lookup Phone by Domain",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Lookup Phone by Domain": {
      "main": [
        [
          {
            "node": "Format Leads for Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Format Leads for Sheets": {
      "main": [
        [
          {
            "node": "Update Lead Info in Sheets",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Update Lead Info in Sheets": {
      "main": [
        [
          {
            "node": "Alert Rep via Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Data Posted to Webhook": {
      "main": [
        [
          {
            "node": "Batch Process Leads",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}