Back to blog
Agentes de IAWhatsAppclinicsn8n

WhatsApp AI Chatbot for Medical Clinics: Step-by-Step Guide With n8n

How to implement a WhatsApp chatbot with artificial intelligence at your clinic using n8n and OpenAI. Technical guide with real workflows to automate inquiries, appointments, and patient follow-up.

Published on December 22, 2025·8 min read

Your clinic receives 60, 80, maybe 120 WhatsApp messages a day. Questions about hours, doctor availability, test results, appointment confirmations. Your receptionist answers them one by one, between phone calls, while attending to in-person patients.

The result is predictable: late responses, appointments lost because no one confirmed in time, and an exhausted team doing work that can be automated.

In this guide I'll explain how to implement a WhatsApp chatbot with real artificial intelligence — not a fixed-menu bot — using n8n as the automation engine and OpenAI for language processing. The result is an assistant that understands what the patient writes, responds with real context from your clinic, and escalates to a human when needed.


Why Clinics Need This Now

The healthcare sector numbers are clear:

The chatbot doesn't replace your receptionist. It gives them back the time to do what really matters: attend to in-person patients, coordinate with doctors, and handle situations that require human judgment.


What You'll Build

By the end of this guide, you'll have a WhatsApp assistant that can:


Tools You'll Need

ToolFunctionApproximate Cost
WhatsApp Business API (via 360dialog or Twilio)Messaging channel$7-30 USD/month
n8n (cloud or self-hosted)Automation engine$20 USD/month (cloud)
OpenAI API (GPT-4o mini)Natural language processing~$5-15 USD/month depending on volume
Google Calendar APISchedule managementFree
Google Sheets or NotionConversation loggingFree

Estimated total cost: $35-65 USD/month for a clinic with up to 300 messages per day.


Step 1: Activate WhatsApp Business API

The first step is getting official access to the WhatsApp API — no shortcuts or unofficial tools. Using the unofficial API risks permanently losing your number.

1.1 Create Your Meta Business Manager Account

Go to business.facebook.com and create or verify your business account. You'll need your clinic's legal name, a website, and a corporate email address.

1.2 Choose Your API Provider (BSP)

For clinics just getting started, I recommend 360dialog for its cost and simplicity. The process is:

  1. Create an account at 360dialog.com
  2. Connect your Meta Business Manager
  3. Register the WhatsApp number the clinic will use (it must be a number that does not have the WhatsApp app installed)
  4. Wait for Meta's approval (24-72 hours)

When finished, 360dialog will give you an API Key and a Phone Number ID that you'll use in n8n.


Step 2: Set Up n8n and the WhatsApp Trigger

2.1 Create Your n8n Account

Go to n8n.io and create a cloud account. The Starter plan is sufficient to get started.

2.2 Create the Base Workflow

In n8n, create a new workflow and add the first node: "WhatsApp Business Cloud Trigger".

Configure the credentials with:

This node will receive every message that arrives at your WhatsApp number and pass the data to the next node.

2.3 Test the Connection

Send a message from your personal phone to the clinic's WhatsApp number. If the n8n node receives the event with the message content, the connection is working.


Step 3: Build the Assistant's Brain With OpenAI

This is the step that differentiates a real chatbot from an options menu disguised as a bot.

3.1 Add the OpenAI Chat Model Node

In n8n, add an "AI Agent" or "OpenAI Message a Model" node. Connect your OpenAI API key.

3.2 Write the System Prompt

The system prompt defines how the assistant behaves. Here's a real example you can adapt:

You are the virtual assistant for [Clinic Name], a medical clinic in [City].

Your role is to help patients with:
- Information about available medical specialties
- Verification of office hours
- Appointment scheduling
- Frequently asked questions about the clinic

Clinic information:
- Hours: Monday through Friday 8:00am-8:00pm, Saturdays 9:00am-2:00pm
- Specialties: General Medicine, Cardiology, Pediatrics, Gynecology
- Location: [Address]
- Emergency phone: [Number]

