{
  "name": "Speed to lead (New Theory template)",
  "nodes": [
    {
      "parameters": {
        "content": "## Speed to lead: 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. **Form submitted**: publish the workflow, copy the Production URL and paste it into your form tool's webhook (or any form that can POST). Add `?token=` and a long random string to the end.\n2. **Token matches?**: paste the same random string where it says REPLACE_WITH_LONG_RANDOM_TOKEN.\n3. **Shape the lead**: change `body.email`, `body.company` and the rest to your form's field names.\n4. **Upsert person in Attio**: add a Header Auth credential named Authorization with the value `Bearer <your Attio token>`. Using another CRM? Swap the URL and body for its upsert call.\n5. **Larger team?**: set your own team size line and owner Slack IDs.\n6. **Slack**: connect Slack and pick the channel.\n\nProduction runs show in the Executions tab, not in the editor.",
        "height": 420,
        "width": 560,
        "color": 4
      },
      "id": "2d5a31ee-19a0-4214-af78-51e115674aaf",
      "name": "Start here",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        -60,
        -40
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "speed-to-lead",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "a0c0320d-9fd7-486e-a15a-0433211f1823",
      "name": "Form submitted",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        460
      ],
      "webhookId": "689624b4-de52-436e-abb6-f2717480c085"
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "b522b9d3-6b6a-451c-a9c8-72eccccc5670",
              "leftValue": "={{ $json.query.token }}",
              "rightValue": "REPLACE_WITH_LONG_RANDOM_TOKEN",
              "operator": {
                "type": "string",
                "operation": "equals"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "fc2a9596-2be7-4df4-a9e7-1305aad27e1d",
      "name": "Token matches?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        220,
        460
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "5b5007aa-84d0-446c-a755-79848c744a10",
              "name": "email",
              "value": "={{ String($json.body.email || '').trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "01aea9ca-f508-4f7b-a3b2-f9cf92ecc750",
              "name": "first_name",
              "value": "={{ $json.body.first_name }}",
              "type": "string"
            },
            {
              "id": "96dc28df-3a15-49dc-a656-791c2343ac3e",
              "name": "last_name",
              "value": "={{ $json.body.last_name }}",
              "type": "string"
            },
            {
              "id": "7e850afe-8a18-4c1b-ab91-b2e7158fabd7",
              "name": "company",
              "value": "={{ $json.body.company }}",
              "type": "string"
            },
            {
              "id": "d89bd68a-e894-47f6-a015-e7721e8584e1",
              "name": "team_size",
              "value": "={{ Number($json.body.team_size) || 0 }}",
              "type": "number"
            },
            {
              "id": "b9a48e28-886f-4b08-a428-0c9fd0eb08c7",
              "name": "source_form",
              "value": "Demo request",
              "type": "string"
            },
            {
              "id": "b6683f2a-576f-47bc-a4ce-0f05881f3a85",
              "name": "submitted_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "bedf32d3-19e1-4887-aa77-4bd7a6227e72",
      "name": "Shape the lead",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        440,
        440
      ]
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "481861c0-2afc-426a-a5d3-0876cd7a484e",
              "leftValue": "={{ $json.email }}",
              "rightValue": "",
              "operator": {
                "type": "string",
                "operation": "notEmpty",
                "singleValue": true
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "e6c1571b-3f09-4982-a5bf-40342b7eb931",
      "name": "Has an email?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        660,
        440
      ]
    },
    {
      "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      \"source_form\": \"{{ $json.source_form }}\",\n      \"team_size\": {{ $json.team_size }}\n    }\n  }\n}",
        "options": {}
      },
      "id": "26d357ca-20b7-413e-aea5-8c2b201ff388",
      "name": "Upsert person in Attio",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        880,
        420
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "replace-me",
          "name": "Attio token (Header Auth: Authorization = Bearer <token>)"
        }
      }
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "caseSensitive": true,
            "leftValue": "",
            "typeValidation": "loose"
          },
          "conditions": [
            {
              "id": "8fcfb695-cf52-4e89-a7f9-f81782e1e970",
              "leftValue": "={{ $('Shape the lead').item.json.team_size }}",
              "rightValue": 50,
              "operator": {
                "type": "number",
                "operation": "gte"
              }
            }
          ],
          "combinator": "and"
        },
        "options": {}
      },
      "id": "1cba0fad-5075-4b23-a16c-ccc56313ef64",
      "name": "Larger team?",
      "type": "n8n-nodes-base.if",
      "typeVersion": 2,
      "position": [
        1100,
        420
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "93af31de-74d5-435f-a858-66ae3ad0fc35",
              "name": "owner_slack_id",
              "value": "REPLACE_WITH_SLACK_MEMBER_ID_A",
              "type": "string"
            },
            {
              "id": "314fc529-73e1-4321-ad96-a564841e8ce1",
              "name": "owner_name",
              "value": "REPLACE_WITH_REP_A",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "00fa273e-9f41-426c-a887-c97f36deef42",
      "name": "Owner: larger teams",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1320,
        320
      ]
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "e2788b93-90f1-44e5-a583-256fa2215c0b",
              "name": "owner_slack_id",
              "value": "REPLACE_WITH_SLACK_MEMBER_ID_B",
              "type": "string"
            },
            {
              "id": "7b509354-d0a8-44e4-a74a-77f18dd1468a",
              "name": "owner_name",
              "value": "REPLACE_WITH_REP_B",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "8d6d59d7-0006-49c8-af78-d76b9c38709f",
      "name": "Owner: smaller teams",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1320,
        520
      ]
    },
    {
      "parameters": {
        "select": "channel",
        "channelId": {
          "__rl": true,
          "value": "#inbound-demos",
          "mode": "name"
        },
        "text": "=New demo request for <@{{ $json.owner_slack_id }}>\n*{{ $('Shape the lead').item.json.first_name }} {{ $('Shape the lead').item.json.last_name }}*, {{ $('Shape the lead').item.json.company }} ({{ $('Shape the lead').item.json.team_size }} people)\n{{ $('Shape the lead').item.json.email }}\nSent {{ $('Shape the lead').item.json.submitted_at }}. Reply in the thread within 5 minutes or it moves to the next rep.",
        "otherOptions": {}
      },
      "id": "3b162850-3c0a-431b-a3e5-0e3a0f375d39",
      "name": "Alert the owner in Slack",
      "type": "n8n-nodes-base.slack",
      "typeVersion": 2.2,
      "position": [
        1560,
        420
      ],
      "credentials": {
        "slackApi": {
          "id": "replace-me",
          "name": "Slack (connect yours)"
        }
      }
    },
    {
      "parameters": {
        "content": "### Routing\nKeep an existing owner first: if the account already has one in your CRM, send it there before any split. Then split by team size or rotate across the inbound team. Change 50 to your own line.",
        "height": 200,
        "width": 420,
        "color": 6
      },
      "id": "12f6d321-35b0-467a-a61d-929ceb325f09",
      "name": "Routing note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1080,
        120
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "speed-to-lead-booked",
        "responseMode": "onReceived",
        "options": {}
      },
      "id": "6fb70486-bbbd-4dd4-aba1-ad6de2bfbe33",
      "name": "Meeting booked (Calendly)",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        0,
        820
      ],
      "webhookId": "02a368bc-3468-4702-a2f4-e7e761e48936"
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "8c4f7810-cf25-476a-a169-355532f4c22d",
              "name": "email",
              "value": "={{ String($json.body.payload?.email || '').trim().toLowerCase() }}",
              "type": "string"
            },
            {
              "id": "d1a9a51e-9035-4746-a9b5-bffddf6090e2",
              "name": "booked_for",
              "value": "={{ $json.body.payload?.scheduled_event?.start_time }}",
              "type": "string"
            },
            {
              "id": "ed36a1fd-2aa6-4747-ac57-448ebe8993e3",
              "name": "first_touch_at",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      },
      "id": "e9a8d142-d691-437d-a9b0-65f864c3748d",
      "name": "Shape the booking",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        220,
        820
      ]
    },
    {
      "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      \"first_touch_at\": \"{{ $json.first_touch_at }}\"\n    }\n  }\n}",
        "options": {}
      },
      "id": "8847c725-42a7-48a4-ae9e-8166cb896f66",
      "name": "Stamp first touch in Attio",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        440,
        820
      ],
      "credentials": {
        "httpHeaderAuth": {
          "id": "replace-me",
          "name": "Attio token (Header Auth: Authorization = Bearer <token>)"
        }
      }
    },
    {
      "parameters": {
        "content": "### Second trigger: the booking\nCreate a Calendly webhook subscription for `invitee.created` and point it at this node's Production URL. The booking lands on the same person record because both calls match on email.\n\nCreate the People attributes `source_form` (text), `team_size` (number) and `first_touch_at` (timestamp) in Attio first, or delete those lines from the request bodies.",
        "height": 260,
        "width": 460,
        "color": 5
      },
      "id": "26cc837f-bdf9-406a-a93d-b687cff30419",
      "name": "Booking note",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        660,
        700
      ]
    }
  ],
  "connections": {
    "Form submitted": {
      "main": [
        [
          {
            "node": "Token matches?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Token matches?": {
      "main": [
        [
          {
            "node": "Shape the lead",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape the lead": {
      "main": [
        [
          {
            "node": "Has an email?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Has an email?": {
      "main": [
        [
          {
            "node": "Upsert person in Attio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Upsert person in Attio": {
      "main": [
        [
          {
            "node": "Larger team?",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Larger team?": {
      "main": [
        [
          {
            "node": "Owner: larger teams",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Owner: smaller teams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Owner: larger teams": {
      "main": [
        [
          {
            "node": "Alert the owner in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Owner: smaller teams": {
      "main": [
        [
          {
            "node": "Alert the owner in Slack",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Meeting booked (Calendly)": {
      "main": [
        [
          {
            "node": "Shape the booking",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Shape the booking": {
      "main": [
        [
          {
            "node": "Stamp first touch in Attio",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": false,
  "settings": {
    "executionOrder": "v1"
  },
  "pinData": {},
  "meta": {
    "templateCredsSetupCompleted": false
  },
  "tags": []
}
