AutomationFlowsAI & RAG › AI Empathetic Nudge via WhatsApp

AI Empathetic Nudge via WhatsApp

Original n8n title: Otto - Épico 4: Nudge Acionável (assistente, Não Fiscal)

OTTO - Épico 4: Nudge Acionável (Assistente, não Fiscal). Uses postgres, openAi, httpRequest. Webhook trigger; 7 nodes.

Webhook trigger★★★★☆ complexityAI-powered7 nodesPostgresOpenAIHTTP Request
AI & RAG Trigger: Webhook Nodes: 7 Complexity: ★★★★☆ AI nodes: yes Added:

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 →

Download .json
{
  "name": "OTTO - \u00c9pico 4: Nudge Acion\u00e1vel (Assistente, n\u00e3o Fiscal)",
  "nodes": [
    {
      "parameters": {
        "content": "## \ud83d\udca1 \u00c9pico 4: Nudge Acion\u00e1vel\n\n**Filosofia**: Fazer o vendedor depender do sistema porque ele FACILITA a vida.\n\n**O que N\u00c3O fazer**: \"Voc\u00ea est\u00e1 h\u00e1 2 dias sem falar com o Marcos\"\n**O que FAZER**: \"Parceiro, o Marcos deve ter esfriado com a taxa do banco. Clica no bot\u00e3o que eu te mando uma mensagem pronta.\"\n\n**Bot\u00f5es**: [Gerar Mensagem] | [J\u00e1 falei com ele]\nEsfor\u00e7o do vendedor \u2192 ZERO. Ele vicia na ferramenta.",
        "height": 280,
        "width": 420,
        "color": 3
      },
      "id": "note-docs",
      "name": "\ud83d\udccb Documenta\u00e7\u00e3o",
      "type": "n8n-nodes-base.stickyNote",
      "typeVersion": 1,
      "position": [
        40,
        40
      ]
    },
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "otto_nudge_amarelo",
        "authentication": "headerAuth",
        "responseMode": "lastNode",
        "options": {}
      },
      "id": "webhook-nudge",
      "name": "Webhook: Zona Amarela Ativada",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 2,
      "position": [
        260,
        340
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "=SELECT ec.tipo_evento, ec.evidencia_ia, ec.criado_em, ec.estagio_anterior, ec.estagio_novo FROM eventos_comerciais ec WHERE ec.lead_id = '{{ $json.lead_id }}' ORDER BY ec.criado_em DESC LIMIT 3;",
        "options": {}
      },
      "id": "buscar-contexto",
      "name": "Buscar \u00daltimos Eventos",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        500,
        340
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "model": "gpt-4o-mini",
        "messages": {
          "values": [
            {
              "content": "Voc\u00ea \u00e9 o OTTO, assistente comercial da Attra Ve\u00edculos (concession\u00e1ria premium).\n\nVoc\u00ea precisa gerar uma mensagem de NUDGE emp\u00e1tica para o vendedor. N\u00c3O seja um fiscal.\nSeja um parceiro que facilita a vida dele.\n\nContexto do lead:\n- Nome: {{ $json.nome_cliente }}\n- Ve\u00edculo de interesse: {{ $json.veiculo_interesse }}\n- Est\u00e1gio: {{ $json.estagio_atual }}\n- Temperatura: {{ $json.temperatura }}\n- Horas sem intera\u00e7\u00e3o: {{ $json.horas_decorridas }}\n- \u00daltima obje\u00e7\u00e3o: {{ $json.ultima_objecao || 'N\u00e3o identificada' }}\n- \u00daltimos eventos: {{ JSON.stringify($json.ultimos_eventos || []) }}\n\nGere EXATAMENTE este JSON:\n{\n  \"nudge_vendedor\": \"Mensagem curta e emp\u00e1tica para o vendedor (m\u00e1x 200 chars). N\u00c3O diga 'voc\u00ea est\u00e1 h\u00e1 X dias'. SUGIRA uma a\u00e7\u00e3o concreta.\",\n  \"mensagem_sugerida_cliente\": \"Mensagem WhatsApp pronta para o vendedor enviar ao cliente (m\u00e1x 300 chars). Profissional mas humana.\",\n  \"estrategia\": \"Breve explica\u00e7\u00e3o da t\u00e1tica usada (ex: 'Oferecer simula\u00e7\u00e3o alternativa para contornar obje\u00e7\u00e3o de pre\u00e7o')\"\n}\n\nExemplos de bons nudges:\n- \"Parceiro, o Marcos deve ter esfriado com a taxa do banco. Clica no bot\u00e3o que eu te mando uma simula\u00e7\u00e3o com a financeira X.\"\n- \"O Carlos tava empolgado com o test drive. Bora mandar aquela foto do carro pronto pra ele?\"\n- \"A Dra. Ana pediu pra pensar, mas normalmente quem pede pra pensar quer ser convencido. Bora?\"",
              "role": "system"
            },
            {
              "content": "Gere o nudge para este lead.",
              "role": "user"
            }
          ]
        },
        "options": {
          "temperature": 0.7,
          "maxTokens": 500
        }
      },
      "id": "llm-nudge",
      "name": "LLM: Gerar Nudge Emp\u00e1tico",
      "type": "@n8n/n8n-nodes-langchain.openAi",
      "typeVersion": 1.4,
      "position": [
        740,
        340
      ],
      "credentials": {
        "openAiApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "jsCode": "// Preparar payload WhatsApp Interactive com bot\u00f5es de a\u00e7\u00e3o\nconst vars = $('Webhook: Zona Amarela Ativada').first().json;\nlet nudge;\ntry {\n  const raw = $input.first().json.text || '{}';\n  nudge = JSON.parse(raw.replace(/```json?\\n?/g, '').replace(/```/g, '').trim());\n} catch(e) {\n  nudge = {\n    nudge_vendedor: `\ud83d\udccb ${vars.nome_cliente} precisa de um follow-up. Clica em Gerar Mensagem que eu te ajudo.`,\n    mensagem_sugerida_cliente: `Ol\u00e1! Passando para saber se tem novidades sobre o ${vars.veiculo_interesse || 've\u00edculo'}. Estou \u00e0 disposi\u00e7\u00e3o!`,\n    estrategia: 'Follow-up padr\u00e3o'\n  };\n}\n\nreturn [{ json: {\n  ...vars,\n  nudge,\n  whatsapp_payload: {\n    messaging_product: 'whatsapp',\n    to: vars.vendedor_whatsapp,\n    type: 'interactive',\n    interactive: {\n      type: 'button',\n      header: { type: 'text', text: '\ud83d\udfe1 OTTO - Follow-up' },\n      body: { text: nudge.nudge_vendedor },\n      action: {\n        buttons: [\n          { type: 'reply', reply: { id: `gerar_msg_${vars.lead_id}`, title: '\ud83d\udcdd Gerar Mensagem' } },\n          { type: 'reply', reply: { id: `ja_falei_${vars.lead_id}`, title: '\u2705 J\u00e1 falei com ele' } }\n        ]\n      }\n    }\n  }\n}}];"
      },
      "id": "montar-nudge",
      "name": "Montar Nudge com Bot\u00f5es",
      "type": "n8n-nodes-base.code",
      "typeVersion": 2,
      "position": [
        980,
        340
      ]
    },
    {
      "parameters": {
        "method": "POST",
        "url": "=https://graph.facebook.com/v18.0/{{ $env.WHATSAPP_PHONE_ID }}/messages",
        "authentication": "genericCredentialType",
        "genericAuthType": "httpHeaderAuth",
        "sendBody": true,
        "specifyBody": "json",
        "jsonBody": "={{ JSON.stringify($json.whatsapp_payload) }}",
        "options": {}
      },
      "id": "enviar-nudge",
      "name": "Enviar Nudge WhatsApp",
      "type": "n8n-nodes-base.httpRequest",
      "typeVersion": 4.2,
      "position": [
        1220,
        340
      ],
      "credentials": {
        "httpHeaderAuth": {
          "name": "<your credential>"
        }
      }
    },
    {
      "parameters": {
        "operation": "executeQuery",
        "query": "=UPDATE cronometros_otto SET alerta_amarelo_enviado = TRUE WHERE id = '{{ $('Webhook: Zona Amarela Ativada').first().json.cronometro_id }}';",
        "options": {}
      },
      "id": "marcar-enviado",
      "name": "Marcar Alerta como Enviado",
      "type": "n8n-nodes-base.postgres",
      "typeVersion": 2.5,
      "position": [
        1460,
        340
      ],
      "credentials": {
        "postgres": {
          "name": "<your credential>"
        }
      }
    }
  ],
  "connections": {
    "Webhook: Zona Amarela Ativada": {
      "main": [
        [
          {
            "node": "Buscar \u00daltimos Eventos",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Buscar \u00daltimos Eventos": {
      "main": [
        [
          {
            "node": "LLM: Gerar Nudge Emp\u00e1tico",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "LLM: Gerar Nudge Emp\u00e1tico": {
      "main": [
        [
          {
            "node": "Montar Nudge com Bot\u00f5es",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Montar Nudge com Bot\u00f5es": {
      "main": [
        [
          {
            "node": "Enviar Nudge WhatsApp",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Enviar Nudge WhatsApp": {
      "main": [
        [
          {
            "node": "Marcar Alerta como Enviado",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "settings": {
    "executionOrder": "v1"
  },
  "staticData": null,
  "tags": [
    {
      "id": "otto-1",
      "name": "OTTO"
    },
    {
      "id": "otto-8",
      "name": "Nudge"
    },
    {
      "id": "otto-9",
      "name": "\u00c9pico 4"
    }
  ],
  "triggerCount": 1,
  "updatedAt": "2026-02-26T12:00:00.000Z",
  "versionId": "1"
}

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.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

OTTO - Épico 4: Nudge Acionável (Assistente, não Fiscal). Uses postgres, openAi, httpRequest. Webhook trigger; 7 nodes.

Source: https://github.com/paraisolorrayne/Attra/blob/6dd06914bf6be4654e2cb2b445995786aa402cd3/automations/epico-4-nudge-acionavel.json — original creator credit. Request a take-down →

More AI & RAG workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

AI & RAG

Eu Clara – Funil Kiwify Completo. Uses postgres, openAi, httpRequest, gmail. Webhook trigger; 70 nodes.

Postgres, OpenAI, HTTP Request +1
AI & RAG

Lua Nova - Sistema Completo. Uses postgres, httpRequest, openAi. Webhook trigger; 55 nodes.

Postgres, HTTP Request, OpenAI
AI & RAG

User Signup & Verification: The workflow starts when a user signs up. It generates a verification code and sends it via SMS using Twilio. Code Validation: The user replies with the code. The workflow

Postgres, HTTP Request, OpenAI +2
AI & RAG

Send-Outreach. Uses postgres, openAi, httpRequest, emailSend. Webhook trigger; 15 nodes.

Postgres, OpenAI, HTTP Request +1
AI & RAG

AI Resume Screening Workflow. Uses openAi, emailSend, httpRequest, postgres. Webhook trigger; 14 nodes.

OpenAI, Email Send, HTTP Request +2