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": "BIG-AGENT-COMPLETE",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "big-agent-webhook",
"options": {
"responseMode": "responseNode"
}
},
"id": "webhook",
"name": "Webhook Z-API",
"type": "n8n-nodes-base.webhook",
"typeVersion": 2.1,
"position": [
0,
300
]
},
{
"parameters": {
"respondWith": "json",
"responseBody": "={{ JSON.stringify({ status: 'received' }) }}",
"options": {}
},
"id": "respond-200",
"name": "Responder 200",
"type": "n8n-nodes-base.respondToWebhook",
"typeVersion": 1.1,
"position": [
220,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "filter-recebida",
"leftValue": "={{ $json.fromMe }}",
"rightValue": false,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "filter-recebida",
"name": "Filtrar Recebidas",
"type": "n8n-nodes-base.filter",
"typeVersion": 2,
"position": [
440,
300
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "telefone",
"name": "telefone",
"value": "={{ $json.phone.replace('@c.us', '').replace('@s.whatsapp.net', '') }}",
"type": "string"
},
{
"id": "mensagem",
"name": "mensagem",
"value": "={{ $json.text?.message || $json.body || '' }}",
"type": "string"
},
{
"id": "nome_push",
"name": "nome_push",
"value": "={{ $json.senderName || $json.pushName || '' }}",
"type": "string"
}
]
},
"options": {}
},
"id": "parse-mensagem",
"name": "Parsear Mensagem",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
660,
300
]
},
{
"parameters": {
"promptType": "define",
"text": "=Classifique a intencao da mensagem.\n\nMensagem: {{ $json.mensagem }}\n\nIntencoes possiveis: SAUDACAO, INTERESSE, DUVIDA_PRODUTO, PRECO, OBJECAO_DINHEIRO, OBJECAO_TEMPO, OBJECAO_DUVIDA, OBJECAO_EXTERNA, COMPRAR, SUPORTE, RECLAMACAO, HUMANO, OFFTOPIC, DESPEDIDA\n\nResponda APENAS com JSON: {\"intencao\": \"TIPO\", \"confianca\": 0.95}",
"options": {
"systemMessage": "Voce e um classificador de intencoes. Responda APENAS com JSON valido, nada mais."
}
},
"id": "classificar-intencao",
"name": "Classificar Intencao",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
880,
300
]
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-3-haiku-20240307",
"cachedResultName": "Claude 3 Haiku"
},
"options": {
"maxTokensToSample": 100,
"temperature": 0
}
},
"id": "haiku-model",
"name": "Haiku Model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
880,
500
]
},
{
"parameters": {
"jsCode": "const input = $input.all()[0].json;\nconst intencaoRaw = input.output || '{}';\n\nlet intencao;\ntry {\n const match = intencaoRaw.match(/\\{[\\s\\S]*\\}/);\n intencao = match ? JSON.parse(match[0]) : { intencao: 'SAUDACAO', confianca: 0.5 };\n} catch (e) {\n intencao = { intencao: 'SAUDACAO', confianca: 0.5 };\n}\n\nconst telefone = $('Parsear Mensagem').item.json.telefone;\nconst mensagem = $('Parsear Mensagem').item.json.mensagem;\nconst nome = $('Parsear Mensagem').item.json.nome_push;\n\nreturn {\n json: {\n telefone,\n mensagem,\n nome,\n intencao: intencao.intencao,\n confianca: intencao.confianca,\n precisa_escalar: ['HUMANO', 'RECLAMACAO'].includes(intencao.intencao)\n }\n};"
},
"id": "processar-intencao",
"name": "Processar Intencao",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1100,
300
]
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict"
},
"conditions": [
{
"id": "precisa-escalar",
"leftValue": "={{ $json.precisa_escalar }}",
"rightValue": true,
"operator": {
"type": "boolean",
"operation": "equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"id": "if-escalar",
"name": "Precisa Escalar?",
"type": "n8n-nodes-base.if",
"typeVersion": 2,
"position": [
1320,
300
]
},
{
"parameters": {
"promptType": "define",
"text": "=LEAD: {{ $json.nome || 'Desconhecido' }}\nTELEFONE: {{ $json.telefone }}\nINTENCAO: {{ $json.intencao }}\n\nMENSAGEM DO LEAD:\n{{ $json.mensagem }}\n\nResponda como Marcia. Separe multiplas mensagens com ---",
"options": {
"systemMessage": "Voce e Marcia, 52 anos, closer de vendas disfar\u00e7ada de amiga acolhedora.\n\nREGRAS ABSOLUTAS:\n1. NUNCA abrevie: sempre \"voce\" (nunca \"vc\"), \"tambem\" (nunca \"tb\")\n2. RISADA: apenas \"rs\". NUNCA \"kkkk\" ou \"haha\"\n3. EMOJI: maximo 1 por mensagem, apenas: \ud83d\ude0a \ud83d\ude4f \u2764\ufe0f \ud83c\udf89\n4. MENSAGENS CURTAS: max 3-4 linhas cada\n5. Separe mensagens multiplas com --- em linha sozinha\n\nSUA HISTORIA:\n- Ex-gerente Banco do Brasil, 20 anos, saiu no PDV\n- Casada 28 anos com Carlos, mae de Fernanda (27) e Lucas (24)\n- Avo do Theo (4 anos) - quarta e dia sagrado com ele\n\nOS 7 MANDAMENTOS:\n1. Nunca vendo. Ajudo a decidir.\n2. Quem fala mais, perde.\n3. Toda pergunta e uma seta.\n4. Validar antes de redirecionar.\n5. Venda na emocao, justifique na razao.\n6. Paciencia infinita, urgencia invisivel.\n7. Relacionamento primeiro, venda como consequencia.\n\nResponda APENAS com as mensagens da Marcia, separadas por ---"
}
},
"id": "gerar-resposta",
"name": "Gerar Resposta (Marcia)",
"type": "@n8n/n8n-nodes-langchain.agent",
"typeVersion": 3,
"position": [
1540,
440
]
},
{
"parameters": {
"model": {
"__rl": true,
"mode": "list",
"value": "claude-sonnet-4-5-20250929",
"cachedResultName": "Claude Sonnet 4.5"
},
"options": {
"maxTokensToSample": 400,
"temperature": 0.7
}
},
"id": "sonnet-model",
"name": "Sonnet Model",
"type": "@n8n/n8n-nodes-langchain.lmChatAnthropic",
"typeVersion": 1.3,
"position": [
1540,
640
]
},
{
"parameters": {
"tableId": "ba_leads",
"fieldsToMatchOn": [
"telefone"
],
"fieldsToUpsert": {
"fieldMappings": [
{
"fieldName": "telefone",
"fieldValue": "={{ $json.telefone }}"
},
{
"fieldName": "nome",
"fieldValue": "={{ $json.nome }}"
}
]
}
},
"id": "supabase-leads-tool",
"name": "Supabase Leads Tool",
"type": "n8n-nodes-base.supabaseTool",
"typeVersion": 1,
"position": [
1760,
640
]
},
{
"parameters": {
"jsCode": "const input = $input.all()[0].json;\nconst respostaRaw = input.output || '';\nconst telefone = $('Processar Intencao').item.json.telefone;\n\nconst mensagens = respostaRaw\n .split(/\\n---\\n|---/)\n .map(m => m.trim())\n .filter(m => m.length > 0);\n\nif (mensagens.length === 0) {\n mensagens.push('Oi! Tudo bem com voce?');\n}\n\nconst output = mensagens.map((msg, idx) => {\n const delayMs = Math.min(Math.max(msg.length * 50 + Math.random() * 1000, 1000), 5000);\n return {\n json: {\n mensagem: msg,\n delay_ms: Math.round(delayMs),\n indice: idx,\n total: mensagens.length,\n telefone: telefone\n }\n };\n});\n\nreturn output;"
},
"id": "humanizar-resposta",
"name": "Humanizar Resposta",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1760,
440
]
},
{
"parameters": {
"batchSize": 1,
"options": {}
},
"id": "loop-mensagens",
"name": "Loop Mensagens",
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
1980,
440
]
},
{
"parameters": {
"amount": "={{ $json.delay_ms }}",
"unit": "milliseconds"
},
"id": "delay-humanizado",
"name": "Delay Humanizado",
"type": "n8n-nodes-base.wait",
"typeVersion": 1.1,
"position": [
2200,
440
]
},
{
"parameters": {
"jsCode": "const input = $input.first().json;\nconsole.log('[MOCK Z-API] Para:', input.telefone);\nconsole.log('[MOCK Z-API] Msg:', input.mensagem);\n\nreturn {\n json: {\n ...input,\n zapi_response: { status: 'SENT_MOCK', zapiMessageId: 'mock-' + Date.now() }\n }\n};"
},
"id": "enviar-zapi",
"name": "Enviar Z-API (MOCK)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
2420,
440
]
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "msg-escalacao",
"name": "mensagem",
"value": "Vou te passar pra alguem que pode te ajudar melhor com isso.",
"type": "string"
},
{
"id": "telefone",
"name": "telefone",
"value": "={{ $json.telefone }}",
"type": "string"
}
]
},
"options": {}
},
"id": "msg-escalacao",
"name": "Msg Escalacao",
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1540,
160
]
},
{
"parameters": {
"jsCode": "const input = $input.first().json;\nconsole.log('[MOCK ESCALACAO] Para:', input.telefone);\nconsole.log('[MOCK ESCALACAO] Msg:', input.mensagem);\nreturn { json: { ...input, status: 'ESCALADO' } };"
},
"id": "enviar-escalacao",
"name": "Enviar Escalacao (MOCK)",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1760,
160
]
}
],
"connections": {
"Webhook Z-API": {
"main": [
[
{
"node": "Responder 200",
"type": "main",
"index": 0
}
]
]
},
"Responder 200": {
"main": [
[
{
"node": "Filtrar Recebidas",
"type": "main",
"index": 0
}
]
]
},
"Filtrar Recebidas": {
"main": [
[
{
"node": "Parsear Mensagem",
"type": "main",
"index": 0
}
]
]
},
"Parsear Mensagem": {
"main": [
[
{
"node": "Classificar Intencao",
"type": "main",
"index": 0
}
]
]
},
"Haiku Model": {
"ai_languageModel": [
[
{
"node": "Classificar Intencao",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Classificar Intencao": {
"main": [
[
{
"node": "Processar Intencao",
"type": "main",
"index": 0
}
]
]
},
"Processar Intencao": {
"main": [
[
{
"node": "Precisa Escalar?",
"type": "main",
"index": 0
}
]
]
},
"Precisa Escalar?": {
"main": [
[
{
"node": "Msg Escalacao",
"type": "main",
"index": 0
}
],
[
{
"node": "Gerar Resposta (Marcia)",
"type": "main",
"index": 0
}
]
]
},
"Msg Escalacao": {
"main": [
[
{
"node": "Enviar Escalacao (MOCK)",
"type": "main",
"index": 0
}
]
]
},
"Sonnet Model": {
"ai_languageModel": [
[
{
"node": "Gerar Resposta (Marcia)",
"type": "ai_languageModel",
"index": 0
}
]
]
},
"Supabase Leads Tool": {
"ai_tool": [
[
{
"node": "Gerar Resposta (Marcia)",
"type": "ai_tool",
"index": 0
}
]
]
},
"Gerar Resposta (Marcia)": {
"main": [
[
{
"node": "Humanizar Resposta",
"type": "main",
"index": 0
}
]
]
},
"Humanizar Resposta": {
"main": [
[
{
"node": "Loop Mensagens",
"type": "main",
"index": 0
}
]
]
},
"Loop Mensagens": {
"main": [
[
{
"node": "Delay Humanizado",
"type": "main",
"index": 0
}
],
[]
]
},
"Delay Humanizado": {
"main": [
[
{
"node": "Enviar Z-API (MOCK)",
"type": "main",
"index": 0
}
]
]
},
"Enviar Z-API (MOCK)": {
"main": [
[
{
"node": "Loop Mensagens",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
BIG-AGENT-COMPLETE. Uses supabase, lmChatAnthropic. Webhook trigger; 24 nodes.
Source: https://gist.github.com/TheBigMeister/9c8dcb9da6bba5542cace41eaf9fd8e6 — 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.
⏺ 🚀 How it works
BIG-AGENT-V4-CONVERSAS. Uses redis, supabase, httpRequest, agent. Webhook trigger; 44 nodes.
BIG-AGENT-V3-SUPABASE. Uses redis, supabase, httpRequest, agent. Webhook trigger; 40 nodes.
BIG-AGENT-V3-PRO. Uses redis, supabase, httpRequest, agent. Webhook trigger; 39 nodes.
BIG-AGENT-V5-FIXED. Uses redis, supabase, agent, lmChatAnthropic. Webhook trigger; 35 nodes.