ChatGPTCreativeWritingAI score · 68/100AI-assisted edit · no obvious prompt-injection riskn8n.io

n8n Multi-Agent Clinic Management: WhatsApp + Telegram + Google Calendar Automation

Import n8n workflow → configure Evolution API, Telegram, Google Calendar/Tasks, OpenAI/OpenRouter, PostgreSQL credentials → replace placeholder variables → customize AI system prompts for your clinic → activate and test patient WhatsApp interactions, staff Telegram commands, and daily appointment reminders

ExperiencedStepsWorkflowPromptTip
Who
Clinic operators or n8n-savvy technicians who need automated WhatsApp patient scheduling, rescheduling, and confirmations, plus internal staff management via Telegram.
You get
A multi-agent n8n workflow that handles patient appointment booking/rescheduling/cancellation/confirmation over WhatsApp, lets staff reschedule or add Google Tasks reminders via Telegram, sends daily next-day confirmation messages, and supports media processing (audio/image) with human escalation.
You need
n8n · telegram

Constraints

Prerequisites: n8n 1.88.0+ instance; credentials for Evolution API (WhatsApp), Telegram Bot API, Google Calendar OAuth2, Google Tasks OAuth2, OpenAI API, OpenRouter API, and PostgreSQL. The workflow contains placeholders such as {sua instância aqui}, {número_whatsapp}, {url_do_servidor}, {a sua apikey aqui}, and {seu_calendario} that must be replaced after import. AI prompts are in Portuguese and must be localized to your clinic’s contact info, hours, address, and escalation rules. Source does not provide cost estimates; OpenRouter nodes use models labeled free, but verify quotas and stability for production.

What they did

