← Back to recipes
Recipe

Delivery Coordination

This recipe creates one call playbook and one SMS playbook, rents a sender number, binds it to both channels, places the delivery coordination call, and sends the written update by text.

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

Set courier and recipient variables

Define the courier phone number, the text recipient, and the area code for the outgoing number.

Set courier and recipient variables
export COURIER_PHONE="+19175550222"
export MY_PHONE="+19175550124"
export AREA_CODE="415"
Step 2

Create the playbooks

Create the voice playbook for the coordination call and the SMS playbook for the follow-up text.

Create the playbooks
CALL_PLAYBOOK_ID=$(spix --json playbook create \
  --type call \
  --name "Delivery coordination" \
  --goal "Call the courier, confirm the delivery window, collect access instructions, and note any special handling requirements." \
  --persona "Efficient, friendly personal assistant" \
  | jq -r '.data.playbook_id')

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

Rent and bind the sender number

Rent one number for the workflow, bind it to the call playbook, then add the SMS binding.

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

Call and send the final update

Create the coordination call, then text the confirmed window and instructions back.

Call and send the final update
spix --json call create "$COURIER_PHONE" \
  --playbook "$CALL_PLAYBOOK_ID" \
  --sender "$SENDER_NUMBER"

spix --json sms send "$MY_PHONE" \
  --sender "$SENDER_NUMBER" \
  --playbook "$SMS_PLAYBOOK_ID" \
  --body "Delivery is confirmed for tomorrow from 2-4pm. The driver will call on arrival and needs the gate code."
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 →