diff --git a/modules/A1-lead-enrich-pipeline/workflows/lead-actions-example.json b/modules/A1-lead-enrich-pipeline/workflows/lead-actions-example.json new file mode 100644 index 0000000..4993d96 --- /dev/null +++ b/modules/A1-lead-enrich-pipeline/workflows/lead-actions-example.json @@ -0,0 +1,331 @@ +{ + "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": "
Hi {{ $json.lead.first_name || 'there' }},
\nThanks for getting in touch. We have received your details and will be in contact shortly.
\nIf you have any questions in the meantime, just reply to this email.
\nBest regards,
The Team
The Lead Actions Example workflow encountered an error.
{{ JSON.stringify($json, null, 2) }}"
+ }
+ }
+ ],
+ "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"
+ }
+}