Important rules:
1. Never provide medical diagnoses or medication recommendations
2. For any urgent symptoms (chest pain, difficulty breathing, etc.) ALWAYS refer to emergency services or indicate calling the emergency number
3. If the patient asks to speak with a person, respond: "I'm going to connect you with someone from our team right now."
4. Always respond in a warm and professional tone
5. Keep responses short and direct (maximum 3-4 paragraphs)

3.3 Pass the Conversation History

For the assistant to remember context, n8n needs to save the history of each conversation. Use the "Window Buffer Memory" node in n8n with the patient's WhatsApp number as the session key. This allows the assistant to remember what was discussed earlier in the same conversation.


Step 4: Integrate Appointment Scheduling

4.1 Connect Google Calendar

In n8n, add Google Calendar credentials (you can do this with OAuth from the credentials settings).

Create a "Google Calendar" node to:

4.2 The Scheduling Flow

When the assistant detects that the patient wants to book an appointment, it activates a sub-flow:

Patient: "I'd like an appointment with cardiology"
        ↓
Assistant asks: "When do you need the appointment?"
        ↓
n8n queries Google Calendar → Gets available slots
        ↓
Assistant offers options: "We have availability on Tuesday the 12th at 10am or Thursday the 14th at 3pm. Which works for you?"
        ↓
Patient confirms option
        ↓
n8n creates the event in Google Calendar
        ↓
Assistant confirms and sends summary to patient

Step 5: Set Up Automatic Reminders

Reminders are where the ROI becomes most visible. A clinic with 20 daily appointments that reduces no-shows from 25% to 10% recovers 3 appointments per day.

5.1 Reminders Workflow

Create a separate workflow in n8n that activates automatically. Use the "Schedule Trigger" node to run every day at 8am.

The workflow does the following:

  1. Queries Google Calendar to get all appointments for the next day
  2. For each appointment, sends a WhatsApp message to the registered number
  3. Waits for the patient's confirmation
  4. If they confirm → updates the status in the system
  5. If no response in 2 hours → sends a second reminder
  6. If they cancel → frees the slot and notifies the clinic

Reminder message:

"Hi [Name] 👋 Just a reminder that tomorrow [day] you have an appointment at [Clinic Name] at [time] with [specialty].

Please confirm your attendance: ✅ Yes, I'll be thereI need to cancel/reschedule"


Step 6: Configure Human Escalation

A well-designed system knows when to hand over control.

Configure n8n's "IF" node to detect keywords that require human attention:

When escalation is triggered, n8n:

  1. Notifies the clinic team via Telegram or internal WhatsApp
  2. Pauses the automatic assistant for that number
  3. The team takes manual control of the conversation

Results You Can Expect

Based on similar implementations at clinics in Latin America:


Common Mistakes When Implementing This System

Not testing with real scenarios before going fully live. Always test the complete flow with at least 20 different scenarios before announcing the assistant to your patients.

Prompt that's too generic. The more specific information about your clinic the prompt contains, the better the response quality. Include real frequently asked questions you receive today.

No clear escalation plan. Define exactly who receives the alert and the maximum response time.

Forgetting privacy compliance. In the US and many other countries there are regulations about handling medical data (HIPAA and others). Make sure your system complies with applicable regulations and that patients agree to the assistant's terms of use.


Want Me to Implement This at Your Clinic?

This tutorial covers the essentials, but I know the difference is in the details: the right prompt for your specialty, the specific flows for your clinic, the integration with your current management system.

If you'd rather have the system running in 2-3 weeks without investing time in technical implementation, I work with clinics to do exactly that.

Schedule a 30-minute call and I'll tell you exactly what you need and how long it would take.

I want to automate my clinic →

Does your business have this problem?

In 30 minutes I'll tell you exactly what to automate first and how much time you can recover.

Request free diagnosis