Files
CORBEL-Automations/modules/A1-lead-enrich-pipeline/workflows/lead-actions-example.json
jake 8a43037668 agent: A1-lead-actions — Workflow 2 lead actions example recipe
Add lead-actions-example.json — reference workflow demonstrating four optional
action patterns (HubSpot upsert, Slack notification, welcome email, audit log)
routed by profile grade from Workflow 1 output. Uses HTTP Request nodes for
Slack (no credential dependency), Set node for audit log (template buyers wire
their own sink), continueOnFail on all action nodes, and an Error Trigger +
email alert pair for runtime visibility.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-03-27 23:38:49 +00:00

332 lines
10 KiB
JSON

{
"name": "Lead Actions Example",
"nodes": [
{
"id": "f1a2b3c4-d5e6-7890-abcd-ef1234567890",
"name": "Execute Workflow Trigger",
"type": "n8n-nodes-base.executeWorkflowTrigger",
"typeVersion": 1.1,
"position": [0, 300],
"parameters": {}
},
{
"id": "a2b3c4d5-e6f7-8901-bcde-f23456789012",
"name": "Grade Router",
"type": "n8n-nodes-base.switch",
"typeVersion": 3.2,
"position": [300, 300],
"parameters": {
"rules": {
"values": [
{
"conditions": {
"conditions": [
{
"id": "c3d4e5f6-a7b8-9012-cdef-345678901234",
"leftValue": "={{ $json.grading.profile_grade }}",
"rightValue": "Full Profile",
"operator": {
"type": "string",
"operation": "equals"
}
}
]
}
},
{
"conditions": {
"conditions": [
{
"id": "d4e5f6a7-b8c9-0123-defa-456789012345",
"leftValue": "={{ $json.grading.profile_grade }}",
"rightValue": "Partial Profile",
"operator": {
"type": "string",
"operation": "equals"
}
}
]
}
},
{
"conditions": {
"conditions": [
{
"id": "e5f6a7b8-c9d0-1234-efab-567890123456",
"leftValue": "={{ $json.grading.profile_grade }}",
"rightValue": "Limited",
"operator": {
"type": "string",
"operation": "equals"
}
}
]
}
}
]
},
"options": {
"fallbackOutput": "extra"
}
}
},
{
"id": "b3c4d5e6-f7a8-9012-bcde-678901234567",
"name": "HubSpot Upsert",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [600, 100],
"continueOnFail": true,
"parameters": {
"method": "POST",
"url": "https://api.hubapi.com/crm/v3/objects/contacts/batch/upsert",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $env.HUBSPOT_PRIVATE_APP_TOKEN }}"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ inputs: [{ idProperty: \"email\", id: $json.lead.email, properties: { firstname: $json.lead.first_name, lastname: $json.lead.last_name, company: $json.enrichment.organisation.name || \"\", jobtitle: $json.enrichment.person.title || \"\", website: $json.enrichment.organisation.website_url || \"\", city: $json.enrichment.person.city || \"\", country: $json.enrichment.person.country || \"\", lifecyclestage: \"lead\" } }] }) }}"
}
},
{
"id": "c4d5e6f7-a8b9-0123-cdef-789012345678",
"name": "Slack Notification",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [600, 300],
"continueOnFail": true,
"parameters": {
"method": "POST",
"url": "https://slack.com/api/chat.postMessage",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
},
{
"name": "Authorization",
"value": "=Bearer {{ $env.SLACK_BOT_TOKEN }}"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={{ JSON.stringify({ channel: \"#leads\", text: \"*New Lead \\u2014 \" + $json.grading.profile_grade + \"*\\nName: \" + ($json.lead.first_name || \"\") + \" \" + ($json.lead.last_name || \"\") + \"\\nEmail: \" + $json.lead.email + \"\\nCompany: \" + ($json.enrichment.organisation.name || \"Unknown\") + \"\\nTitle: \" + ($json.enrichment.person.title || \"Unknown\") + \"\\nSource: \" + ($json.lead.source || \"unknown\") + ($json.enrichment.credits_low ? \"\\n\\u26a0\\ufe0f Apollo credits running low!\" : \"\") }) }}"
}
},
{
"id": "d5e6f7a8-b9c0-1234-defa-890123456789",
"name": "Welcome Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [600, 500],
"continueOnFail": true,
"credentials": {
"smtp": {
"id": "XU85XBahrbhS0122",
"name": "CORBEL Email SMTP"
}
},
"parameters": {
"fromEmail": "jake@corbel.consulting",
"toEmail": "={{ $json.lead.email }}",
"subject": "Thanks for getting in touch",
"emailFormat": "html",
"html": "<div style=\"font-family:system-ui,sans-serif;max-width:520px;margin:0 auto;padding:2rem\">\n <p style=\"font-size:1.1rem;color:#2D3748\">Hi {{ $json.lead.first_name || 'there' }},</p>\n <p style=\"color:#64748B;line-height:1.7\">Thanks for getting in touch. We have received your details and will be in contact shortly.</p>\n <p style=\"color:#64748B;line-height:1.7\">If you have any questions in the meantime, just reply to this email.</p>\n <p style=\"color:#2D3748;margin-top:1.5rem\">Best regards,<br><span style=\"color:#64748B\">The Team</span></p>\n</div>"
}
},
{
"id": "e6f7a8b9-c0d1-2345-efab-901234567890",
"name": "Sheets Audit Log",
"type": "n8n-nodes-base.set",
"typeVersion": 3.3,
"position": [600, 700],
"continueOnFail": true,
"parameters": {
"mode": "manual",
"duplicateItem": false,
"assignments": {
"assignments": [
{
"id": "f7a8b9c0-d1e2-3456-fabc-012345678901",
"name": "timestamp",
"value": "={{ $json.grading.graded_at }}",
"type": "string"
},
{
"id": "a8b9c0d1-e2f3-4567-abcd-123456789012",
"name": "email",
"value": "={{ $json.lead.email }}",
"type": "string"
},
{
"id": "b9c0d1e2-f3a4-5678-bcde-234567890123",
"name": "name",
"value": "={{ ($json.lead.first_name || \"\") + \" \" + ($json.lead.last_name || \"\") }}",
"type": "string"
},
{
"id": "c0d1e2f3-a4b5-6789-cdef-345678901234",
"name": "company",
"value": "={{ $json.enrichment.organisation.name || \"\" }}",
"type": "string"
},
{
"id": "d1e2f3a4-b5c6-7890-defa-456789012345",
"name": "profile_grade",
"value": "={{ $json.grading.profile_grade }}",
"type": "string"
},
{
"id": "e2f3a4b5-c6d7-8901-efab-567890123456",
"name": "source",
"value": "={{ $json.lead.source || \"\" }}",
"type": "string"
},
{
"id": "f3a4b5c6-d7e8-9012-fabc-678901234567",
"name": "provider",
"value": "={{ $json.enrichment.provider }}",
"type": "string"
},
{
"id": "a4b5c6d7-e8f9-0123-abcd-789012345678",
"name": "credits_consumed",
"value": "={{ $json.enrichment.credits_consumed }}",
"type": "number"
},
{
"id": "b5c6d7e8-f9a0-1234-bcde-890123456789",
"name": "credits_low",
"value": "={{ $json.enrichment.credits_low }}",
"type": "boolean"
}
]
},
"options": {
"includeOtherFields": false
}
}
},
{
"id": "c6d7e8f9-a0b1-2345-cdef-901234567890",
"name": "Error Trigger",
"type": "n8n-nodes-base.errorTrigger",
"typeVersion": 1,
"position": [0, 700],
"parameters": {}
},
{
"id": "d7e8f9a0-b1c2-3456-defa-012345678901",
"name": "Error Notification Email",
"type": "n8n-nodes-base.emailSend",
"typeVersion": 2.1,
"position": [300, 700],
"credentials": {
"smtp": {
"id": "XU85XBahrbhS0122",
"name": "CORBEL Email SMTP"
}
},
"parameters": {
"fromEmail": "jake@corbel.consulting",
"toEmail": "jake@corbel.consulting",
"subject": "Lead Actions workflow error",
"emailFormat": "html",
"html": "=<p>The Lead Actions Example workflow encountered an error.</p><pre>{{ JSON.stringify($json, null, 2) }}</pre>"
}
}
],
"connections": {
"Execute Workflow Trigger": {
"main": [
[
{
"node": "Grade Router",
"type": "main",
"index": 0
}
]
]
},
"Grade Router": {
"main": [
[
{
"node": "HubSpot Upsert",
"type": "main",
"index": 0
},
{
"node": "Slack Notification",
"type": "main",
"index": 0
},
{
"node": "Welcome Email",
"type": "main",
"index": 0
},
{
"node": "Sheets Audit Log",
"type": "main",
"index": 0
}
],
[
{
"node": "HubSpot Upsert",
"type": "main",
"index": 0
},
{
"node": "Sheets Audit Log",
"type": "main",
"index": 0
}
],
[
{
"node": "Sheets Audit Log",
"type": "main",
"index": 0
}
],
[
{
"node": "Sheets Audit Log",
"type": "main",
"index": 0
}
]
]
},
"Error Trigger": {
"main": [
[
{
"node": "Error Notification Email",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}