AutomationFlowsAI & RAG › Agente Clínica • Compat

Agente Clínica • Compat

Agente Clínica • Compat. Webhook trigger; 12 nodes.

Webhook trigger★★★★☆ complexity12 nodes
AI & RAG Trigger: Webhook Nodes: 12 Complexity: ★★★★☆ Added:

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": "Agente Cl\u00ednica \u2022 Compat",
  "nodes": [
    {
      "parameters": {
        "httpMethod": "POST",
        "path": "clinica",
        "responseMode": "onReceived"
      },
      "id": "webhook1",
      "name": "Webhook \u2022 Entrada",
      "type": "n8n-nodes-base.webhook",
      "typeVersion": 1,
      "position": [
        120,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Normaliza campo messageText a partir de payloads comuns\nconst b = $json.body || $json || {};\nlet msg = b.message || b.text || b.Body || (b.messages && b.messages[0] && (b.messages[0].text || b.messages[0].body)) || '';\nif (typeof msg === 'object' && msg.body) msg = msg.body;\nif (typeof msg !== 'string') msg = String(msg || '');\nreturn [{ messageText: msg.trim(), raw: b }];"
      },
      "id": "fn_normalize",
      "name": "Function \u2022 Normalizar",
      "type": "n8n-nodes-base.function",
      "typeVersion": 2,
      "position": [
        360,
        300
      ]
    },
    {
      "parameters": {
        "functionCode": "// Classificador simples por palavras-chave\nconst text = ($json.messageText || '').toLowerCase();\nlet intent = 'faq';\nif (/(agend|marc|consulta|atendimento)/.test(text)) intent = 'agendar';\nif (/(confirm|confirmar)/.test(text)) intent = 'confirmar';\nif (/(cancel|desmarc|remarc)/.test(text)) intent = 'cancelar';\nif (/(endereco|endere\u00e7o|conv[e\u00ea]nio|hor[a\u00e1]rio|valor|pre[\u00e7c]o|como chegar)/.test(text)) intent = 'faq';\nreturn [{ intent, messageText: $json.messageText }];"
      },
      "id": "fn_classify",
      "name": "Function \u2022 Classificar",
      "type": "n8n-nodes-base.function",
      "typeVersion": 2,
      "position": [
        600,
        300
      ]
    },
    {
      "parameters": {
        "propertyName": "intent",
        "rules": {
          "values": [
            {
              "operation": "equal",
              "value": "agendar"
            },
            {
              "operation": "equal",
              "value": "confirmar"
            },
            {
              "operation": "equal",
              "value": "cancelar"
            },
            {
              "operation": "equal",
              "value": "faq"
            }
          ]
        }
      },
      "id": "switch_intent",
      "name": "Switch \u2022 Roteamento",
      "type": "n8n-nodes-base.switch",
      "typeVersion": 2,
      "position": [
        840,
        300
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "reply",
              "value": "Para agendar, me informe: Nome; Especialidade; Data (DD/MM); Hora (HH:MM). Ex.: Ana Silva; Cardiologia; 22/08; 14:00"
            }
          ]
        }
      },
      "id": "set_agendar",
      "name": "Set \u2022 Resposta Agendar",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        1080,
        160
      ]
    },
    {
      "parameters": {
        "responseBody": "={{$json.reply}}"
      },
      "id": "respond_agendar",
      "name": "Respond \u2022 Webhook (agendar)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1320,
        160
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "reply",
              "value": "Sua consulta est\u00e1 confirmada \u2705 Caso precise alterar, responda \"remarcar\"."
            }
          ]
        }
      },
      "id": "set_confirmar",
      "name": "Set \u2022 Resposta Confirmar",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        1080,
        300
      ]
    },
    {
      "parameters": {
        "responseBody": "={{$json.reply}}"
      },
      "id": "respond_confirmar",
      "name": "Respond \u2022 Webhook (confirmar)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1320,
        300
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "reply",
              "value": "Cancelamento registrado. Deseja reagendar? Envie: Nome; Especialidade; Data; Hora."
            }
          ]
        }
      },
      "id": "set_cancelar",
      "name": "Set \u2022 Resposta Cancelar",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        1080,
        440
      ]
    },
    {
      "parameters": {
        "responseBody": "={{$json.reply}}"
      },
      "id": "respond_cancelar",
      "name": "Respond \u2022 Webhook (cancelar)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1320,
        440
      ]
    },
    {
      "parameters": {
        "keepOnlySet": true,
        "values": {
          "string": [
            {
              "name": "reply",
              "value": "Informa\u00e7\u00f5es: Endere\u00e7o [preencher]; Conv\u00eanios [preencher]; Hor\u00e1rios [preencher]. Posso agendar para voc\u00ea?"
            }
          ]
        }
      },
      "id": "set_faq",
      "name": "Set \u2022 Resposta FAQ",
      "type": "n8n-nodes-base.set",
      "typeVersion": 2,
      "position": [
        1080,
        580
      ]
    },
    {
      "parameters": {
        "responseBody": "={{$json.reply}}"
      },
      "id": "respond_faq",
      "name": "Respond \u2022 Webhook (faq)",
      "type": "n8n-nodes-base.respondToWebhook",
      "typeVersion": 1,
      "position": [
        1320,
        580
      ]
    }
  ],
  "connections": {
    "Webhook \u2022 Entrada": {
      "main": [
        [
          {
            "node": "Function \u2022 Normalizar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function \u2022 Normalizar": {
      "main": [
        [
          {
            "node": "Function \u2022 Classificar",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Function \u2022 Classificar": {
      "main": [
        [
          {
            "node": "Switch \u2022 Roteamento",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Switch \u2022 Roteamento": {
      "main": [
        [
          {
            "node": "Set \u2022 Resposta Agendar",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set \u2022 Resposta Confirmar",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set \u2022 Resposta Cancelar",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Set \u2022 Resposta FAQ",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set \u2022 Resposta Agendar": {
      "main": [
        [
          {
            "node": "Respond \u2022 Webhook (agendar)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set \u2022 Resposta Confirmar": {
      "main": [
        [
          {
            "node": "Respond \u2022 Webhook (confirmar)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set \u2022 Resposta Cancelar": {
      "main": [
        [
          {
            "node": "Respond \u2022 Webhook (cancelar)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Set \u2022 Resposta FAQ": {
      "main": [
        [
          {
            "node": "Respond \u2022 Webhook (faq)",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
Pro

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

About this workflow

Agente Clínica • Compat. Webhook trigger; 12 nodes.

Source: https://gist.github.com/ilaialipassos/dffa9b1aca5f5934e17f98eda434632e — 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

Jigsaw API key for image processing, I use this as a gatekeeper/second pair of eyes. LINK to their website https://jigsawstack.com/ SECOND A postgress DATABASE (I use Supabase) LlamaCloud for the pars

HTTP Request, Postgres, Stop And Error +2
AI & RAG

Onsite Photos to Jobs (SMS Agent). Uses dataTable, twilio, httpRequest, airtable. Webhook trigger; 62 nodes.

Data Table, Twilio, HTTP Request +1
AI & RAG

AML Alert Triage. Uses httpRequest. Webhook trigger; 57 nodes.

HTTP Request
AI & RAG

W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 50 nodes.

Postgres, Redis, HTTP Request
AI & RAG

W1 - IN WhatsApp Adapter (Secure + Fast ACK). Uses postgres, redis, httpRequest. Webhook trigger; 48 nodes.

Postgres, Redis, HTTP Request