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": "DetranCE - Atendimento WhatsApp RAG",
"nodes": [
{
"parameters": {
"httpMethod": "POST",
"path": "whatsapp-webhook",
"responseMode": "onReceived"
},
"name": "WhatsApp Webhook Trigger",
"type": "n8n-nodes-base.webhook",
"typeVersion": 1,
"position": [
250,
300
]
},
{
"parameters": {
"model": "text-embedding-ada-002",
"input": "={{$json[\"body\"].message}}"
},
"name": "OpenAI - Criar Embedding da Pergunta",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
450,
300
]
},
{
"parameters": {
"url": "https://YOUR_SUPABASE_URL/rest/v1/rpc/search_documents",
"method": "POST",
"headerParametersUi": {
"parameter": [
{
"name": "apikey",
"value": "YOUR_SUPABASE_ANON_KEY"
},
{
"name": "Authorization",
"value": "Bearer YOUR_SUPABASE_SERVICE_ROLE_KEY"
},
{
"name": "Content-Type",
"value": "application/json"
}
]
},
"bodyParametersUi": {
"parameter": [
{
"name": "embedding",
"value": "={{$json[\"embedding\"]}}"
},
{
"name": "match_count",
"value": 5
}
]
}
},
"name": "Supabase Semantic Search",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
650,
300
]
},
{
"parameters": {
"functionCode": "const docs = $items(\"Supabase Semantic Search\").map(i => i.json);\nconst question = $json[\"body\"].message;\nconst context = docs.map(d => d.content).join('\\n---\\n');\nconst prompt = `Voc\u00ea \u00e9 DetranCE, um atendente digital cordial e educado. Responda apenas com base no conte\u00fado abaixo:\n${context}\n\nPergunta: ${question}\nResposta:`;\nreturn [{ json: { prompt }}];"
},
"name": "Montar Prompt para OpenAI",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
850,
300
]
},
{
"parameters": {
"model": "gpt-4",
"messages": [
{
"role": "user",
"content": "={{$json[\"prompt\"]}}"
}
],
"temperature": 0,
"max_tokens": 500
},
"name": "OpenAI Chat Completion",
"type": "n8n-nodes-base.openAi",
"typeVersion": 1,
"position": [
1050,
300
]
},
{
"parameters": {
"from": "whatsapp:+YOUR_TWILIO_NUMBER",
"to": "={{$json[\"body\"].from}}",
"message": "={{$json[\"choices\"][0][\"message\"][\"content\"]}}"
},
"name": "Enviar Resposta WhatsApp via Twilio",
"type": "n8n-nodes-base.twilio",
"typeVersion": 1,
"position": [
1250,
300
]
},
{
"parameters": {
"note": "Fluxo que recebe pergunta do WhatsApp, cria embedding, busca no Supabase, gera resposta com GPT e envia via Twilio."
},
"name": "Sticky Note - Atendimento WhatsApp RAG",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
850,
230
]
}
],
"connections": {
"WhatsApp Webhook Trigger": {
"main": [
[
{
"node": "OpenAI - Criar Embedding da Pergunta",
"type": "main",
"index": 0
}
]
]
},
"OpenAI - Criar Embedding da Pergunta": {
"main": [
[
{
"node": "Supabase Semantic Search",
"type": "main",
"index": 0
}
]
]
},
"Supabase Semantic Search": {
"main": [
[
{
"node": "Montar Prompt para OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Montar Prompt para OpenAI": {
"main": [
[
{
"node": "OpenAI Chat Completion",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Completion": {
"main": [
[
{
"node": "Enviar Resposta WhatsApp via Twilio",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": "detrance-atendimento-whatsapp-rag"
}
For the full experience including quality scoring and batch install features for each workflow upgrade to Pro
About this workflow
DetranCE - Atendimento WhatsApp RAG. Uses openAi, httpRequest, twilio. Webhook trigger; 7 nodes.
Source: https://gist.github.com/ruinaldoti/f8c835351b8974668835dcebb6459c6b — 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.
Fluxo WhatsApp com Envio de Vídeo. Uses httpRequest, twilio, openAi. Webhook trigger; 10 nodes.
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
Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.
This workflow bridges the gap between raw product data and revenue sales tools. It automates the entire Product Qualified Lead (PQL) lifecycle—from real-time intent routing to churn prevention—reducin
Lua Nova - Sistema Completo. Uses postgres, httpRequest, openAi. Webhook trigger; 55 nodes.