-
Notifications
You must be signed in to change notification settings - Fork 6.4k
Expand file tree
/
Copy pathLeadBot 24h - AI WhatsApp Lead Qualification.json
More file actions
204 lines (204 loc) · 5.85 KB
/
Copy pathLeadBot 24h - AI WhatsApp Lead Qualification.json
File metadata and controls
204 lines (204 loc) · 5.85 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
{
"name": "LeadBot 24h — WhatsApp AI Lead Qualification Bot",
"nodes": [
{
"parameters": {
"path": "leadbot-24h",
"responseMode": "responseNode",
"options": {}
},
"id": "webhook-incoming",
"name": "WhatsApp Webhook (WAHA)",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
260,
300
],
"webhookId": "leadbot-24h-webhook",
"notes": "Configure WAHA (WhatsApp HTTP API) to POST incoming messages here. See: https://waha.dev"
},
{
"parameters": {
"jsCode": "// Normalize incoming WhatsApp payload to standard lead format\nconst msg = $input.first().json;\nconst lead = {\n phone: msg.data?.from || msg.from || '',\n message: msg.data?.body || msg.body || msg.text || '',\n name: msg.data?.fromName || msg.data?.name || '',\n timestamp: new Date().toISOString(),\n source: 'whatsapp'};\n\n// Simple keyword-based urgency detection (no paid API required)\nconst urgentKeywords = ['preço', 'price', 'comprar', 'buy', 'contratar', 'urgente', 'orçamento', 'demissão', 'demissao', 'folha', 'payroll', 'admissão', 'admissao', 'férias'];\nconst msgLower = (lead.message || '').toLowerCase();\nlead.intent_score = urgentKeywords.some(k => msgLower.includes(k)) ? 9 : 5;\nlead.urgency = lead.intent_score >= 8 ? 'HOT' : 'WARM';\n\nreturn [{ json: lead }];"
},
"id": "normalize-lead",
"name": "Normalize & Score Lead",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
460,
300
],
"notes": "Extracts lead fields and assigns intent score. Replace keyword logic with AI node for production (OpenAI/Gemini free tier)."
},
{
"parameters": {
"jsCode": "// Route hot leads to CRM / Google Sheets\nconst lead = $input.first().json;\nif (lead.urgency === 'HOT') {\n return [{ json: lead }];\n}\nreturn [];"
},
"name": "Filter Hot Leads",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
660,
200
],
"id": "filter-hot"
},
{
"parameters": {
"operation": "append",
"sheetId": "YOUR_GOOGLE_SHEET_ID",
"range": "Sheet1!A:E",
"columns": {
"mappings": [
{
"toField": "A",
"value": "={{$json.phone}}",
"type": "string"
},
{
"toField": "B",
"value": "={{$json.name}}",
"type": "string"
},
{
"toField": "C",
"value": "={{$json.message}}",
"type": "string"
},
{
"toField": "D",
"value": "={{$json.intent_score}}",
"type": "number"
},
{
"toField": "E",
"value": "={{$json.urgency}}",
"type": "string"
}
]
},
"options": {}
},
"name": "Save Lead to Google Sheets",
"type": "n8n-nodes-base.googleSheets",
"typeVersion": 4,
"position": [
860,
200
],
"id": "save-sheets",
"notes": "Requires Google Sheets OAuth credential. Replace YOUR_GOOGLE_SHEET_ID with your sheet ID."
},
{
"parameters": {
"method": "POST",
"url": "https://hooks.slack.com/services/YOUR_SLACK_WEBHOOK",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"contentType": "json",
"bodyParameters": {
"parameters": [
{
"name": "text",
"value": "🔥 HOT LEAD from WhatsApp\\nPhone: {{$json.phone}}\nName: {{$json.name}}\nMessage: {{$json.message}}\nIntent Score: {{$json.intent_score}}/10\nUrgency: {{$json.urgency}}"
}
]
},
"options": {}
},
"name": "Notify Sales Team (Slack/Webhook)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
860,
400
],
"id": "notify-sales"
},
{
"parameters": {
"content": "Obrigado pelo contato! 😊\\n\\nRecebemos sua mensagem. Nossa equipe vai retornar em breve.\\n\\nEnquanto isso, conheça nossas soluções: https://planificador7.gumroad.com/l/leadbot-24h",
"options": {
"waTemplate": {
"name": "leadbot_welcome_reply",
"namespace": "eae8f7e2_1b2c_4d3e_9f4a_5c6d7e8f9a0b"
}
}
},
"name": "Send Auto-Reply (WhatsApp)",
"type": "n8n-nodes-base.whatsApp",
"typeVersion": 1,
"position": [
1060,
300
],
"id": "auto-reply",
"notes": "Requires WhatsApp Business API or WAHA credential. Configure in n8n."
}
],
"connections": {
"WhatsApp Webhook (WAHA)": {
"main": [
[
{
"node": "Normalize & Score Lead",
"type": "main",
"index": 0
}
]
]
},
"Normalize & Score Lead": {
"main": [
[
{
"node": "Filter Hot Leads",
"type": "main",
"index": 0
}
]
]
},
"Filter Hot Leads": {
"main": [
[
{
"node": "Save Lead to Google Sheets",
"type": "main",
"index": 0
}
],
[
{
"node": "Notify Sales Team (Slack/Webhook)",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"pinData": {},
"tags": [
"whatsapp",
"lead-qualification",
"ai",
"n8n",
"sales",
"free"
]
}