KeepSafe Messenger

Documentation Home KeepSafe Messenger Home

Live Activities API

Base URL: https://messenger.keepsafe.ai

Authentication

App API calls use an app API token generated from the admin setup flow. Send it as a bearer token.

Authorization: Bearer <API_TOKEN>
ScopePurpose
device:writeRegister or update device push tokens, ActivityKit Live Activity push tokens, SMS recipients, and email recipients.
slack:writeRegister or update Slack incoming webhook recipients.
push:sendInitiate push notifications and Live Activity updates.
sms:sendInitiate SMS messages through AWS End User Messaging.
email:sendInitiate email messages through SendGrid.
slack:sendInitiate Slack messages through registered incoming webhooks.
adminAdmin-level API access.

Register Live Activity

POST /api/live-activities/register

curl -X POST https://messenger.keepsafe.ai/api/live-activities/register \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","environment":"production","token":"ACTIVITYKIT_PUSH_TOKEN","activityId":"GAME_ID","attributesType":"GameAttributes"}'
curl -X POST https://messenger.keepsafe.ai/api/live-activities/register \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","environment":"production","activityKitPushToStartToken":"PUSH_TO_START_TOKEN","attributesType":"FireGameActivityAttributes","deviceId":"INSTALL_ID"}'
FieldRequiredNotes
appId or bundleIdYesUse the app ID from admin or the bundle/package ID.
environmentNoDefaults to production. Accepted values: production, sandbox, or development. Development Live Activity sends use APNs sandbox delivery.
tokenOne token requiredLegacy per-activity update token. Aliases: pushToken, liveActivityPushToken, or activityKitPushToken. Missing tokenType is treated as activityUpdate.
activityKitPushToStartTokenOne token requiredActivityKit push-to-start token from Activity<Attributes>.pushToStartTokenUpdates. Stored as tokenType=pushToStart and not tied to an activity ID.
tokenTypeNoactivityUpdate or pushToStart. Push-to-start tokens should use activityKitPushToStartToken; existing clients can omit this field.
activityIdNoYour app's stable identifier for an existing live activity, such as a game or order ID. Push-to-start registrations store this as empty.
attributesTypeNoThe ActivityKit attributes type name if useful for routing later.
deviceIdNoStable install/device identifier if the app has one.

Send Live Activity Start/Update

POST /api/live-activities/send

curl -X POST https://messenger.keepsafe.ai/api/live-activities/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","environment":"production","event":"start","eventId":"GAME_ID","attributesType":"FireGameActivityAttributes","attributes":{"matchup":"SEA @ POR"},"contentState":{"status":"Starts in 30 min","awayName":"SEA","awayScore":"-","homeName":"POR","homeScore":"-","detail":"Pregame"},"title":"SEA @ POR","body":"Starts in 30 minutes"}'
curl -X POST https://messenger.keepsafe.ai/api/live-activities/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","environment":"production","activityId":"GAME_ID","event":"update","timestamp":1781571000,"staleDate":1781571090,"contentState":{"status":"Q3 04:12","awayName":"SEA","awayScore":"72","homeName":"POR","homeScore":"69","detail":"Live score"},"dryRun":true}'
FieldRequiredNotes
appId or bundleIdYesIdentifies the app that owns the Live Activity.
environmentNoDefaults to production. Accepted values: production, sandbox, or development. Development Live Activity sends use APNs sandbox delivery.
activityId, target.activityIds, token target, or deviceIdNoUpdates/end events target stored activityUpdate tokens. Start events target stored pushToStart tokens. Token target accepts token, pushToken, liveActivityPushToken, activityKitPushToken, tokens, or target.tokens. Device targeting accepts deviceId, deviceIds, or target.deviceIds.
eventNostart, update, or end. Defaults to update.
eventIdStart onlyRequired for event=start. Used for ActivityKit attributes.eventId and idempotency per device/game.
attributesTypeStart onlyRequired for event=start. Must match the iOS ActivityKit attributes type, such as FireGameActivityAttributes.
attributesStart onlyOptional JSON object for start attributes. eventId is inserted automatically from the top-level eventId.
contentStateYesJSON object sent as APNs aps.content-state.
input-push-tokenAutomatic for startFor event=start, the payload includes aps.input-push-token = 1 so the app can upload the per-activity update token after the Live Activity starts.
alertNoOptional APNs alert object. If omitted, title/body are used when present.
timestamp / staleDate / dismissalDateNoUnix timestamps mapped to APNs timestamp, stale-date, and dismissal-date. If omitted, timestamp defaults to current Unix seconds.
dryRunNoSet true to record matched Live Activity tokens without sending to APNs.