Recipe
Order Status Notifications
This recipe creates an inbox for outbound order emails, creates an SMS playbook for updates, rents and binds a sender number, then sends both the text and email notifications.
SMSEmail
Set order variables
Set the order number, customer email, customer phone number, and the URL used in the notifications.
Set order variables
export ORDER_ID="12345"
export CUSTOMER_PHONE="+19175550789"
export CUSTOMER_EMAIL="customer@example.com"
export TRACKING_URL="https://track.example.com/12345"
export AREA_CODE="415"Create the email inbox and SMS playbook
Create the sender inbox for email and the SMS playbook that will own the outbound sender number.
Create the email inbox and SMS playbook
ORDERS_INBOX=$(spix --json email inbox create \
--username orders \
--name "Order Updates" \
| jq -r '.data.address')
SMS_PLAYBOOK_ID=$(spix --json playbook create \
--type sms \
--name "Order status notifications" \
--use-case delivery_notifications \
| jq -r '.data.playbook_id')Rent and bind the SMS sender number
Pick one available number in the desired area code, rent it, and bind it to the SMS playbook.
Rent and bind the SMS 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 sms \
--bind-playbook "$SMS_PLAYBOOK_ID" \
--confirmSend the notifications
Send the outbound SMS and the email update with the same order context.
Send the notifications
spix --json sms send "$CUSTOMER_PHONE" \
--sender "$SENDER_NUMBER" \
--playbook "$SMS_PLAYBOOK_ID" \
--body "Your order #$ORDER_ID has shipped. Estimated delivery: Thursday. Track: $TRACKING_URL"
spix --json email send \
--sender "$ORDERS_INBOX" \
--to "$CUSTOMER_EMAIL" \
--subject "Your order #$ORDER_ID has shipped" \
--body "Great news. Your order is on its way. Tracking: $TRACKING_URL. Estimated delivery: Thursday March 20."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.