Skip to content

Replace and Live Activities

Give related notifications the same replace key, and each one takes the previous one’s place, on screen and in the inbox, instead of piling up.

Terminal window
curl https://api.pocketbell.dev/v1/messages \
-H "Authorization: Bearer pb_live_…" \
-H "Content-Type: application/json" \
-d '{"title": "Deploying main", "message": "Building image",
"replace": "deploy-4f2a91c"}'

A key is 1 to 64 letters, digits, ., _, : or -, and applies within one Source.

Add progress, from 0 to 1, to a notification with a replace key, and the event appears as a Live Activity on your iPhones: on the Lock Screen and in the Dynamic Island.

Terminal window
# Starts the Live Activity
-d '{"title": "Deploying main", "message": "Building image",
"replace": "deploy-4f2a91c", "progress": 0.1}'
# Updates it, quietly
-d '{"title": "Deploying main", "message": "Rolling out, 3 of 5",
"replace": "deploy-4f2a91c", "progress": 0.6}'
# Ends it, with a notification
-d '{"title": "Deployed main", "message": "4f2a91c is live",
"replace": "deploy-4f2a91c", "progress": 1}'
  • The first notification with a key and progress starts it.
  • Each one after it with the same key updates it. Updates between the first and the last arrive quietly.
  • progress: 1, or a notification with the key and no progress, ends it.

On iPad and Mac, and on Free, the same notifications arrive as ordinary notifications, each replacing the last.