← 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 coordination call, and sends the written delivery confirmation.

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

Set delivery variables

Define the customer phone number and the area code used for the delivery coordinator number.

Set delivery variables
export CUSTOMER_PHONE="+19175550222"
export AREA_CODE="415"
Step 2

Create the playbooks

Create the voice playbook for delivery coordination and the SMS playbook for the written confirmation.

Create the playbooks
CALL_PLAYBOOK_ID=$(spix --json playbook create \
  --type call \
  --name "Delivery coordination" \
  --goal "Confirm the delivery window, collect access instructions, and note any special handling requirements." \
  --persona "Efficient, friendly logistics coordinator" \
  | 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 flow, bind it to the call playbook at purchase time, 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

Place the call and send the confirmation

Create the coordination call, then send the written confirmation from the same number.

Place the call and send the confirmation
spix --json call create "$CUSTOMER_PHONE" \
  --playbook "$CALL_PLAYBOOK_ID" \
  --sender "$SENDER_NUMBER"

spix --json sms send "$CUSTOMER_PHONE" \
  --sender "$SENDER_NUMBER" \
  --playbook "$SMS_PLAYBOOK_ID" \
  --body "Delivery confirmed for tomorrow 2-4pm. Access code: 4521. Driver will call on arrival. Reply to reschedule."
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 →