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.
Use one phone number for the provider and one for the person who should receive the confirmation text.
export PROVIDER_PHONE="+19175550123"
export MY_PHONE="+19175550124"
export AREA_CODE="415"Create a call playbook for the confirmation call and an SMS playbook for the text follow-up.
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')Find one available number, rent it for the call flow, and bind the same number to the SMS playbook.
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"Create the call session, then send the confirmed details back by 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."Use the docs to adjust the playbook goal, numbers, inboxes, and follow-up messages for your own customers, leads, patients, or operators.