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.
Use shell variables so the rest of the flow can be pasted without manual edits in every command.
export PATIENT_PHONE="+19175550123"
export AREA_CODE="415"Create a call playbook for the conversation and an SMS playbook for the confirmation text.
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')Search for one available number, rent it for voice, then 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"Capture the created call session ID so it can be inspected later if needed.
CALL_SESSION_ID=$(spix --json call create "$PATIENT_PHONE" \
--playbook "$CALL_PLAYBOOK_ID" \
--sender "$SENDER_NUMBER" \
| jq -r '.data.session_id')Use the SMS playbook explicitly so the text routes through the correct channel binding.
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."Use the docs to adjust the playbook goal, numbers, inboxes, and follow-up messages for your own customers, leads, patients, or operators.