← Back to recipes
Recipe

Doctor Appointment Reschedule

This recipe creates one call playbook and one SMS playbook, rents a number, binds it to both channels, places the rescheduling call, and sends the new appointment details by text.

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

Set clinic and recipient variables

Define the clinic phone number, the recipient number, and the area code to use for the outgoing number.

Set clinic and recipient variables
export CLINIC_PHONE="+19175550888"
export MY_PHONE="+19175550124"
export AREA_CODE="415"
Step 2

Create the playbooks

Use a call playbook to reschedule the visit and an SMS playbook to send the final update.

Create the playbooks
CALL_PLAYBOOK_ID=$(spix --json playbook create \
  --type call \
  --name "Doctor appointment reschedule" \
  --goal "Call the clinic, explain that the current appointment needs to move, and secure the next available morning or late-afternoon slot." \
  --persona "Polite, clear personal assistant" \
  | jq -r '.data.playbook_id')

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

Rent and bind the sender number

Rent one number, bind it to the call playbook, then add the SMS binding for the follow-up text.

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 update

Call the clinic first, then text the new appointment details back to the user.

Place the call and send the update
CALL_SESSION_ID=$(spix --json call create "$CLINIC_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 now Thursday at 9:30am. The clinic said the same paperwork still applies."
Build your own recipe

Install Spix, then adapt this recipe to your own flow.

Use the docs to adjust the playbook goal, numbers, inboxes, and follow-up messages for your own contacts and channels.

Open the docs →