KeepSafe Messenger

Documentation Home KeepSafe Messenger Home

Email Messages 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 Email Recipient

POST /api/email/register

curl -X POST https://messenger.keepsafe.ai/api/email/register \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","recipientId":"user-123","email":"person@example.com","label":"Jon"}'
FieldRequiredNotes
appId or bundleIdYesUse the app ID from admin or the bundle/package ID.
recipientIdYesUnique ID for this email recipient within the app. Specific email sends use this value, not the email address. Aliases: recipientKey or externalId.
emailYesEmail address to register for this app. Stored event history exposes previews only.
labelNoOptional name or recipient label for the admin recipient table.

Send Email

POST /api/email/send

Specific Recipient IDs

curl -X POST https://messenger.keepsafe.ai/api/email/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","recipientIds":["user-123"],"subject":"Hello","message":"Hello from KeepSafe Messenger","dryRun":true}'

Broadcast

curl -X POST https://messenger.keepsafe.ai/api/email/send \
  -H "Authorization: Bearer <API_TOKEN>" \
  -H "Content-Type: application/json" \
  -d '{"appId":"APP_ID","target":{"type":"broadcast"},"subject":"Hello","message":"Hello registered recipients"}'
FieldRequiredNotes
appId or bundleIdYesIdentifies the app that owns the send event.
recipientId, recipientIds, or target.recipientIdsNoSpecific send target. Every ID must already be registered for this app.
target.typeNoUse broadcast to send to all registered email recipients for the app. Specific sends use recipient IDs, not email addresses.
subject or titleYesEmail subject.
message or bodyNoPlain-text body. Required unless html is present.
html or htmlBodyNoOptional HTML body. Required unless plain text is present.
dryRunNoSet true to record the email event without calling SendGrid.