Author koresoluciones published a 38-node clinic automation template on n8n (ID 3694). The template receives patient WhatsApp messages via Evolution API webhook, classifies them by type (text/image/audio/document) through a Switch node, and routes to AI Agents: text goes directly to the Assistente Clínica patient-reception agent; images are processed by OpenAI Vision (chatgpt-4o-latest) and analyzed by AI Agent2; audio is downloaded by Evolution API, converted to MP4, and transcribed by OpenAI Whisper. The patient-reception agent uses MCP Google Calendar tools to query, create, update, and delete appointments, and escalates to human via the CallToHuman tool in urgent or complaint scenarios. Replies are formatted by an AI Agent (replacing ** with * and removing #) and sent back via Evolution API2. Meanwhile, clinic staff trigger the Assistente clinica interno via Telegram to reschedule appointments (extracting patient phone from calendar event descriptions and sending WhatsApp rescheduling messages) or add shopping reminders to Google Tasks. On weekdays at 08:00, Gatilho diário triggers the Assistente de confirmação to pull next-day appointments and send confirmation/rescheduling requests via WhatsApp. The main agents use OpenAI Chat Model (gpt-4.1-mini) and OpenRouter Chat Model (gemini-2.0-flash-exp:free / gemini-2.5-pro-exp-03-25:free), with PostgreSQL Chat Memory for multi-turn context.

How it went

This is an n8n official template. The author reports that the workflow achieves: automated WhatsApp patient reception, intelligent media processing, full Google Calendar appointment lifecycle management, Telegram internal operations handling, daily automated appointment reminders, and automatic human escalation for sensitive cases. The template has 25,765 views on n8n.io. This site has not executed or verified the workflow; we cannot confirm actual runtime stability, Evolution API connection reliability, or multi-language patient interaction quality.

Worth knowing

1. Prompt language: The three core agent system prompts are in Portuguese, not Chinese or English; deployers must rewrite or translate for their clinic’s language while preserving MCP tool-calling structure. 2. Hard-coded info: The Assistente Clínica node contains the original author’s clinic Google Calendar embed link, address (Rua Rio Casca, 417 – Belo Horizonte, MG), and business hours; these must be replaced. 3. Escalation dependency: The CallToHuman tool calls another n8n workflow (ID A95kslcW4H82nJuR), which is not included in the template; you must build it yourself or remove escalation. 4. Models and cost: OpenRouter nodes use experimentally labeled free models (gemini-2.0-flash-exp:free, gemini-2.5-pro-exp-03-25:free); verify quotas, stability, and ongoing availability for production. OpenAI nodes use gpt-4.1-nano and gpt-4.1-mini; monitor API costs. 5. Data privacy: The source Technical Notes state sensitive patient data is stored in Google Calendar event descriptions; assess compliance with local healthcare data regulations (e.g., HIPAA, LGPD). 6. MCP endpoints: The template uses author-hosted SSE endpoints (rshare.io domain) for MCP Google Calendar and MCP GMAIL; replace with your own MCP service or n8n native Google nodes for production. 7. Audio processing: The OpenAI Whisper transcription node does not explicitly specify a model, defaulting to whisper-1; large files (>25MB) may fail. 8. Not tested: This site has not imported or run the workflow; all effect descriptions are author-reported (author_report) and do not constitute platform-verified certification.

n8n workflow template

Structure checked · Not run-tested

Use “Import from File” in n8n, or copy the JSON and paste it into the editor. Connect your own accounts, then try test data. The template is inactive by default.

Setup and test checklist

Credentials to connect

  • OpenAI Chat Model1 node: connect OpenAI API credentials.
  • Google Tasks node: connect googleTasksOAuth2Api credentials.
  • Receber Mensagem Telegram node: connect Telegram API credentials.
  • Postgres Chat Memory node: connect Postgres credentials.
  • OpenAI Chat Model node: connect OpenAI API credentials.
  • Enviar alerta de cancelamento node: connect Telegram API credentials.
  • Postgres Chat Memory1 node: connect Postgres credentials.
  • Telegram node: connect Telegram API credentials.
  • OpenRouter Chat Model1 node: connect openRouterApi credentials.
  • OpenAI node: connect OpenAI API credentials.
  • Evolution API node: connect evolutionApi credentials.
  • OpenAI1 node: connect OpenAI API credentials.
  • OpenRouter Chat Model2 node: connect openRouterApi credentials.
  • Evolution API2 node: connect evolutionApi credentials.
  • OpenAI Chat Model2 node: connect OpenAI API credentials.
  • REMINDER node: connect evolutionApi credentials.

Configuration to replace

  • Source template is n8n public workflow #3694 (~38 nodes). Keep inactive after import; verify triggers, expressions and external API endpoints.
  • Sticky-note guidance is informational; replace placeholders with your own accounts, sheet schemas or channel IDs.

Test input and expected output

  • Manually run the main path once in a test workspace and confirm credentialed nodes authenticate without errors.
  • Drive one synthetic/redacted sample through and check output fields and downstream writes before enabling in production.

Template changes

  • Author credential bindings, webhookId and execution data are removed; the workflow is inactive. Nodes, connections and original prompts are preserved. Not run-tested in n8n.
  • No business-logic edits; verify keys, quotas and privacy compliance before use.

Template retrieved: 2026-10-24

Steps

  1. Import the workflow

    In n8n, go to Workflows → Import from File and upload the workflow.json. After import you should see 38 nodes, including 5 AI Agent nodes, multiple MCP Client tool nodes, and Telegram/Evolution API trigger and action nodes.

  2. Configure credentials

    Create or link credentials for: Evolution API (WhatsApp messaging), Telegram Bot API (staff messaging), Google Calendar OAuth2 (appointments), Google Tasks OAuth2 (task management), OpenAI API (AI agents), OpenRouter API (fallback/formatting models), and PostgreSQL (persistent chat memory). Select the created credentials in the respective nodes.

  3. Replace sensitive variables

    Replace placeholders with real values: {sua instância aqui} → Evolution API instance name; {número_whatsapp} → clinic WhatsApp number; {url_do_servidor} → server URL; {a sua apikey aqui} → respective API key; {seu_calendario} → Google Calendar ID. Also update the hard-coded clinic contact, address, and calendar link in the Assistente Clínica node.

  4. Customize AI prompts

    Adapt the system prompts to your clinic’s brand, tone, and compliance needs. The three main agents are: 1) Assistente Clínica (WhatsApp patient reception, includes appointment SOP and escalation rules); 2) Assistente clinica interno (Telegram internal rescheduling and shopping list); 3) Assistente de confirmação (daily appointment confirmation). The original prompts are in Portuguese; retain the structure and replace clinic-specific information.

    Execution prompt · Source text。Assistente Clínica node systemMessage field (promptType=define)

    =HOJE É: {{ $now }}
    CONTATO DA CLÍNICA: 
    { coloque o seu contato aqui }
    
    INSTRUÇÃO IMPORTANTE:
    
    Ao criar ou editar qualquer evento via MCP_CALENDAR, inclua na descrição do agendamento:
    
    Telefone do paciente
    
    Nome completo
    
    Data de nascimento
    
    Informações adicionais (convênio, condição de saúde etc.)
    
    PAPEL:
    Você é uma atendente do WhatsApp da Clínica Moreira, especializada em atendimento humanizado. Sua missão:
    
    Atender pacientes de forma ágil e eficiente
    
    Responder dúvidas sobre clínica e serviços
    
    Agendar, remarcar e cancelar consultas pelo MCP_CALENDAR
    
    PERSONALIDADE E TOM DE VOZ:
    
    Simpática, acolhedora e respeitosa
    
    Formal, sem emojis ou gírias
    
    FERRAMENTAS DISPONÍVEIS:
    
    MCP_CALENDAR (trigger /mcp/:tool/calendar)
    
    AVALIABILITY_CALENDAR: verifica horários livres entre Start_Time e End_Time
    
    GET_ALL_CALENDAR: lista todos os eventos entre After e Before
    
    CREATE_CALENDAR: cria novo evento com start, end e Description (inclua sempre telefone, nome e data de nascimento)
    
    UPDATE_CALENDAR: atualiza campos de um evento existente (Event_ID)
    
    DELETE_CALENDAR: remove evento (Event_ID)
    
    GET_CALENDAR: obtém detalhes de um evento específico (Event_ID)
    
    CallToHuman (workflow id A95kslcW4H82nJuR)
    
    Encaminha atendimento humano via EvolutionAPI em n8n
    
    Disparar IMEDIATAMENTE quando:
    
    Urgência ou mal-estar grave
    
    Pedido de diagnóstico/opinião médica
    
    Insatisfação expressa do paciente
    
    Assuntos fora do escopo da clínica
    
    Exemplo de chamada:
    
    {
      "tool": "CallToHuman",
      "telefone": "<telefone>",
      "nome": "<nome completo>",
      "ultima_mensagem": "<texto da última mensagem>"
    }
    
    Enviar telegram cancelamento
    
    Após DELETE_CALENDAR, envie ao gestor via Telegram: nome, data, hora
    
    SOP (Fluxo de Atendimento):
    
    Início e coleta de dados
    
    Cumprimente e informe o link da agenda: https://calendar.google.com/calendar/embed?src=a57a3781407f42b1ad7fe24ce76f558dc6c86fea5f349b7fd39747a2294c1654%40group.calendar.google.com&ctz=America%2FArgentina%2FBuenos_Aires
    
    Peça: nome completo, data de nascimento e confirme o telefone
     number: {{ $('Webhook1').item.json.body.data.key.remoteJid.replaceAll("@s.whatsapp.net","") }}
    
    Verificação de disponibilidade
    
    Pergunte data e turno preferidos
    
    Chame AVALIABILITY_CALENDAR com Start_Time 08:00 e End_Time 19:00 (ou turno)
    
    Informe horários livres
    
    Agendamento
    
    Após escolha do paciente, use CREATE_CALENDAR com start, end e Description
    
    Aguarde retorno para confirmar criação antes de responder
    
    Remarcação
    
    Solicite dados e nova preferência de data/turno
    
    Localize evento antigo via GET_ALL_CALENDAR
    
    Use DELETE_CALENDAR no Event_ID antigo
    
    Crie novo com CREATE_CALENDAR
    
    Confirme após sucesso
    
    Cancelamento
    
    Solicite dados do paciente
    
    Identifique Event_ID via GET_ALL_CALENDAR ou GET_CALENDAR
    
    Execute DELETE_CALENDAR
    
    Use Enviar telegram cancelamento
    
    Confirme cancelamento ao paciente
    
    Confirmação de consulta (follow-up)
    
    Se paciente responder “Confirmar, ID”: use UPDATE_CALENDAR para prefixar título com [Confirmado]
    
    Se “Reagendar, ID”: DELETE_CALENDAR e oriente para usar link da agenda
    
    REGRAS DE ESCALONAMENTO:
    
    Use CallToHuman IMEDIATAMENTE em situações de:
    
    Urgência/mal-estar
    
    Pedidos de diagnóstico/opinião médica
    
    Insatisfação ou reclamações
    
    Assuntos fora do escopo
    
    MANTENHA SEMPRE:
    
    Tom profissional e respeitoso
    
    Linguagem clara e objetiva
    
    Agendamentos apenas em datas futuras
    
    Nunca confirmar sem retorno do MCP_CALENDAR
    
    HORÁRIOS DE FUNCIONAMENTO:
    
    Seg–Sáb: 08h–19h | Dom e feriados: fechado
    
    LOCALIZAÇÃO:
    Rua Rio Casca, 417 – Belo Horizonte, MG
    
    LINK DA AGENDA:
    https://calendar.google.com/calendar/embed?src=a57a3781407f42b1ad7fe24ce76f558dc6c86fea5f349b7fd39747a2294c1654%40group.calendar.google.com&ctz=America%2FArgentina%2FBuenos_Aires

    Execution prompt · Source text。Assistente clinica interno node systemMessage field (promptType=define)

    =Hoje é {{$now}}
    PAPEL:  
    Você é um assistente interno de reagendamento na clínica, acionado diretamente por um profissional via Telegram para gerenciar situações de remarcação de consultas ou incluir lembretes na lista de compras.
    
    OBJETIVO GERAL:  
    1. Reagendar consultas a pedido do profissional.  
    2. Adicionar lembretes na lista de compras quando solicitado.  
    
    RESUMO DE RESPONSABILIDADES:  
    1. Reagendamento de pacientes  
       - Acesse o Google Calendar por meio da ferramenta "MCP Google Calendar" para identificar as consultas afetadas.  
       - Extraia o número de telefone na descrição do evento.  
       - Use a ferramenta "Reagendar no WhatsApp" para enviar mensagens de reagendamento aos pacientes.  
       - Lembre-se de que você apenas envia a mensagem; a resposta do paciente é tratada por outro agente.  
    
    2. Lista de compras da clínica  
       - Se o profissional solicitar pelo Telegram a inclusão de um item na lista de compras, utilize a ferramenta "Google Tasks" para adicionar o lembrete.  
    
    ORIENTAÇÕES DE LINGUAGEM E PROCEDIMENTO:  
    - Use uma abordagem empática, profissional e acolhedora.  
    - Nunca envie mensagens para pacientes sem autorização explícita do profissional.  
    - Quando listar eventos ou tarefas, seja objetivo e organizado.  
    - Mantenha clareza e concisão em todas as interações.  
    
    FERRAMENTAS DISPONÍVEIS:  
    - Reagendar no WhatsApp  
    - Google Tasks  
    - MCP Google Calendar  
    
    INSTRUÇÕES FINAIS:  
    - Atenda exclusivamente às solicitações de reagendamento e inclusão de lembretes.  
    - A remarcação de consultas ocorre somente quando o profissional pede, utilizando o MCP Google Calendar para identificar os pacientes e o "Reagendar no WhatsApp" para enviar a mensagem.  
    - Para a lista de compras, sempre registre no "Google Tasks".

    Execution prompt · Source text。Assistente de confirmação node text field (promptType=define; systemMessage is empty)

    =Hoje é {{ $now }}. Você é um agente especializado em **confirmação de consultas** para a clínica. Sua função principal é:
    
    1. **Listar os eventos** agendados para o próximo dia no MCP Calendar.
    2. **Obter o numero** na descrição de cada evento.
    3. **Enviar uma mensagem de confirmação** usando a ferramenta “relembraAGENDAMENTO”, perguntando se o paciente confirma a consulta ou prefere reagendar.
    
    Importante:
    - Você **não recebe respostas** diretamente; o retorno do paciente é tratado por outro agente.

    Execution prompt · Source text。AI Agent (formatting node) systemMessage field

    =Você é especialista em formatação de mensagem para whataspp, trabalhando somente na formatação e não alterando o conteúdo da menssagem.
    
    - Substitua ** por *
    - Remova #

    Execution prompt · Source text。Confirm the destination, input variables and output format before use.

    ={{ /*n8n-auto-generated-fromAI-override*/ $fromAI('Text', ``, 'string') }}
  5. Activate and test

    Save and activate the workflow. Test paths: 1) Send text/image/audio from a patient WhatsApp and verify the full chain: Webhook1 → Edit Fields1 → Switch → relevant branch → Assistente Clínica → AI Agent (formatting) → Evolution API2. 2) Send rescheduling or shopping-list commands from an authorized staff Telegram account and verify Assistente clinica interno → MCP Google Calendar / Google Tasks → Telegram reply. 3) Manually trigger Gatilho diário (or wait for a weekday at 08:00) and verify Assistente de confirmação → MCP CALENDAR → REMINDER (WhatsApp) confirmation flow. Monitor PostgreSQL memory nodes for proper operation.

Prompt you can copy

Setup guidance · Editorial suggestion。Hand to setup assistant; confirm inputs and permissions before activation

This block is the prompt. Ads are never placed here.

You are setting up an n8n multi-agent clinic automation system. Please confirm in order: 1) n8n version is ≥1.88.0; 2) all 6 credential types are collected (Evolution API, Telegram Bot, Google Calendar OAuth2, Google Tasks OAuth2, OpenAI, OpenRouter, PostgreSQL); 3) all placeholders (instance name, phone number, server URL, API keys, calendar ID) and clinic contact info have been replaced; 4) the three core agent system prompts (patient reception, internal rescheduling, appointment confirmation) have been reviewed and localized, especially business hours, address, and escalation rules; 5) the Evolution API webhook is pointed to the n8n Webhook1 node path evolutionAPIKORE. Only activate after all checks pass.

Before activating, confirm n8n version, all credentials, placeholder replacement, prompt localization, and webhook endpoint configuration.

Source

Multi-Agent AI Clinic Management with WhatsApp, Telegram, and Google Calendar · koresoluciones · n8n.io · 2025-04-24

Comments & feedback

Tried this method? Share results, problems or improvements. Comments appear after moderation. Please avoid sensitive information.

Loading…

    Related