← Back to recipes
Recipe

Appointment Confirmation

This recipe creates a call playbook to confirm the appointment, creates an SMS playbook for the follow-up text, rents one number, binds it to both channels, places the call, and sends a written confirmation.

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

Set provider and recipient variables

Use one phone number for the provider and one for the person who should receive the confirmation text.

Set provider and recipient variables
export PROVIDER_PHONE="+19175550123"
export MY_PHONE="+19175550124"
export AREA_CODE="415"
Step 2

Create the playbooks

Create a call playbook for the confirmation call and an SMS playbook for the text follow-up.

Create the playbooks
CALL_PLAYBOOK_ID=$(spix --json playbook create \
  --type call \
  --name "Appointment confirmation" \
  --goal "Call the provider, confirm the appointment date and time, and ask whether anything needs to be brought to the visit." \
  --persona "Calm, organized personal 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

Find one available number, rent it for the call flow, and 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 and send the text

Create the call session, then send the confirmed details back by text.

Place the call and send the text
CALL_SESSION_ID=$(spix --json call create "$PROVIDER_PHONE" \
  --playbook "$CALL_PLAYBOOK_ID" \
  --sender "$SENDER_NUMBER" \
  | jq -r '.data.session_id')

spix --json sms send "$MY_PHONE" \
  --sender "$SENDER_NUMBER" \
  --playbook "$SMS_PLAYBOOK_ID" \
  --body "Your appointment is confirmed for Tuesday at 2pm. They asked you to arrive 10 minutes early."
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 →