← Back to recipes
Recipe

Appointment Confirmation

This recipe creates one call playbook and one SMS playbook, rents a number, binds that number to both channels, places the confirmation call, and sends a follow-up text after the call.

Estimated cost~$0.50 / appointment
ChannelsVoice + SMS
VoiceSMS
Get started in docs →
Step 1

Set target variables

Use shell variables so the rest of the flow can be pasted without manual edits in every command.

Set target variables
export PATIENT_PHONE="+19175550123"
export AREA_CODE="415"
Step 2

Create the playbooks

Create a call playbook for the conversation and an SMS playbook for the confirmation text.

Create the playbooks
CALL_PLAYBOOK_ID=$(spix --json playbook create \
  --type call \
  --name "Appointment confirmation" \
  --goal "Confirm the appointment date and time. If the patient cannot make it, collect their preferred alternative." \
  --persona "Calm, efficient scheduling assistant" \
  | jq -r '.data.playbook_id')

SMS_PLAYBOOK_ID=$(spix --json playbook create \
  --type sms \
  --name "Appointment confirmation texts" \
  --use-case appointment_reminders \
  | jq -r '.data.playbook_id')
Step 3

Rent and bind the sender number

Search for one available number, rent it for voice, then bind the same number to the SMS playbook.

Rent and bind the sender number
SENDER_NUMBER=$(spix --json phone rent --area-code "$AREA_CODE" --limit 1 | jq -r '.data[0].number')

spix --json phone rent \
  --number "$SENDER_NUMBER" \
  --bind-channel call \
  --bind-playbook "$CALL_PLAYBOOK_ID" \
  --confirm

spix --json phone bind "$SENDER_NUMBER" \
  --channel sms \
  --playbook "$SMS_PLAYBOOK_ID"
Step 4

Place the call

Capture the created call session ID so it can be inspected later if needed.

Place the call
CALL_SESSION_ID=$(spix --json call create "$PATIENT_PHONE" \
  --playbook "$CALL_PLAYBOOK_ID" \
  --sender "$SENDER_NUMBER" \
  | jq -r '.data.session_id')
Step 5

Send the confirmation text

Use the SMS playbook explicitly so the text routes through the correct channel binding.

Send the confirmation text
spix --json sms send "$PATIENT_PHONE" \
  --sender "$SENDER_NUMBER" \
  --playbook "$SMS_PLAYBOOK_ID" \
  --body "Your appointment is confirmed for Tuesday at 2pm. Reply to reschedule."
Build your own recipe

Install Spix, then turn this pattern into your own production flow.

Use the docs to adjust the playbook goal, numbers, inboxes, and follow-up messages for your own customers, leads, patients, or operators.

Open the docs →