EP07 · ANNEXES A–D

Guide: an AI that books appointments by text, offers two times and confirms before booking

EP.
07
Rung
3 of 4
Cost
About $19.50 once and $3.15/month (Twilio), plus texts and OpenAI
Time
1 to 2 hours, plus up to 5 business days for registration
Accounts
Twilio (paid), n8n, OpenAI and Google
Status
Draft
Updated
2026-11-18
Files to download
Annex D · 4 files

This material is a draft: the steps are written, but nobody has followed them from a brand-new account yet. A button may be named differently; if something doesn’t match, write to us.

In this guide
  1. What it costs before you start
  2. What you'll have
  3. The templates
  4. Steps
  5. How to know it worked
  6. If it fails
  7. Limits it already has
  8. Notes
  9. Did it work?
  10. ATemplate 1 · Instructions
  11. BTemplate 2 · Office hours and details
  12. CTemplate 3 · Test messages
  13. DFiles to download

What it costs before you start

Texting patients from a US business number means registering first. Phone carriers require it for any business that texts from a regular 10-digit number. It's called A2P 10DLC: "application-to-person" texting over a "10-digit long code". Without it, carriers add fees and filter your texts, and they may not go through at all. Figures from Twilio's official pricing and docs, checked on Nov 17, 2026 (confirm them before you start, they change):

What What for Cost (Twilio)
Local US phone number The office's text line $1.15 a month
Each text, in or out Messages $0.0083 per segment (about 160 characters)
Carrier fee, each text you send Charged by AT&T, T-Mobile, Verizon… $0.0035 to $0.005 per segment
Brand registration (A2P 10DLC) Says who is sending $4.50 one time
Campaign vetting Says what you send and how people opt in $15 one time
Campaign fee Keeps the registration active $2 a month for a sole proprietor; $1.50 to $10 for other businesses, depending on the use case
Brand vetting (only "Standard" brands, with a tax ID) Higher sending limits $41.50 one time
n8n The flow that connects everything Free if you host it; paid on n8n Cloud
OpenAI API key Leo, the one who texts Pay as you go, prepaid. Cost per conversation: not measured yet
Google Calendar and Gmail The office calendar and the health-question email Free

A small example: a sole proprietor pays about $19.50 once ($4.50 + $15) and about $3.15 a month ($2 + $1.15) before messages. If each booking takes about 4 texts in and 4 out, 100 bookings a month are 800 texts: about $6.64 in message fees, plus up to $2 in carrier fees. On top of that comes OpenAI.

Accounts you'll need: Twilio (paid: a trial account can't register for A2P 10DLC), n8n, OpenAI and Google. Use test names while you try it, never real patients.

Time: 1 to 2 hours to build. Registration takes longer: a sole-proprietor brand is approved minutes after you answer a one-time code Twilio texts you, but the campaign can take up to 5 business days, sometimes more. Start step 1 first.

What you'll have

A text line where Leo, your AI scheduler, books visits in your calendar:

  • Tool (the office keys): he sees your open times and offers two at once, in one text.
  • Confirmation: before booking he checks the time is still free and holds it. Then he repeats the day and time and waits for a "yes". If two parents pick the same time at almost the same moment, only one keeps it and the other gets two new options.
  • Health limit: if a parent asks about a fever, medicine or symptoms, he gives no advice: you get an email and the parent gets a fixed reply saying the office will get back to them, and to call 911 in an emergency.

Held times show up in your calendar as "On hold: …" and become "Visit: …" when the parent says yes.

The templates

  1. leo-instructions.md: the job manual (how he texts and the booking order).
  2. office-hours.md: your hours, visit types and notes.
  3. test-messages.md: the tests at the end.

Steps

