{
  "name": "Visitor to meeting (New Theory template)",
  "nodes": [
    {
      "parameters": {
        "content": "## Visitor to meeting: n8n starter\nFree template from New Theory (newtheory.marketing). Built from our playbook records. It is not an official n8n, HubSpot or Zapier template. Every credential is a placeholder: connect your own before you turn it on.\n\n**Fill in, in this order**\n1. **Visitor identified**: publish, copy the Production URL, add `?token=` and a long random string, and paste it into your visitor ID tool's webhook. The test URL only works while the editor listens.\n2. **Token matches?**: paste the same string.\n3. **Fit filter**: set your company size range and the pages to skip.\n4. **Enrich**: add a Header Auth credential named X-Api-Key with your People Data Labs key.\n5. **Upsert person in Attio**: Header Auth, Authorization = `Bearer <token>`.\n6. **Add to lemlist**: Basic Auth with an empty user and your API key as the password, plus your campaign ID.\n7. **Slack**: connect it and pick #hot-accounts.\n\nField names follow the visitor ID payload (Business Email, Captured URL, LinkedIn URL). Check them against one test event.",
        "height": 460,
        "width": 560,
        "color": 4
      },
      "id": "9bc79070-574a-45bb-a788-8363e1a8ac1e",
      "name": "Start here",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -60
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "visitor-to-meeting",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "1ce5beed-031a-4a35-abd3-e7fa443011d3",
      "name": "Visitor identified",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        500
      ],
      "webhookId": "cf804cdc-eba3-442b-a305-dd41bfb32ae0"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "e684cf7a-d8f9-4bb6-aba7-55eadc568862",
              "leftValue": "={{ $json.query.token }}",
              "rightValue": "REPLACE_WITH_LONG_RANDOM_TOKEN",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "88331c02-4751-498c-a269-2bf19ba4f6fd",
      "name": "Token matches?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        220,
        500
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "ae3cbe14-054c-4040-afeb-d8513c394517",
              "leftValue": "={{ $json.body['Business Email'] }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            },
            {
              "id": "eae4325a-7511-4496-ac09-87ed76ea4dfc",
              "leftValue": "={{ Number($json.body['Employee Count']) || 0 }}",
              "rightValue": 20,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            },
            {
              "id": "ec7ce4ae-b7e2-4314-ae05-6b0f551d2c47",
              "leftValue": "={{ Number($json.body['Employee Count']) || 0 }}",
              "rightValue": 500,
              "operator": {
                "type": "number",
                "operation": "lte"
              }
            },
            {
              "id": "9cdaee35-bf26-4094-a0b4-480f47703d12",
              "leftValue": "={{ String($json.body['Captured URL'] || '') }}",
              "rightValue": "careers",
              "operator": {
                "type": "string",
                "operation": "notContains"
              }
            },
            {
              "id": "04e29b01-b0b0-422c-a230-32224b41c173",
              "leftValue": "={{ String($json.body['Captured URL'] || '') }}",
              "rightValue": "support",
              "operator": {
                "type": "string",
                "operation": "notContains"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "50ac3ba3-21a8-42fd-ab0b-52b907ddb288",
      "name": "Fit filter",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        440,
        500
      ]
    },
    {
      "parameters": {
        "method": "GET",
        "url": "https://api.peopledatalabs.com/v5/person/enrich",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "profile",
              "value": "={{ $json.body['LinkedIn URL'] }}"
            },
            {
              "name": "min_likelihood",
              "value": "6"
            },
            {
              "name": "data_include",
              "value": "full_name,job_title,job_company_name,job_company_size,industry"
            }
          ]
        },
        "options": {}
      },
      "id": "747d9bd1-e46d-45a2-a7d9-1334dc2fdc12",
      "name": "Enrich with People Data Labs",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        660,
        480
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "replace-me",
          "name": "People Data Labs (Header Auth: X-Api-Key)"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "5c351c94-651c-47e9-a03b-688c004307b5",
              "leftValue": "={{ $json.status }}",
              "rightValue": 200,
              "operator": {
                "type": "number",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "7bcb2b8d-21b4-4b7b-a986-68827a3513b1",
      "name": "Strong match?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        880,
        480
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "6c9fda98-58ea-4d4f-af8a-3eb72a49405a",
              "name": "email",
              "value": "={{ String($('Visitor identified').item.json.body['Business Email'] || '').trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "075ddebf-783c-4f2d-a89a-7fc2fe65be3d",
              "name": "first_name",
              "value": "={{ $('Visitor identified').item.json.body['First Name'] }}",
              "type": "string"
            },
            {
              "id": "f3f6bdb0-a760-4009-a835-f7ea13ae205e",
              "name": "last_name",
              "value": "={{ $('Visitor identified').item.json.body['Last Name'] }}",
              "type": "string"
            },
            {
              "id": "0b3fee2e-57ee-40df-ae53-74a97adbbd6d",
              "name": "title",
              "value": "={{ $json.data?.job_title }}",
              "type": "string"
            },
            {
              "id": "d3d7c969-f7e6-4adc-aa99-f5dc1cd5347c",
              "name": "company",
              "value": "={{ $json.data?.job_company_name }}",
              "type": "string"
            },
            {
              "id": "151b9365-62d3-4854-a456-27d9dd57edc0",
              "name": "page",
              "value": "={{ $('Visitor identified').item.json.body['Captured URL'] }}",
              "type": "string"
            },
            {
              "id": "7d2cc317-7ee6-4bb2-a033-d980e1946d07",
              "name": "seen_at",
              "value": "={{ $('Visitor identified').item.json.body['Seen At'] }}",
              "type": "string"
            },
            {
              "id": "ec90b354-2a06-4c76-ae60-0e6bb9449fdc",
              "name": "linkedin_url",
              "value": "={{ $('Visitor identified').item.json.body['LinkedIn URL'] }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "ee45e333-6149-42a6-a4b4-a469330da4aa",
      "name": "Shape the record",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1100,
        460
      ]
    },
    {
      "parameters": {
        "method": "PUT",
        "url": "https://api.attio.com/v2/objects/people/records",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "matching_attribute",
              "value": "email_addresses"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"data\": {\n    \"values\": {\n      \"email_addresses\": [\"{{ $json.email }}\"],\n      \"name\": [{ \"first_name\": \"{{ $json.first_name }}\", \"last_name\": \"{{ $json.last_name }}\", \"full_name\": \"{{ $json.first_name }} {{ $json.last_name }}\" }],\n      \"last_page_viewed\": \"{{ $json.page }}\"\n    }\n  }\n}",
        "options": {}
      },
      "id": "9c2392ec-0149-4f25-ab6a-9f6e30f6eda2",
      "name": "Upsert person in Attio",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1320,
        460
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "replace-me",
          "name": "Attio token (Header Auth: Authorization = Bearer <token>)"
        }
      }
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.lemlist.com/api/campaigns/REPLACE_WITH_CAMPAIGN_ID/leads/",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpBasicAuth",
        "sendQuery": true,
        "queryParameters": {
          "parameters": [
            {
              "name": "deduplicate",
              "value": "true"
            }
          ]
        },
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"email\": \"{{ $('Shape the record').item.json.email }}\",\n  \"firstName\": \"{{ $('Shape the record').item.json.first_name }}\",\n  \"lastName\": \"{{ $('Shape the record').item.json.last_name }}\",\n  \"companyName\": \"{{ $('Shape the record').item.json.company }}\",\n  \"topic\": \"{{ $('Shape the record').item.json.page }}\"\n}",
        "options": {}
      },
      "id": "2680bbc5-bd5b-445e-a362-979ac5a5ebe5",
      "name": "Add to lemlist campaign",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1560,
        360
      ],
      "credentials": {
        "httpBasicAuth": {
          "id": "replace-me",
          "name": "lemlist (Basic Auth: empty user, API key as password)"
        }
      },
      "onError": "continueRegularOutput"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "fd4370be-4ee0-4f6c-a76b-986958ddda2b",
              "leftValue": "={{ String($('Shape the record').item.json.page || '') }}",
              "rightValue": "pricing",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            },
            {
              "id": "3b7313f8-5cf3-4d82-a21a-63fd35d79411",
              "leftValue": "={{ String($('Shape the record').item.json.page || '') }}",
              "rightValue": "demo",
              "operator": {
                "type": "string",
                "operation": "contains"
              }
            }
          ],
          "combinator": "or"
        },
        "options": {}
      },
      "id": "f2c2a328-9edf-430a-af9c-4562ba066d5f",
      "name": "Hot page?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1560,
        580
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#hot-accounts",
          "mode": "name"
        },
        "text": "=Hot account: *{{ $('Shape the record').item.json.company }}*\n{{ $('Shape the record').item.json.first_name }} {{ $('Shape the record').item.json.last_name }}, {{ $('Shape the record').item.json.title }}\nRead {{ $('Shape the record').item.json.page }} at {{ $('Shape the record').item.json.seen_at }}\nOwner: REPLACE_WITH_OWNER. Profile: {{ $('Shape the record').item.json.linkedin_url }}",
        "otherOptions": {}
      },
      "id": "828f9328-6212-4575-a169-ad0ec80be748",
      "name": "Post to #hot-accounts",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1800,
        560
      ],
      "credentials": {
        "slackApi": {
          "id": "replace-me",
          "name": "Slack (connect yours)"
        }
      }
    },
    {
      "parameters": {
        "content": "### Before the sequence starts\n- Look up the person in your CRM first and stop if they are a customer or in an open deal.\n- One writer per CRM: don't run a native sync and this workflow on the same records.\n- Every email needs an unsubscribe option and your postal address. Put both in the lemlist footer.\n- Keep LinkedIn out of every automated step. Use the profile link so a person can read it.\n- Person-level matches cover US visitors only.",
        "height": 260,
        "width": 500,
        "color": 3
      },
      "id": "f916210b-6476-4b01-acb2-5073c5fe64db",
      "name": "Before you send",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1300,
        760
      ]
    }
  ],
  "connections": {
    "Visitor identified": {
      "main": [
        [
          {
            "node": "Token matches?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token matches?": {
      "main": [
        [
          {
            "node": "Fit filter",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fit filter": {
      "main": [
        [
          {
            "node": "Enrich with People Data Labs",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enrich with People Data Labs": {
      "main": [
        [
          {
            "node": "Strong match?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Strong match?": {
      "main": [
        [
          {
            "node": "Shape the record",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape the record": {
      "main": [
        [
          {
            "node": "Upsert person in Attio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert person in Attio": {
      "main": [
        [
          {
            "node": "Add to lemlist campaign",
            "type": "main",
            "index": 0
          },
          {
            "node": "Hot page?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Hot page?": {
      "main": [
        [
          {
            "node": "Post to #hot-accounts",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
