Guide
Schedule Healthcare Appointments from the CLI
Patient scheduling needs three things: open slots a patient can take, a booked visit with a confirmation, and reminders that actually reduce no-shows. This guide builds all three from the terminal — and keeps protected health information out of email subjects, bodies, and logs.
Written by Qasim Muhammad Staff SRE
How do I offer patients open appointment slots?
You offer open slots by running nylas calendar availability find against the provider's or clinic resource's calendar. The command returns only the windows that are free, so a patient never sees a slot that's already taken. Use a 15- or 20-minute --duration for standard visits and tighten --interval to pack the schedule.
# 20-minute visit slots on Dr. Lee's calendar for next week
nylas calendar availability find \
--participants dr.lee@clinic.example \
--duration 20 --interval 20 \
--start "monday 8am" --end "friday 4pm" \
--jsonTreat the slot list as display-only and re-verify at booking time, the same way any double-booking-safe flow does. Calendars are eventually consistent, so a slot taken seconds ago can still appear for a moment in a feed read.
How do I book an appointment and send a confirmation?
You book with nylas calendar events create and add the patient as a participant so they get a calendar invite, then send a plain confirmation by email. Keep both free of clinical detail — a generic title like “Appointment” on the calendar and a neutral subject on the email. The patient knows what the visit is for; the transport layer doesn't need to.
nylas calendar events create \
--title "Appointment — Clinic" \
--start "2026-06-15 09:20" --end "2026-06-15 09:40" \
--location "123 Main St, Suite 200" \
--participant patient@example.com
nylas email send --to patient@example.com \
--subject "Your appointment is confirmed" \
--body "You're booked for Mon Jun 15, 9:20 AM. Reply to reschedule." --yesHow do I send reminders that cut no-shows?
You cut no-shows by sending two reminders — one 24 hours out and one 2 hours out — using the --schedule flag so each is queued at booking time instead of needing a separate reminder service. The two-touch cadence catches both the patient planning their day and the patient about to forget.
# Queue both reminders the moment the visit is booked
nylas email send --to patient@example.com \
--subject "Reminder: appointment tomorrow" \
--body "See you tomorrow at 9:20 AM. Reply CANCEL to free the slot." \
--schedule "2026-06-14 09:20" --yes
nylas email send --to patient@example.com \
--subject "Reminder: appointment in 2 hours" \
--body "Your appointment is at 9:20 AM today at 123 Main St, Suite 200." \
--schedule "2026-06-15 07:20" --yesHow do I keep protected health information out of the system?
You keep PHI out by sending the minimum: a date, a time, a location, and a neutral subject — never a diagnosis, procedure, medication, or reason for visit in any subject, body, calendar title, or log line. Email is a transport, not a record system. The HIPAA Privacy Rule's minimum necessary standard, 45 CFR 164.502(b), is the principle to encode: transmit only what the task requires.
Two operational rules follow. First, a covered entity needs a signed Business Associate Agreement with any vendor that handles PHI, so confirm your email provider and any tooling are in scope before going live. Second, scrub identifiers from script output and logs — reference patients by an opaque internal ID, never by name and condition together. This guide is a scheduling and reminder layer, not a HIPAA compliance program on its own.
How do I run a daily reminder job?
You automate the daily touch by listing the day's events and emailing each attendee a neutral reminder. The script pulls today's appointments with nylas calendar events list, extracts the patient address, and sends — carrying no clinical detail. Run it once each morning from cron, and guard the pipeline so an empty day exits cleanly.
#!/usr/bin/env bash
set -euo pipefail
EVENTS=$(nylas calendar events list --json)
[ -z "$EVENTS" ] && exit 0
echo "$EVENTS" | jq -r '.[] | .participants[]?.email // empty' | sort -u | while read addr; do
nylas email send --to "$addr" \
--subject "Reminder: your appointment today" \
--body "This is a reminder of your appointment today. Reply to reschedule." --yes
doneNext steps
- Secure email handling — keep sensitive data out of logs, output, and prompts
- Appointment reminder agent account — run reminders from a dedicated agent inbox
- Calendar availability for a booking page — let patients self-book from open slots
- Schedule across timezones — book telehealth visits across regions correctly
- Command reference — every flag, subcommand, and example
- 45 CFR 164.502(b) — minimum necessary — transmit only what the task requires
- 45 CFR 164.504(e) — Business Associate Agreements — what you need signed before a vendor handles PHI
- 45 CFR 164.514 — de-identification — the standard for stripping identifiers from data you keep