Automatisierte WhatsApp-Lead-Nurture mit Postgres und personalisierten Gallabox-Nachrichten
Dies ist ein Lead Nurturing, Multimodal AI-Bereich Automatisierungsworkflow mit 11 Nodes. Hauptsächlich werden Code, Postgres, HttpRequest, SplitInBatches, ScheduleTrigger und andere Nodes verwendet. Automatisierte WhatsApp-Lead-Pflege mit Postgres und personalisierten Gallabox-Nachrichten
- •PostgreSQL-Datenbankverbindungsdaten
- •Möglicherweise sind Ziel-API-Anmeldedaten erforderlich
Verwendete Nodes (11)
Kategorie
{
"meta": {
"instanceId": "807c58b937f3c75f8b242bc4ac5f455a51832cabd7bcdbecd9fdc3ba6179a8c9",
"templateCredsSetupCompleted": true
},
"nodes": [
{
"id": "84e5aa63-1375-4aa5-980a-b8d252d7535b",
"name": "Führe eine SQL-Abfrage aus",
"type": "n8n-nodes-base.postgres",
"onError": "continueRegularOutput",
"position": [
4040,
520
],
"parameters": {
"query": "SELECT * FROM \"MQL\".mql_contacts\nWHERE (\n (count = 0)\n OR \n (count = 1 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '3 minutes')\n OR \n (count = 2 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '5 minutes')\n OR \n (count = 3 AND (NOW() AT TIME ZONE 'Asia/Kolkata') - webhook_time > INTERVAL '8 minutes')\n)\n AND\n disposition = 'unqualified'\n ;",
"options": {},
"operation": "executeQuery"
},
"retryOnFail": true,
"typeVersion": 2.6,
"alwaysOutputData": true
},
{
"id": "4c385ae2-6ffe-4f84-8647-cc347dd32ad4",
"name": "Notizzettel1",
"type": "n8n-nodes-base.stickyNote",
"position": [
4000,
680
],
"parameters": {
"width": 176,
"height": 80,
"content": "Gets unqualified leads which count 0,1,2,3 respective time"
},
"typeVersion": 1
},
{
"id": "fcdf84ff-57e4-4faa-adcb-c0e3d707e34c",
"name": "Zeitplan-Trigger",
"type": "n8n-nodes-base.scheduleTrigger",
"position": [
3720,
520
],
"parameters": {
"rule": {
"interval": [
{
"field": "seconds"
}
]
}
},
"typeVersion": 1.2
},
{
"id": "00e9e762-8a4a-46be-85e8-e3bbd86bfc07",
"name": "Code1",
"type": "n8n-nodes-base.code",
"position": [
4780,
540
],
"parameters": {
"jsCode": "// Define matrix with count mapping\nconst matrix = {\n nexus: {\n 0: \"🛵 sample1\",\n 1: \"⚡️ sample1\",\n 2: \"🔋 sample1\",\n 3: \"✨ sample1\"\n },\n magnus: {\n 0: \"🛵 sample2\",\n 1: \"⚡️ sample2\",\n 2: \"🔋 sample2\",\n 3: \"✨ sample2\"\n },\n reo: {\n 0: \"🛵 sample3\",\n 1: \"⚡️ sample3\",\n 2: \"🔋 sample3\",\n 3: \"✨sample3\"\n },\n general: {\n 0: \"🛵 sample4\",\n 1: \"⚡️sample4\",\n 2: \"🔋 sample4\",\n 3: \"✨ sample3\"\n }\n};\n\n// Get inputs from previous node\nconst model = $input.first().json.model// \"nexus\" / \"reo\" / \"magnus\" / \"general\"\nconst count = $input.first().json.count // 0 / 1 / 2 / 3\n\n// const model = \"general\"; \n// const count = 0; \n\n// Fetch matching content\nconst output = matrix[model]?.[count] || \"🛵 default\";\n\n// Return as output\nreturn [{ json: { model, count, output } }];"
},
"typeVersion": 2
},
{
"id": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
"name": "Durchlaufe Elemente4",
"type": "n8n-nodes-base.splitInBatches",
"position": [
4520,
520
],
"parameters": {
"options": {}
},
"typeVersion": 3
},
{
"id": "a7846d82-40fa-4f73-b22a-a100009d276c",
"name": "neuer_Lead_4",
"type": "n8n-nodes-base.httpRequest",
"onError": "continueRegularOutput",
"position": [
5000,
540
],
"parameters": {
"url": "https://server.gallabox.com/devapi/messages/whatsapp",
"method": "POST",
"options": {
"response": {
"response": {
"fullResponse": true
}
}
},
"jsonBody": "=add here your copy api for whatsapp sending\n{\n \"channelId\": \"0\",\n \"channelType\": \"whatsapp\",\n \"recipient\": {\n \"name\": \"{{ $('Execute a SQL query').item.json.name }}\",\n \"phone\": \"91{{ $('Execute a SQL query').item.json.phone }}\"\n },\n \"whatsapp\": {\n \"type\": \"template\",\n \"template\": {\n \"templateName\": \"waba_qual_21july25\",\n \"bodyValues\": {\n \"Name\": \"{{ $('Execute a SQL query').item.json.name }}\",\n \"Details\": \"{{ $json.output }}\"\n },\n \"buttonValues\": [\n {\n \"index\": 0,\n \"sub_type\": \"quick_reply\",\n \"parameters\": {\n \"type\": \"payload\",\n \"payload\": \"Show Brochure\"\n }\n },\n {\n \"index\": 1,\n \"sub_type\": \"quick_reply\",\n \"parameters\": {\n \"type\": \"payload\",\n \"payload\": \"Get Showroom Location\"\n }\n },\n {\n \"index\": 2,\n \"sub_type\": \"quick_reply\",\n \"parameters\": {\n \"type\": \"payload\",\n \"payload\": \"Not Interested\"\n }\n }\n ]\n }\n }\n}",
"sendBody": true,
"jsonHeaders": "{\n \"apiKey\": \"\",\n \"apiSecret\": \"\"\n}",
"sendHeaders": true,
"specifyBody": "json",
"authentication": "genericCredentialType",
"specifyHeaders": "json",
"genericAuthType": "httpCustomAuth"
},
"typeVersion": 4.1
},
{
"id": "505800b6-fbe6-49bd-bd97-5cfb3a34da8c",
"name": "Aktualisiere Tabellenzeilen4",
"type": "n8n-nodes-base.postgres",
"position": [
5500,
540
],
"parameters": {
"table": {
"__rl": true,
"mode": "list",
"value": "mql_contacts",
"cachedResultName": "mql_contacts"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "MQL",
"cachedResultName": "MQL"
},
"columns": {
"value": {
"count": "={{ $('Execute a SQL query').item.json.count + 1 }}",
"phone": "={{ $('Execute a SQL query').item.json.phone }}",
"pincode": 0,
"last_message_sent": "={{ $json.last_sent }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "created_at",
"type": "dateTime",
"display": true,
"removed": true,
"required": false,
"displayName": "created_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "updated_at",
"type": "dateTime",
"display": true,
"removed": true,
"required": false,
"displayName": "updated_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "name",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "phone",
"type": "number",
"display": true,
"removed": false,
"required": true,
"displayName": "phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_message_sent",
"type": "dateTime",
"display": true,
"required": false,
"displayName": "last_message_sent",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "disposition",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "disposition",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "count",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "interval",
"type": "number",
"display": true,
"removed": true,
"required": false,
"displayName": "interval",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "remarks",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "remarks",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "model",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "model",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "pincode",
"type": "number",
"display": true,
"removed": false,
"required": false,
"displayName": "pincode",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "ABOS API status",
"type": "string",
"display": true,
"removed": false,
"required": false,
"displayName": "ABOS API status",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "webhook_time",
"type": "dateTime",
"display": true,
"removed": false,
"required": false,
"displayName": "webhook_time",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"phone"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {},
"operation": "update"
},
"typeVersion": 2.6
},
{
"id": "f7729e9d-8f3b-477a-88fe-513be43997e4",
"name": "Füge Tabellenzeilen ein4",
"type": "n8n-nodes-base.postgres",
"position": [
5280,
540
],
"parameters": {
"table": {
"__rl": true,
"mode": "list",
"value": "mql_logs",
"cachedResultName": "mql_logs"
},
"schema": {
"__rl": true,
"mode": "list",
"value": "MQL",
"cachedResultName": "MQL"
},
"columns": {
"value": {
"name": "={{ $('Execute a SQL query').item.json.name }}",
"phone": "={{ $('Execute a SQL query').item.json.phone }}",
"remarks": "Workflow 1",
"last_sent": "={{ $('Execute a SQL query').item.json.last_message_sent }}",
"mes_count": "={{ $('Execute a SQL query').item.json.count }}",
"message_id": "={{ $json.body.id }}",
"disposition": "={{ $('Execute a SQL query').item.json.disposition }}",
"gb_status_code": "={{ $json.statusCode }}",
"gb_status_message": "={{ $json.body.status }}"
},
"schema": [
{
"id": "id",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "id",
"defaultMatch": true,
"canBeUsedToMatch": true
},
{
"id": "created_at",
"type": "dateTime",
"display": true,
"required": false,
"displayName": "created_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "updated_at",
"type": "dateTime",
"display": true,
"required": false,
"displayName": "updated_at",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "message_id",
"type": "string",
"display": true,
"required": false,
"displayName": "message_id",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "name",
"type": "string",
"display": true,
"required": false,
"displayName": "name",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "phone",
"type": "number",
"display": true,
"required": true,
"displayName": "phone",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "disposition",
"type": "string",
"display": true,
"required": false,
"displayName": "disposition",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "mes_count",
"type": "number",
"display": true,
"required": false,
"displayName": "mes_count",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "last_sent",
"type": "dateTime",
"display": true,
"required": false,
"displayName": "last_sent",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "gb_status_code",
"type": "number",
"display": true,
"required": false,
"displayName": "gb_status_code",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "gb_status_message",
"type": "string",
"display": true,
"required": false,
"displayName": "gb_status_message",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "message_status_meta",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "message_status_meta",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "cta",
"type": "string",
"display": true,
"removed": true,
"required": false,
"displayName": "cta",
"defaultMatch": false,
"canBeUsedToMatch": true
},
{
"id": "remarks",
"type": "string",
"display": true,
"required": false,
"displayName": "remarks",
"defaultMatch": false,
"canBeUsedToMatch": true
}
],
"mappingMode": "defineBelow",
"matchingColumns": [
"id"
],
"attemptToConvertTypes": false,
"convertFieldsToString": false
},
"options": {}
},
"typeVersion": 2.6
},
{
"id": "a6bb388a-17f3-4e24-94a4-47abf67dacf4",
"name": "Notizzettel",
"type": "n8n-nodes-base.stickyNote",
"position": [
4640,
420
],
"parameters": {
"width": 216,
"height": 80,
"content": "Matrixed code to add unque message for pushing that to message with variable\n"
},
"typeVersion": 1
},
{
"id": "afd6a70f-80ae-4c3e-8b82-bd784dacfbe5",
"name": "Notizzettel2",
"type": "n8n-nodes-base.stickyNote",
"position": [
5000,
420
],
"parameters": {
"width": 150,
"height": 80,
"content": "Gallabox/whatsapp sending api"
},
"typeVersion": 1
},
{
"id": "13fe2f75-fe06-423a-9334-a4be0025624d",
"name": "Notizzettel3",
"type": "n8n-nodes-base.stickyNote",
"position": [
5380,
420
],
"parameters": {
"width": 150,
"height": 80,
"content": "Postgres connection to store data "
},
"typeVersion": 1
}
],
"pinData": {},
"connections": {
"00e9e762-8a4a-46be-85e8-e3bbd86bfc07": {
"main": [
[
{
"node": "a7846d82-40fa-4f73-b22a-a100009d276c",
"type": "main",
"index": 0
}
]
]
},
"a7846d82-40fa-4f73-b22a-a100009d276c": {
"main": [
[
{
"node": "f7729e9d-8f3b-477a-88fe-513be43997e4",
"type": "main",
"index": 0
}
]
]
},
"8c5fad3d-46b3-427e-ab5a-205712394bd0": {
"main": [
[],
[
{
"node": "00e9e762-8a4a-46be-85e8-e3bbd86bfc07",
"type": "main",
"index": 0
}
]
]
},
"fcdf84ff-57e4-4faa-adcb-c0e3d707e34c": {
"main": [
[
{
"node": "84e5aa63-1375-4aa5-980a-b8d252d7535b",
"type": "main",
"index": 0
}
]
]
},
"84e5aa63-1375-4aa5-980a-b8d252d7535b": {
"main": [
[
{
"node": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
"type": "main",
"index": 0
}
]
]
},
"f7729e9d-8f3b-477a-88fe-513be43997e4": {
"main": [
[
{
"node": "505800b6-fbe6-49bd-bd97-5cfb3a34da8c",
"type": "main",
"index": 0
}
]
]
},
"505800b6-fbe6-49bd-bd97-5cfb3a34da8c": {
"main": [
[
{
"node": "8c5fad3d-46b3-427e-ab5a-205712394bd0",
"type": "main",
"index": 0
}
]
]
}
}
}Wie verwende ich diesen Workflow?
Kopieren Sie den obigen JSON-Code, erstellen Sie einen neuen Workflow in Ihrer n8n-Instanz und wählen Sie "Aus JSON importieren". Fügen Sie die Konfiguration ein und passen Sie die Anmeldedaten nach Bedarf an.
Für welche Szenarien ist dieser Workflow geeignet?
Fortgeschritten - Lead-Pflege, Multimodales KI
Ist es kostenpflichtig?
Dieser Workflow ist völlig kostenlos. Beachten Sie jedoch, dass Drittanbieterdienste (wie OpenAI API), die im Workflow verwendet werden, möglicherweise kostenpflichtig sind.
Verwandte Workflows
Rahi
@rahiuppalAI and Automation Consultant with over 1000 hours of experience building, deploying, and solving marketing and sales automation problems. I ship AI products faster by combining business acumen with AI & automation expertise and an engineering mindset. Connect with me on LinkedIn to chat.
Diesen Workflow teilen