{
  "name": "Create outreach tasks for new B2B website visitors with Webmetic",
  "nodes": [
    {
      "parameters": {
        "content": "## Create outreach tasks for new B2B website visitors with Webmetic\n\n### How it works\n\nThis workflow runs every five minutes to check Webmetic for new B2B website visits, deduplicates companies, and filters for visitors with enough interest. It looks up matching HubSpot or any other CRM company and deal records, then either adds a task to an existing open deal or finds a contact, uses OpenAI to write a call script, creates records, and notifies the sales team.\n\n### Setup steps\n\n- Configure the schedule interval if five minutes is not appropriate for your sales process.\n- Set the Settings node values for domain, minLeadScore, yourCompany, and whatYouSell.\n- Connect and authorize Webmetic credentials for visitor and contact lookup.\n- Configure HubSpot authentication for the HTTP Request and HubSpot nodes, including access to companies, deals, contacts, and tasks.\n- Connect OpenAI credentials for the chat model used by the AI Agent.\n- Connect Microsoft Teams credentials and choose the target team/channel for sales notifications.\n\n### Customization\n\nAdjust the minimum lead score, HubSpot search criteria, call-task content, AI call-script prompt, and Teams notification message to match your qualification rules and sales workflow.",
        "height": 896,
        "width": 480
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        0,
        0
      ],
      "id": "2878ff56-b965-4e17-b2d5-5b8b668b5266",
      "name": "Sticky Note"
    },
    {
      "parameters": {
        "content": "## Schedule and visit lookup\n\nStarts the automation on a timer, applies core configuration values, and retrieves recent website visits from Webmetic.",
        "height": 304,
        "width": 640,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        560,
        336
      ],
      "id": "66d269e1-e9ef-4f98-815e-2af4eee43ae2",
      "name": "Sticky Note1"
    },
    {
      "parameters": {
        "content": "## Qualify new companies\n\nRemoves companies that have already been processed and filters the remaining visitors by the configured interest threshold.",
        "height": 320,
        "width": 416,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1248,
        304
      ],
      "id": "5abe99b4-4f1d-40ea-b28d-ac3bb41fe9ce",
      "name": "Sticky Note2"
    },
    {
      "parameters": {
        "content": "## Check CRM status\n\nSearches HubSpot or any other CRM for the visiting company and branches based on whether an open deal should be handled.",
        "height": 320,
        "width": 384,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        1696,
        304
      ],
      "id": "d0174c15-ccaa-4671-bb3d-acf59e657797",
      "name": "Sticky Note3"
    },
    {
      "parameters": {
        "content": "## Update existing deal\n\nFollows the upper branch to find an open HubSpot  or any other CRM deal and add a follow-up task directly to that deal.",
        "height": 320,
        "width": 416,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2128,
        0
      ],
      "id": "3227074f-9698-4040-9c2f-5c33c8fe6d21",
      "name": "Sticky Note4"
    },
    {
      "parameters": {
        "content": "## Find contact and script\n\nFollows the main branch to identify a contact in Webmetic and uses the AI Agent with an OpenAI chat model to draft a tailored call script.",
        "height": 528,
        "width": 576,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2128,
        352
      ],
      "id": "708834d4-75c2-43d2-b4a8-cecc198b0bb5",
      "name": "Sticky Note5"
    },
    {
      "parameters": {
        "content": "## Create records and notify\n\nCreates the HubSpot or any other CRM contact and call task, then sends a Microsoft Teams or any other Plattform notification to alert the sales team.",
        "height": 304,
        "width": 640,
        "color": 7
      },
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        2736,
        336
      ],
      "id": "a994aa5c-1a88-43ba-9f79-f18844a7612b",
      "name": "Sticky Note6"
    },
    {
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "minutes"
            }
          ]
        }
      },
      "id": "0bcf998a-538b-4d2d-ac5b-f706f1912f1f",
      "name": "When Scheduled Every 5 Min",
      "type": "n8n-nodes-base.scheduleTrigger",
      "position": [
        608,
        464
      ],
      "typeVersion": 1.3
    },
    {
      "parameters": {
        "assignments": {
          "assignments": [
            {
              "id": "ebdf857b-842d-50fd-b232-b4835b47d15e",
              "name": "domain",
              "type": "string",
              "value": "example.com"
            },
            {
              "id": "d28701f2-04b3-5259-9651-de4650a82b9c",
              "name": "minLeadScore",
              "type": "number",
              "value": 50
            },
            {
              "id": "1beb5715-bdf7-5dcd-bd0c-410546eff8a5",
              "name": "yourCompany",
              "type": "string",
              "value": "Acme GmbH"
            },
            {
              "id": "638d2e17-77a3-58db-8460-f5717e979e89",
              "name": "whatYouSell",
              "type": "string",
              "value": "One sentence about what you sell and for whom"
            },
            {
              "id": "2bedb20e-e473-52c6-bfcf-8159279ac0c2",
              "name": "scriptLanguage",
              "type": "string",
              "value": "English"
            }
          ]
        },
        "options": {}
      },
      "id": "ab59ff6d-2584-4e45-9e02-f01855cc2cd1",
      "name": "Set Lead Criteria",
      "type": "n8n-nodes-base.set",
      "position": [
        832,
        464
      ],
      "typeVersion": 3.4
    },
    {
      "parameters": {
        "domain": "={{ $json.domain }}",
        "additionalFields": {
          "from_date": "-1 hour",
          "to_date": "now"
        },
        "requestOptions": {}
      },
      "id": "d445395d-3378-42c7-9846-a8a68baa9581",
      "name": "Fetch Webmetic Visits",
      "type": "n8n-nodes-webmetic.webmetic",
      "position": [
        1056,
        464
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "operation": "removeItemsSeenInPreviousExecutions",
        "dedupeValue": "={{ $json.company_id }}",
        "options": {}
      },
      "id": "344f956a-6274-4507-a067-152b61b1c97c",
      "name": "Deduplicate Companies",
      "type": "n8n-nodes-base.removeDuplicates",
      "position": [
        1296,
        464
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "loose"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "5774b9d0-70c0-5adc-93b0-ca2359c80869",
              "operator": {
                "type": "number",
                "operation": "gte"
              },
              "leftValue": "={{ $json.lead_score }}",
              "rightValue": "={{ $('Set Lead Criteria').item.json.minLeadScore }}"
            }
          ]
        },
        "looseTypeValidation": true,
        "options": {}
      },
      "id": "e7bcffce-1d98-435b-9037-522ad4c59035",
      "name": "Filter Interested Companies",
      "type": "n8n-nodes-base.filter",
      "position": [
        1520,
        464
      ],
      "typeVersion": 2.3
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.hubapi.com/crm/v3/objects/companies/search",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotAppToken",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"filterGroups\": [{ \"filters\": [{ \"propertyName\": \"domain\", \"operator\": \"EQ\", \"value\": \"{{ $('Fetch Webmetic Visits').item.json.company_url }}\" }] }],\n  \"properties\": [\"name\", \"hs_num_open_deals\"],\n  \"limit\": 1\n}",
        "options": {}
      },
      "id": "f1fa9578-e4a1-4ab4-8bfc-91050867e233",
      "name": "Post to HubSpot Company Search",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        1744,
        464
      ],
      "typeVersion": 4.4
    },
    {
      "parameters": {
        "conditions": {
          "options": {
            "version": 3,
            "leftValue": "",
            "caseSensitive": true,
            "typeValidation": "strict"
          },
          "combinator": "and",
          "conditions": [
            {
              "id": "4cea72d5-083b-5a51-b4b9-6eae24b1017e",
              "operator": {
                "type": "number",
                "operation": "gt"
              },
              "leftValue": "={{ Number($json.results[0]?.properties?.hs_num_open_deals || 0) }}",
              "rightValue": 0
            }
          ]
        },
        "options": {}
      },
      "id": "569aace8-4df3-4fba-9af4-807cabcc5e49",
      "name": "Check Open Deal in HubSpot",
      "type": "n8n-nodes-base.if",
      "position": [
        1936,
        464
      ],
      "typeVersion": 2.3
    },
    {
      "parameters": {
        "method": "POST",
        "url": "https://api.hubapi.com/crm/v3/objects/deals/search",
        "authentication": "predefinedCredentialType",
        "nodeCredentialType": "hubspotAppToken",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={\n  \"filterGroups\": [{ \"filters\": [\n    { \"propertyName\": \"associations.company\", \"operator\": \"EQ\", \"value\": \"{{ $json.results[0].id }}\" },\n    { \"propertyName\": \"hs_is_closed\", \"operator\": \"EQ\", \"value\": \"false\" }\n  ] }],\n  \"properties\": [\"dealname\", \"dealstage\", \"amount\", \"hubspot_owner_id\"],\n  \"sorts\": [{ \"propertyName\": \"hs_lastmodifieddate\", \"direction\": \"DESCENDING\" }],\n  \"limit\": 1\n}",
        "options": {}
      },
      "id": "47922ba2-b446-4ee6-b21a-69f8ad13b38a",
      "name": "Post to HubSpot Deal Search",
      "type": "n8n-nodes-base.httpRequest",
      "position": [
        2176,
        160
      ],
      "typeVersion": 4.4
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "engagement",
        "type": "task",
        "dueDate": "={{ $now.toISO() }}",
        "metadata": {
          "body": "=<p>{{ $('Fetch Webmetic Visits').item.json.company_name }} visited your website. A good moment to get in touch.</p><p>Pages read: {{ ($('Fetch Webmetic Visits').item.json.sessions || []).flatMap(s => s.user_data || []).map(p => p.document_title + ' (' + Math.round(p.time_spent || 0) + 's)').join(' -> ') || 'unknown' }}</p>",
          "status": "NOT_STARTED",
          "subject": "={{ $('Fetch Webmetic Visits').item.json.company_name }} is on your website"
        },
        "additionalFields": {
          "associations": {
            "companyIds": "={{ $('Post to HubSpot Company Search').item.json.results[0].id }}",
            "dealIds": "={{ $('Post to HubSpot Deal Search').item.json.results[0].id }}",
            "ownerId": "={{ Number($('Post to HubSpot Deal Search').item.json.results[0].properties.hubspot_owner_id) }}"
          }
        }
      },
      "id": "96da45ee-385e-4482-8442-e761f189071a",
      "name": "Add Task to HubSpot Deal",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2400,
        160
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "resource": "contact",
        "companyId": "={{ $('Fetch Webmetic Visits').item.json.company_id }}",
        "reveal": "both",
        "requestOptions": {}
      },
      "id": "a7e2404a-9162-4623-b31d-729a2fb18066",
      "name": "Find Contacts via Webmetic",
      "type": "n8n-nodes-webmetic.webmetic",
      "position": [
        2176,
        512
      ],
      "typeVersion": 2
    },
    {
      "parameters": {
        "promptType": "define",
        "text": "=You are an experienced B2B sales coach. Write a short phone call script for our sales rep.\n\nIMPORTANT: Never mention that we know this person or their company visited our website.\n\nOUR COMPANY\n- Name: {{ $('Set Lead Criteria').item.json.yourCompany }}\n- What we sell: {{ $('Set Lead Criteria').item.json.whatYouSell }}\n\nTARGET COMPANY\n- Company: {{ $('Fetch Webmetic Visits').item.json.company_name }}\n- What they do: {{ $('Fetch Webmetic Visits').item.json.short_description_en || 'unknown' }}\n- Size: {{ $('Fetch Webmetic Visits').item.json.employee_count ? $('Fetch Webmetic Visits').item.json.employee_count.join('-') + ' employees' : 'unknown' }}\n- Location: {{ $('Fetch Webmetic Visits').item.json.city || 'unknown' }}\n\nCONTACT PERSON\n- Name: {{ $json.name }}\n- Position: {{ $json.job_title }}\n\nWEBSITE BEHAVIOUR (for your understanding only, never mention it in the call)\n- Pages read: {{ ($('Fetch Webmetic Visits').item.json.sessions || []).flatMap(s => s.user_data || []).map(p => p.document_title + ' (' + Math.round(p.time_spent || 0) + 's)').join(' -> ') || 'unknown' }}\n\nWRITE\n1. Opener (2 sentences)\n2. Three qualifying questions\n3. Pitch (3 sentences)\n4. Top 3 objections with short answers\n5. Close: ask for a 15-minute meeting\n6. Voicemail (2 sentences)\n\nRULES: Write in {{ $('Set Lead Criteria').item.json.scriptLanguage }}. Maximum 300 words, no filler. Output simple HTML using only h3, p, ul and li.",
        "options": {}
      },
      "id": "4aa83388-1ac6-4381-a105-579098a9c8c6",
      "name": "Call Script Agent",
      "type": "@n8n/n8n-nodes-langchain.agent",
      "position": [
        2400,
        512
      ],
      "typeVersion": 3.1
    },
    {
      "parameters": {
        "model": {
          "__rl": true,
          "mode": "list",
          "value": "gpt-5-mini"
        },
        "builtInTools": {},
        "options": {}
      },
      "id": "9e99c11e-090b-4ba7-bd66-fabfbf6733d4",
      "name": "OpenAI Chat GPT-5",
      "type": "@n8n/n8n-nodes-langchain.lmChatOpenAi",
      "position": [
        2448,
        784
      ],
      "typeVersion": 1.3
    },
    {
      "parameters": {
        "authentication": "appToken",
        "email": "={{ $('Find Contacts via Webmetic').item.json.email }}",
        "additionalFields": {
          "companyName": "={{ $('Fetch Webmetic Visits').item.json.company_name }}",
          "firstName": "={{ ($('Find Contacts via Webmetic').item.json.name || '').split(' ')[0] }}",
          "jobTitle": "={{ $('Find Contacts via Webmetic').item.json.job_title }}",
          "lastName": "={{ ($('Find Contacts via Webmetic').item.json.name || '').split(' ').slice(1).join(' ') }}",
          "lifeCycleStage": "lead",
          "linkedinUrl": "={{ $('Find Contacts via Webmetic').item.json.linkedin || '' }}",
          "mobilePhoneNumber": "={{ $('Find Contacts via Webmetic').item.json.mobile_phone || '' }}",
          "phoneNumber": "={{ $('Find Contacts via Webmetic').item.json.direct_phone || '' }}",
          "websiteUrl": "={{ $('Fetch Webmetic Visits').item.json.company_url }}"
        },
        "options": {}
      },
      "id": "c7fc80cc-1776-4aa3-a6b5-a0857c4d5ad7",
      "name": "Add Contact to HubSpot",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        2784,
        464
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "authentication": "appToken",
        "resource": "engagement",
        "type": "task",
        "dueDate": "={{ $now.toISO() }}",
        "metadata": {
          "body": "={{ $('Call Script Agent').item.json.output }}",
          "forObjectType": "CONTACT",
          "status": "NOT_STARTED",
          "subject": "=Call {{ $('Find Contacts via Webmetic').item.json.name }} at {{ $('Fetch Webmetic Visits').item.json.company_name }}"
        },
        "additionalFields": {
          "associations": {
            "contactIds": "={{ $json.vid }}"
          }
        }
      },
      "id": "f984f937-248c-4ba6-975a-5225c6e03b2d",
      "name": "Create HubSpot Call Task",
      "type": "n8n-nodes-base.hubspot",
      "position": [
        3008,
        464
      ],
      "typeVersion": 2.2
    },
    {
      "parameters": {
        "resource": "channelMessage",
        "teamId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "channelId": {
          "__rl": true,
          "mode": "list",
          "value": ""
        },
        "contentType": "html",
        "message": "=<b>New company on the website:</b> {{ $('Fetch Webmetic Visits').item.json.company_name }}, {{ $('Fetch Webmetic Visits').item.json.city }} (lead score {{ $('Fetch Webmetic Visits').item.json.lead_score }})<br><b>Contact:</b> {{ $('Find Contacts via Webmetic').item.json.name }}, {{ $('Find Contacts via Webmetic').item.json.job_title }}<br><b>Phone:</b> {{ $('Find Contacts via Webmetic').item.json.mobile_phone || $('Find Contacts via Webmetic').item.json.direct_phone || 'not available' }}<br>The contact and a call task with the call script are in HubSpot.",
        "options": {
          "includeLinkToWorkflow": false
        }
      },
      "id": "077fbdcf-08af-41b0-bb9c-b3f78454baab",
      "name": "Notify Sales via Teams",
      "type": "n8n-nodes-base.microsoftTeams",
      "position": [
        3232,
        464
      ],
      "typeVersion": 2,
      "webhookId": "4f136ea8-f0c9-41ec-a9b3-e509fef8b0c3"
    }
  ],
  "pinData": {},
  "connections": {
    "Set Lead Criteria": {
      "main": [
        [
          {
            "node": "Fetch Webmetic Visits",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Find Contacts via Webmetic": {
      "main": [
        [
          {
            "node": "Call Script Agent",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to HubSpot Deal Search": {
      "main": [
        [
          {
            "node": "Add Task to HubSpot Deal",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Fetch Webmetic Visits": {
      "main": [
        [
          {
            "node": "Deduplicate Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "When Scheduled Every 5 Min": {
      "main": [
        [
          {
            "node": "Set Lead Criteria",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Create HubSpot Call Task": {
      "main": [
        [
          {
            "node": "Notify Sales via Teams",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Filter Interested Companies": {
      "main": [
        [
          {
            "node": "Post to HubSpot Company Search",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "OpenAI Chat GPT-5": {
      "ai_languageModel": [
        [
          {
            "node": "Call Script Agent",
            "type": "ai_languageModel",
            "index": 0
          }
        ]
      ]
    },
    "Call Script Agent": {
      "main": [
        [
          {
            "node": "Add Contact to HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Deduplicate Companies": {
      "main": [
        [
          {
            "node": "Filter Interested Companies",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Check Open Deal in HubSpot": {
      "main": [
        [
          {
            "node": "Post to HubSpot Deal Search",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Find Contacts via Webmetic",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Add Contact to HubSpot": {
      "main": [
        [
          {
            "node": "Create HubSpot Call Task",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Post to HubSpot Company Search": {
      "main": [
        [
          {
            "node": "Check Open Deal in HubSpot",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1",
    "binaryMode": "separate",
    "availableInMCP": false
  },
  "meta": {
    "templateCredsSetupCompleted": false
  }
}
