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": {
"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": "query",
"value": "={{$json[\"body\"].message}}"
}
]
}
},
"name": "Supabase Semantic Search",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 1,
"position": [
450,
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. Baseie suas respostas exclusivamente no seguinte conte\u00fado:\n${context}\n\nPergunta: ${question}\nResposta:`;\nreturn [{ json: { prompt }}];"
},
"name": "Build Prompt for OpenAI",
"type": "n8n-nodes-base.function",
"typeVersion": 1,
"position": [
650,
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": [
850,
300
]
},
{
"parameters": {
"from": "whatsapp:+YOUR_TWILIO_NUMBER",
"to": "={{$json[\"body\"].from}}",
"message": "={{$json[\"choices\"][0][\"message\"][\"content\"]}}"
},
"name": "Send WhatsApp Reply via Twilio",
"type": "n8n-nodes-base.twilio",
"typeVersion": 1,
"position": [
1050,
300
]
},
{
"parameters": {
"note": "Este workflow recebe mensagens via webhook WhatsApp, busca documentos relevantes na base Supabase, gera resposta usando o modelo GPT-4 e envia a resposta pelo Twilio WhatsApp, sempre usando o personagem cordial DetranCE."
},
"name": "Sticky Note - Atendimento RAG",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
650,
180
]
}
],
"connections": {
"WhatsApp Webhook Trigger": {
"main": [
[
{
"node": "Supabase Semantic Search",
"type": "main",
"index": 0
}
]
]
},
"Supabase Semantic Search": {
"main": [
[
{
"node": "Build Prompt for OpenAI",
"type": "main",
"index": 0
}
]
]
},
"Build Prompt for OpenAI": {
"main": [
[
{
"node": "OpenAI Chat Completion",
"type": "main",
"index": 0
}
]
]
},
"OpenAI Chat Completion": {
"main": [
[
{
"node": "Send WhatsApp Reply via Twilio",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {},
"id": "detrance-atendimento-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.
DetranCE - Atendimento WhatsApp RAG. Uses httpRequest, openAi, twilio. Webhook trigger; 6 nodes.
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.