KeepSafe Messenger

Documentation Home KeepSafe Messenger Home

Push Notifications 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 Device

POST /api/devices/register

curl -X POST https://messenger.keepsafe.ai/api/devices/register \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","platform":"ios","environment":"production","token":"APNS_DEVICE_TOKEN","deviceId":"INSTALL_ID"}'
FieldRequiredNotes
appId or bundleIdYesUse the app ID from admin or the bundle/package ID.
platformYesios or android.
environmentNoDefaults to production; use sandbox for development APNs tokens.
tokenYesThe APNs device token or future FCM token.
deviceIdNoStable install/device identifier if the app has one.

Send Push

POST /api/push/send

Broadcast

curl -X POST https://messenger.keepsafe.ai/api/push/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","platform":"ios","environment":"production","title":"Hello","body":"Broadcast message"}'

Specific Push Token

curl -X POST https://messenger.keepsafe.ai/api/push/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","platform":"ios","environment":"production","target":{"type":"tokens","tokens":["APNS_DEVICE_TOKEN"]},"title":"Hello","body":"One device"}'

Topic

curl -X POST https://messenger.keepsafe.ai/api/push/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","platform":"ios","environment":"production","target":{"type":"topic","topic":"news.breaking"},"title":"Hello","body":"Topic message"}'

Dry Run

curl -X POST https://messenger.keepsafe.ai/api/push/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","platform":"ios","environment":"production","title":"Dry run","body":"No push will be sent","dryRun":true}'
FieldRequiredNotes
appId or bundleIdYesIdentifies the app to send for.
platformNoios or android. Blank includes matching devices across platforms where supported.
environmentNoDefaults to production.
titleYesNotification title.
bodyYesNotification body.
targetNoDefaults to broadcast. Use {"type":"tokens","tokens":["..."]} or {"type":"topic","topic":"..."}.
dryRunNoSet true to record recipients and deliveries without sending.
dataNoCustom data fields merged into the payload.