This workflow follows the HTTP Request → OpenAI recipe pattern — see all workflows that pair these two integrations.
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": "AutoAtende \u2014 Resposta por IA (RAG + GPT-4o-mini)",
"nodes": [
{
"id": "node-webhook-msg",
"name": "Webhook \u2014 Mensagem Livre",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
250,
300
],
"parameters": {
"httpMethod": "POST",
"path": "evolution-mensagem",
"responseMode": "lastNode",
"options": {}
}
},
{
"id": "node-checar-pergunta",
"name": "Checar \u2014 \u00c9 Pergunta?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
500,
300
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.body.data.message.conversation }}",
"operation": "isNotEmpty"
}
],
"number": [
{
"value1": "={{ $json.body.data.message.conversation.length }}",
"operation": "larger",
"value2": 3
}
]
},
"combineOperation": "all"
}
},
{
"id": "node-checar-cache",
"name": "Redis \u2014 Verificar Cache",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
750,
200
],
"parameters": {
"method": "GET",
"url": "={{ $vars.REDIS_HTTP_URL }}/get/ai_cache_{{ $json.body.data.key.remoteJid }}_{{ $json.body.data.message.conversation.toLowerCase().trim().replace(/\\s+/g,'_').substring(0,50) }}",
"options": {
"timeout": 3000,
"redirect": {
"redirect": {
"followRedirects": true
}
}
},
"onError": "continueRegularOutput"
}
},
{
"id": "node-cache-hit",
"name": "Cache \u2014 Tem Resposta?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
1000,
200
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.result }}",
"operation": "isNotEmpty"
}
]
}
}
},
{
"id": "node-buscar-drive",
"name": "Google Drive \u2014 Buscar Contexto",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
1250,
350
],
"parameters": {
"method": "GET",
"url": "=https://www.googleapis.com/drive/v3/files?q='{{ $vars.DRIVE_FOLDER_ID }}'+in+parents+and+mimeType='text/plain'&fields=files(id,name)&key={{ $vars.GOOGLE_DRIVE_API_KEY }}",
"options": {}
}
},
{
"id": "node-ler-arquivos",
"name": "Ler Arquivos do Drive",
"type": "n8n-nodes-base.code",
"typeVersion": 2,
"position": [
1500,
350
],
"parameters": {
"jsCode": "// L\u00ea o conte\u00fado de cada arquivo e concatena\n// Limitado a 8000 tokens (~32000 caracteres)\nconst files = $input.first().json.files || [];\nconst MAX_CHARS = 32000;\n\nlet contexto = '';\nfor (const file of files) {\n // Nota: na implementa\u00e7\u00e3o real, fazer fetch do conte\u00fado de cada arquivo\n // Aqui retornamos o array de IDs para o pr\u00f3ximo node processar\n contexto += `[Arquivo: ${file.name} | ID: ${file.id}]\\n`;\n}\n\nconst mensagem = $('Webhook \u2014 Mensagem Livre').first().json.body?.data?.message?.conversation || '';\nconst telefone = $('Webhook \u2014 Mensagem Livre').first().json.body?.data?.key?.remoteJid || '';\nconst instancia = $('Webhook \u2014 Mensagem Livre').first().json.body?.instance || '';\n\nreturn [{\n json: {\n mensagem,\n telefone,\n instancia,\n filesContext: contexto,\n filesList: files\n }\n}];"
}
},
{
"id": "node-openai",
"name": "OpenAI \u2014 GPT-4o-mini",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
1750,
350
],
"parameters": {
"resource": "text",
"operation": "message",
"modelId": "gpt-4o-mini",
"messages": {
"values": [
{
"role": "system",
"content": "=Voc\u00ea \u00e9 o assistente virtual da empresa {{ $vars.NOME_CLIENTE }}.\nResponda APENAS com base nas informa\u00e7\u00f5es fornecidas abaixo.\nSe a pergunta n\u00e3o puder ser respondida com essas informa\u00e7\u00f5es, responda: 'Vou verificar isso com nossa equipe e te retorno em breve! \ud83d\ude0a'\nSeja direto, amig\u00e1vel e use no m\u00e1ximo 3 frases. Nunca invente informa\u00e7\u00f5es.\n\nINFORMA\u00c7\u00d5ES DA EMPRESA:\n{{ $json.filesContext }}"
},
{
"role": "user",
"content": "={{ $json.mensagem }}"
}
]
},
"options": {
"maxTokens": 300,
"temperature": 0.3
}
},
"credentials": {
"openAiApi": {
"name": "<your credential>"
}
}
},
{
"id": "node-checar-resposta-ia",
"name": "IA Soube Responder?",
"type": "n8n-nodes-base.if",
"typeVersion": 1,
"position": [
2000,
350
],
"parameters": {
"conditions": {
"string": [
{
"value1": "={{ $json.message.content }}",
"operation": "notContains",
"value2": "Vou verificar"
}
]
}
}
},
{
"id": "node-salvar-cache",
"name": "Redis \u2014 Salvar Cache (1h)",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
2250,
200
],
"parameters": {
"method": "POST",
"url": "={{ $vars.REDIS_HTTP_URL }}/set",
"sendBody": true,
"contentType": "json",
"body": "={\n \"key\": \"ai_cache_{{ $('Ler Arquivos do Drive').first().json.telefone }}_{{ $('Ler Arquivos do Drive').first().json.mensagem.toLowerCase().trim().replace(/\\s+/g,'_').substring(0,50) }}\",\n \"value\": \"{{ $json.message.content }}\",\n \"ex\": 3600\n}",
"options": {
"timeout": 3000
},
"onError": "continueRegularOutput"
}
},
{
"id": "node-enviar-resposta-ia",
"name": "Evolution \u2014 Enviar Resposta IA",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
2500,
200
],
"parameters": {
"method": "POST",
"url": "={{ $vars.EVOLUTION_URL }}/message/sendText/{{ $('Ler Arquivos do Drive').first().json.instancia }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "={{ $vars.EVOLUTION_API_KEY }}"
}
]
},
"sendBody": true,
"contentType": "json",
"body": "={\n \"number\": \"{{ $('Ler Arquivos do Drive').first().json.telefone }}\",\n \"text\": \"{{ $json.message.content }}\"\n}"
}
},
{
"id": "node-acionar-handoff",
"name": "Acionar Handoff Humano",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
2250,
500
],
"parameters": {
"method": "POST",
"url": "=https://n8n.{{ $vars.DOMAIN }}/webhook/human-handoff",
"sendBody": true,
"contentType": "json",
"body": "={\n \"telefone\": \"{{ $('Ler Arquivos do Drive').first().json.telefone }}\",\n \"mensagem_original\": \"{{ $('Ler Arquivos do Drive').first().json.mensagem }}\",\n \"motivo\": \"IA n\u00e3o soube responder\"\n}"
}
},
{
"id": "node-enviar-cache-hit",
"name": "Evolution \u2014 Enviar Resposta Cache",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4,
"position": [
1250,
100
],
"parameters": {
"method": "POST",
"url": "={{ $vars.EVOLUTION_URL }}/message/sendText/{{ $('Webhook \u2014 Mensagem Livre').first().json.body.instance }}",
"sendHeaders": true,
"headerParameters": {
"parameters": [
{
"name": "apikey",
"value": "={{ $vars.EVOLUTION_API_KEY }}"
}
]
},
"sendBody": true,
"contentType": "json",
"body": "={\n \"number\": \"{{ $('Webhook \u2014 Mensagem Livre').first().json.body.data.key.remoteJid }}\",\n \"text\": \"{{ $json.result }}\"\n}"
}
},
{
"id": "node-ignorar",
"name": "Ignorar \u2014 N\u00e3o \u00e9 Pergunta",
"type": "n8n-nodes-base.noOp",
"typeVersion": 1,
"position": [
750,
450
],
"parameters": {}
}
],
"connections": {
"Webhook \u2014 Mensagem Livre": {
"main": [
[
{
"node": "Checar \u2014 \u00c9 Pergunta?",
"type": "main",
"index": 0
}
]
]
},
"Checar \u2014 \u00c9 Pergunta?": {
"main": [
[
{
"node": "Redis \u2014 Verificar Cache",
"type": "main",
"index": 0
}
],
[
{
"node": "Ignorar \u2014 N\u00e3o \u00e9 Pergunta",
"type": "main",
"index": 0
}
]
]
},
"Redis \u2014 Verificar Cache": {
"main": [
[
{
"node": "Cache \u2014 Tem Resposta?",
"type": "main",
"index": 0
}
]
]
},
"Cache \u2014 Tem Resposta?": {
"main": [
[
{
"node": "Evolution \u2014 Enviar Resposta Cache",
"type": "main",
"index": 0
}
],
[
{
"node": "Google Drive \u2014 Buscar Contexto",
"type": "main",
"index": 0
}
]
]
},
"Google Drive \u2014 Buscar Contexto": {
"main": [
[
{
"node": "Ler Arquivos do Drive",
"type": "main",
"index": 0
}
]
]
},
"Ler Arquivos do Drive": {
"main": [
[
{
"node": "OpenAI \u2014 GPT-4o-mini",
"type": "main",
"index": 0
}
]
]
},
"OpenAI \u2014 GPT-4o-mini": {
"main": [
[
{
"node": "IA Soube Responder?",
"type": "main",
"index": 0
}
]
]
},
"IA Soube Responder?": {
"main": [
[
{
"node": "Redis \u2014 Salvar Cache (1h)",
"type": "main",
"index": 0
}
],
[
{
"node": "Acionar Handoff Humano",
"type": "main",
"index": 0
}
]
]
},
"Redis \u2014 Salvar Cache (1h)": {
"main": [
[
{
"node": "Evolution \u2014 Enviar Resposta IA",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
},
"tags": [
{
"name": "autoatende"
},
{
"name": "ai-responder"
}
]
}
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.
openAiApi
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
AutoAtende — Resposta por IA (RAG + GPT-4o-mini). Uses httpRequest, openAi. Webhook trigger; 13 nodes.
Source: https://github.com/HeitorRafael/Auto-Zap/blob/184de9f2ddcc90f94cf5f89d85774f9e3687dcc7/n8n-workflows/ai-responder.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 workflow captures new leads via webhook, enriches and scores them with Apollo and Google Gemini, logs everything in Google Sheets, and automates outreach, reply handling, follow-ups, meeting prep
This powerful n8n automation workflow is designed to execute advanced B2B lead enrichment and hyper-personalization for cold email outreach. By orchestrating a complex chain of data scraping, AI analy
Propulsar — Content Engine v3. Uses openAi, httpRequest, googleSheets. Webhook trigger; 73 nodes.
Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.
Postagem Redes — Portal: Ações. Uses openAi, googleGemini, ollama, httpRequest. Webhook trigger; 58 nodes.