The workflow JSON
Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →
{
"name": "Engajamento - Router de eventos (nova indica\u00e7\u00e3o, meta, inatividade)",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "engagement/eventos",
"responseMode": "responseNode",
"options": {}
},
"id": "a1b2c3d4-0001-4000-9000-000000000001",
"name": "Webhook",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2,
"position": [
240,
300
]
},
{
"parameters": {
"jsCode": "// Roteia os eventos do backend (ENGAGEMENT_WEBHOOK_URL) e monta a mensagem.\n// Eventos tratados:\n// leader.points_awarded (awardedEventType=supporter.created) \u2192 avisa o l\u00edder na hora\n// leader.weekly_goal_reached \u2192 parab\u00e9ns por meta semanal\n// leader.inactive_7_days \u2192 resgate de lideran\u00e7a inativa\nconst body = $input.item.json.body || {};\nconst type = body.eventType;\nconst meta = body.metadata || {};\nconst phone = (body.phone || '').toString().replace(/\\D/g, '');\nconst name = body.userName || 'L\u00edder';\n\nlet message = null;\n\nif (type === 'leader.points_awarded' && meta.awardedEventType === 'supporter.created') {\n const who = meta.supporterName ? `*${meta.supporterName}*` : 'Um novo apoiador';\n const rank = body.rankingPosition ? ` (${body.rankingPosition}\u00ba no ranking)` : '';\n message =\n `\ud83c\udf89 ${name}, boa not\u00edcia! ${who} acabou de entrar na sua rede pelo seu link.\\n\\n` +\n `+${meta.points ?? 10} pontos para voc\u00ea \u2014 total: ${body.score} pts${rank}.\\n\\n` +\n `Continue compartilhando seu link! \ud83d\udcaa`;\n} else if (type === 'leader.weekly_goal_reached') {\n message =\n `\ud83d\udc4f Parab\u00e9ns, ${name}! Voc\u00ea bateu a meta semanal com ${body.weeklyIndications ?? ''} indica\u00e7\u00f5es. ` +\n `Seu trabalho est\u00e1 fortalecendo a rede \u2014 continue nesse ritmo!`;\n} else if (type === 'leader.inactive_7_days') {\n message =\n `Ol\u00e1, ${name}! \ud83d\ude4f Sentimos sua falta na Rede Guti \u2014 j\u00e1 faz uma semana sem novas indica\u00e7\u00f5es.\\n\\n` +\n `Que tal compartilhar seu link de cadastro hoje? Qualquer dificuldade, fale com a coordena\u00e7\u00e3o. \ud83d\udc99`;\n}\n\nreturn [{\n json: {\n phone,\n message,\n skip: !message || !phone,\n eventType: type,\n userId: body.userId || null\n }\n}];"
},
"id": "a1b2c3d4-0002-4000-9000-000000000002",
"name": "Montar mensagem",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
480,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "skip-check",
"leftValue": "={{$json.skip}}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "a1b2c3d4-0003-4000-9000-000000000003",
"name": "IF deve enviar",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
720,
300
]
},
{
"parameters": {
"method": "POST",
"url": "={{$env.WHATSAPP_API_URL}}",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"number\": \"{{$json.phone}}\",\n \"text\": {{JSON.stringify($json.message)}}\n}",
"options": {
"timeout": 10000,
"response": {
"response": {
"neverError": true,
"fullResponse": true
}
}
}
},
"id": "a1b2c3d4-0004-4000-9000-000000000004",
"name": "Enviar WhatsApp",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
960,
220
],
"credentials": {
"httpHeaderAuth": {
"name": "<your credential>"
}
},
"onError": "continueErrorOutput"
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"ok\": true,\n \"dispatched\": true,\n \"eventType\": \"{{$json.eventType}}\"\n}",
"options": {
"responseCode": 200
}
},
"id": "a1b2c3d4-0005-4000-9000-000000000005",
"name": "Responder OK",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1200,
140
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"ok\": false,\n \"error\": \"whatsapp_dispatch_failed\"\n}",
"options": {
"responseCode": 502
}
},
"id": "a1b2c3d4-0006-4000-9000-000000000006",
"name": "Responder erro WhatsApp",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
1200,
320
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={\n \"ok\": true,\n \"ignored\": true,\n \"reason\": \"evento_sem_mensagem_ou_sem_telefone\"\n}",
"options": {
"responseCode": 200
}
},
"id": "a1b2c3d4-0007-4000-9000-000000000007",
"name": "Ignorar evento",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
960,
440
]
}
],
"connections": {
"Webhook": {
"main": [
[
{
"node": "Montar mensagem",
"type": "main",
"index": 0
}
]
]
},
"Montar mensagem": {
"main": [
[
{
"node": "IF deve enviar",
"type": "main",
"index": 0
}
]
]
},
"IF deve enviar": {
"main": [
[
{
"node": "Enviar WhatsApp",
"type": "main",
"index": 0
}
],
[
{
"node": "Ignorar evento",
"type": "main",
"index": 0
}
]
]
},
"Enviar WhatsApp": {
"main": [
[
{
"node": "Responder OK",
"type": "main",
"index": 0
}
],
[
{
"node": "Responder erro WhatsApp",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"meta": {
"templateCredsSetupCompleted": false,
"description": "Ponto \u00fanico de entrada para o ENGAGEMENT_WEBHOOK_URL do backend. Trata leader.points_awarded (nova indica\u00e7\u00e3o \u2192 avisa o l\u00edder na hora), leader.weekly_goal_reached (parab\u00e9ns) e leader.inactive_7_days (resgate). Aponte ENGAGEMENT_WEBHOOK_URL para o webhook deste workflow. Vari\u00e1veis: WHATSAPP_API_URL; credential 'WhatsApp API Header Auth'. Substitui o workflow 'parabenizar-meta-semanal' quando ativo (n\u00e3o rode os dois ao mesmo tempo)."
},
"tags": []
}
Credentials you'll need
Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.
httpHeaderAuth
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
Engajamento - Router de eventos (nova indicação, meta, inatividade). Uses httpRequest. Webhook trigger; 7 nodes.
Source: https://github.com/kafune/rede-guti/blob/01a91919dd4115a611aee6a19adb1fa45ccb383f/automations/n8n/engajamento-router-eventos.json — original creator credit. Request a take-down →
Related workflows
Workflows that share integrations, category, or trigger type with this one. All free to copy and import.
This n8n template provides enterprise-level version control for your workflows using GitHub integration. Stop losing hours to broken workflows and manual exports – get proper commit history, visual di
This flow creates dummy files for every item added in your *Arrs (Radarr/Sonarr) with the tag .
This workflow receives webhook requests from a content calendar and uses the X API v2 to publish text posts, threads, image/video posts, and polls, as well as delete existing posts and run a credentia
This workflow acts as a central API gateway for all technical indicator agents in the Binance Spot Market Quant AI system. It listens for incoming webhook requests and dynamically routes them to the c
Sign PDF documents with legally-compliant digital signatures using X.509 certificates. Supports multiple PAdES signature levels (B, T, LT, LTA) with optional visible stamps.