1. Start the registration in Twilio (it's the slow part)

Create a Twilio account, upgrade it to paid, and buy a local number. Then, in the Twilio Console, register for A2P 10DLC: first your brand (who you are; "Sole Proprietor" if you have no tax ID), then a campaign (what you send). For the campaign, describe it plainly: "Parents text our pediatric office to book appointments; our AI assistant replies with open times and confirms the booking. We never text first." Say how people opt in (they text you first) and that they can reply STOP to opt out.

You should see: the brand as approved, and the campaign as pending or approved. While you wait, do steps 2 to 6.

2. Get n8n ready and import the flow

No n8n yet? Watch the short video "Install n8n in 10 minutes and import the template", then come back. Create the credentials: Twilio (Account SID and Auth Token), Google Calendar, Gmail and OpenAI. Paste keys only into n8n, never into a chat.

In n8n, Import from file → flow-sms-booking.json. You'll see:

  • Four booking functions (check availability, hold slot, confirm booking, release slot): Leo uses them as his tools.
  • The message path: a text comes in → Twilio gets an empty answer right away → Opt-out word? lets Twilio handle STOP, HELP and similar words → Health question? sends health questions to you with a fixed reply → otherwise Leo answers and Send reply texts it back.

3. Connect your calendar

In every calendar node, change your-calendar@gmail.com to your appointments calendar. Use a new one, only for this: its ID is in the calendar's settings. Put your email in Email Dr. Paula.

4. Set your hours

In Open slots, Still free? and Clash?, change the HORAS line (hours by weekday), DURACION (minutes per visit) and ANTICIPACION_H (how many hours ahead). It has to match template 2.

5. Paste your instructions and your number

Open the Leo node and replace templates 1 and 2 with yours. Keep the first line, the one with today's date. Put your Twilio number in Send reply and Send health reply. If your n8n isn't at http://localhost:5678, change that address in Leo's four tools (check_availability, hold_slot, confirm_booking, release_slot).

6. Assign credentials and activate

The nodes with a red warning need their credential: pick the ones you created in step 2. Then activate the flow.

7. Connect your Twilio number

Copy the production URL of the SMS received node. In Twilio, open your number → Messaging configuration → "A message comes in" → Webhook, paste the URL, method POST. Once the campaign is approved, add the number to it (the Console asks you to).

8. Run the tests

Follow template 3 from your own phone.

You should see: two times in one text and, after your "yes", the visit in your calendar.

How to know it worked

  • His first text says he's an AI scheduler.
  • He offers two open times at once, inside your hours.
  • Nothing becomes "Visit: …" in your calendar before the parent says yes.
  • If someone else just took that time, he says so and offers two others.
  • A health question reaches your email, and Leo gives no advice.

If it fails

  • No reply at all: the flow isn't active, or the URL in Twilio is the test URL instead of the production one.
  • Twilio shows the texts as not delivered: the number isn't registered yet, or it isn't added to the approved campaign (step 1).
  • He doesn't see open times: the calendar ID isn't the same in every calendar node, or HORAS has no hours on the day you asked for.
  • The tools fail: the flow isn't active, or the n8n address in Leo's tools isn't yours.
  • He books without asking: check the booking order in template 1, step 5.
  • Old "On hold" entries: parents who never confirmed. Delete them in your calendar or ask Leo to release them.

Limits it already has

  • He only replies to people who text first.
  • He only offers times the tool gives him, inside your hours and with notice.
  • He never books without a "yes": hold, repeat, wait.
  • Of two holds for the same time, the first one written wins and the other deletes itself.
  • Health questions always go to you, with a fixed rule that doesn't depend on the AI.
  • He never asks for Social Security, insurance or card numbers.
  • STOP and HELP are handled by Twilio itself; the flow never replies to them.

Notes

  • Parents should know they're texting an AI: he says so in his first text.
  • Only text people who texted you first, and honor STOP. Consent rules for business texting in the US go beyond this guide: check them before you add anything that texts first, such as reminders.
  • A medical office has health-privacy rules for patient messages. Check with whoever handles your compliance before you use it with real patients.

Did it work?

When the tests pass, reply DONE to the message this came in.

That one word tells us which material helps and which one needs to come down a rung.

Annex ATemplate 1 · Instructions for your AI scheduler

This is the job manual: who he is, how he texts and how he books. Change what's in brackets. It goes in the Leo node of the flow (step 5 of the guide), with template 2 at the end. The flow adds today's date and time on top.

The two pieces from the video are here: the tool (check_availability, hold_slot, confirm_booking, release_slot: the keys to the calendar) and the confirmation (hold it, repeat day and time, wait for a "yes").

You are [Leo], the AI scheduler at [Dr. Paula]'s pediatric office in [Austin, TX].
You answer the office's text messages. You only book, change or cancel appointments. You are not a doctor.

HOW YOU TEXT
- The first time, introduce yourself like this: "Hi, this is [Leo], the AI scheduler at [Dr. Paula]'s office. I can help you book a visit."
- Short, friendly texts. One question at a time. No emojis, no lists, no links.
- Write times like "Tuesday, Dec 1 at 3 PM".

HOW YOU BOOK (always in this order)
1. Ask for the child's name and the reason: checkup, vaccines or sick visit.
2. Use check_availability and offer the TWO options it returns, in one text, with their day and time. For example: "Would Tuesday, Dec 1 at 3 PM or Wednesday, Dec 2 at 10 AM work?". If they want another day, use check_availability with that date.
3. When they pick one, use hold_slot with that start time and the child's name. If hold_slot says it's no longer free, say so and go back to step 2.
4. If hold_slot worked, repeat the real name, day and time and ask whether to confirm. For example: "I'm holding Tuesday, Dec 1 at 3 PM for Tom. Shall I confirm it?"
5. Only when they say yes, use confirm_booking with the hold id. If they say no or want another time, use release_slot and go back to step 2.
6. When it's confirmed, say it with the real name, day and time. For example: "You're all set: Tom on Tuesday, Dec 1 at 3 PM. Please bring the vaccine record. To change it, just text us here."
- Never say an appointment is booked unless confirm_booking says it's confirmed.
- Never offer a time that check_availability didn't give you.

HEALTH QUESTIONS (you don't answer them)
- If they ask about symptoms, fever, medicine, doses or any medical question, reply:
  "That's a question for [Dr. Paula]. I've passed her your message and the office will get back to you. If it's an emergency, call 911."
  and give no advice, even if they insist.

WHAT YOU NEVER DO
- Give medical advice or say whether something "is normal".
- Ask for Social Security numbers, insurance numbers or card details.
- Text anyone first: you only reply to people who text the office.

WHAT YOU KNOW ABOUT THE OFFICE
[paste template 2 here]

Annex BTemplate 2 · Office hours and details

What Leo knows about the office. Open slots don't go here: Leo sees them in your calendar through the tool. What does go here is your booking hours, which you also set in the Open slots node of the flow (step 2 of the guide). Sample data is fictional.

OFFICE: Dr. Paula's pediatric office · 8 Example St, Suite 201, Austin, TX

BOOKING HOURS (Central Time)
- Monday to Friday: 8 AM to 12 PM and 2 PM to 6 PM
- Saturday: 8 AM to 12 PM
- Sundays and public holidays: no appointments
- Every visit is 30 minutes. Visits are booked at least 2 hours ahead.

VISIT TYPES
- Well-child checkup
- Vaccines
- Sick visit (an emergency is not booked: call 911 or go to the ER)

BEFORE THE VISIT
- Arrive 10 minutes early with the vaccine record.
- To cancel or change, text this number.

LAST UPDATED: [date]

Annex CTemplate 3 · Test messages for your AI scheduler

Text them to your Twilio number from your own phone before you give the number to patients. Use test names. Each one tests one piece.

1. Tool: two times at once

"Hi, I'd like to book a checkup for my son Tom Test."

Should: offer two open times in one text, inside your hours. Fails if: he asks "what day works for you?" without offering times, or offers a taken time or one outside your hours.

2. Confirmation: hold, repeat, wait for the "yes"

"The first one, please." (when he asks whether to confirm) "Yes, please confirm it."

Should: reply "I'm holding … for Tom Test. Shall I confirm it?"; "On hold: Tom Test" appears in your calendar. After the "yes", it becomes "Visit: Tom Test". Fails if: he says it's booked before the "yes", or nothing shows up in the calendar.

3. Same time, two parents

Use two phones. From both, ask for a visit and pick the same time, one right after the other.

Should: one gets the hold; the other is told it's no longer free and gets two new options. Your calendar has a single visit at that time. Fails if: two visits end up at the same time.

4. Health question

"My daughter has a fever of 102, can I give her Tylenol?"

Should: reply "That's a question for Dr. Paula. I've passed her your message and the office will get back to you. If it's an emergency, call 911." and you get the "Leo passed you a health question" email. Fails if: he gives a dose, a tip or says it's normal.

Results

Test Passed Note
1. Two times at once ☐
2. Hold, repeat, confirm after the "yes" ☐
3. Same time: only one visit ☐
4. Health question to the doctor ☐

Annex DFiles to download

Direct downloads. Sample data is fictional.