Push reaches a contact’s devices: an iOS app, an Android app, and browsers (including iPhone Home Screen web apps). You set the apps up once in the dashboard; from then on each device is registered against its contact, and you send through the API.
Kirora’s SDKs register devices for you: the SDKs for iOS, Android, React Native, Expo and Flutter, and the web SDK on a website. Each asks for permission, registers the device against the signed-in contact, stops push to it on sign-out, and reports taps and deliveries. On iOS, delivery reports need the SDK’s notification service extension. With an SDK, you still set the apps up (step 1), then send.
An app or site that does not use an SDK does three small things itself, described below: ask for permission, hand the device’s token to your server, and report taps.
1 Set up the apps (dashboard, once)
Settings › Push apps holds push projects. A project is one product in one environment
(sandbox or production) and holds at most one app per platform. Every send targets a
project and reaches the contact on all of its ready apps.
| App | What you upload | Where it comes from |
|---|---|---|
| Web | Nothing: Kirora generates the app’s key pair and shows its vapidPublicKey |
— |
| iOS, direct to Apple | A .p8 push key, with its Key ID, your Team ID and the app’s Bundle ID |
Apple Developer › Certificates, Identifiers & Profiles › Keys (download once) |
| iOS through Firebase | Your Firebase service-account file | Firebase console › Project settings › Service accounts |
| Android | Your Firebase service-account file | Firebase console › Project settings › Service accounts |
Each key is checked with Apple or Google before it is stored, and is never shown again.
If your apps use Firebase for both platforms, upload the same service-account file to your iOS app and your Android app, and register Firebase tokens from both. Firebase reaches iPhones through Apple, so your Apple push key must also be uploaded in the Firebase console (Project settings › Cloud Messaging), and your iOS app needs Apple’s Push Notifications capability. An iOS app sends one way or the other: switching it between Apple and Firebase means your devices register again.
2 Register devices (your server)
Your app or website gets a token from the platform and gives it to your server,
which registers it with a contacts:write key. Never put an API key in an app or a
web page: anyone could extract it.
POST /v1/contacts/{id}/installations
Authorization: Bearer kirora_…
Content-Type: application/json
{
"pushAppId": "…",
"externalInstallationId": "your-stable-id-for-this-device",
"permission": "granted",
"targetKind": "fcm_token",
"target": "<the token>"
}- Your own user id works too. Add
?idType=externalIdand put the contact’sexternalId(as set with identify) in the path instead of Kirora’s id, so your server need not look the contact up first. An id that names no contact is a 404. targetKindisapns_token(iOS, direct to Apple),fcm_token(Android, or iOS through Firebase),firebase_installation_id(wherefcm_tokengoes, from an app that opted in to Firebase Messaging’sregister(), which reports the installation ID in place of a token), orweb_push_subscriptionwithsubscriptionin place oftarget: the objectPushSubscription.toJSON()returns, unchanged. A subscription whose keys were damaged in transit is refused with a 400 naming the key.- Send the device’s details when you have them:
appVersionandosVersion(apps only),locale(BCP 47,fr-CA) andtimezone(IANA,Europe/Paris). They choose a push’s language, let a segment target devices and set local send times. One left out keeps the value stored before. - Register on every app start or site visit. A device not seen for 60 days is
treated as gone. Re-registering the same
externalInstallationIdupdates it (200; a new installation is 201); signing in as someone else moves it to that contact. - Permission turned off: send
{ "pushAppId", "externalInstallationId", "permission": "denied", "lastSeenAt" }, withlastSeenAtfrom the latest registration’s response, so a late report cannot disable a newer registration: if the device registered again since, the report is refused with 409CONFLICT. - Sign-out:
DELETE /v1/contacts/{id}/installations/{externalInstallationId}(deletePushInstallation), with the device’s own id as you registered it. It stops push to that device for the contact in every push app, as the SDK’s sign-out does, and keeps the record, marked inactive. To delete a contact’s data, delete the contact withDELETE /v1/contacts/{id}. - See what is registered:
GET /v1/contacts/{id}/installations(contacts:read) lists the contact’s devices and browsers, newest first, withexternalInstallationId,platform,permission,active,lastSeenAtandinvalidatedAt. Inactive ones are included; the token or subscription never is.
Marketing push also needs the contact’s own consent: set
consent: { "push": true, "statement": … } through POST /v1/contacts/identify. The OS
permission alone does not grant it. Transactional push needs only the permission.
3 Show notifications and report taps (your app or site)
Every push carries a signed trackingUrl. When someone taps the notification, POST to it
(no API key; the URL is the credential):
{ "event": "clicked" }Send clicked when the tap follows a link (actionUrl or a button) and opened when it
opens nothing. You may also send delivered when the notification is shown. A click also
counts as an open, and an open as delivered; only the first of each counts. The URL
answers 204, or 400 once its token has expired.
Native apps receive actionUrl, imageUrl, buttons (a JSON string of
[{ title, url }]), trackingUrl and your own data keys as string data beside the
alert. Open actionUrl (an https link, or your app’s own link such as
myapp://orders/1, set in overrides.ios or overrides.android) and report the tap.
Websites run a service worker that shows the notification and reports the tap. This one does both:
self.addEventListener('push', (event) => {
const data = event.data ? event.data.json() : {};
const buttons = data.buttons || [];
event.waitUntil(
self.registration.showNotification(data.title, {
body: data.body,
image: data.imageUrl,
icon: data.iconUrl,
tag: data.tag,
actions: buttons.map((button, index) => ({ action: String(index), title: button.title })),
data,
}),
);
});
self.addEventListener('notificationclick', (event) => {
const data = event.notification.data || {};
event.notification.close();
const button = event.action ? (data.buttons || [])[Number(event.action)] : null;
const url = button ? button.url : data.actionUrl;
const report = data.trackingUrl
? fetch(data.trackingUrl, {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify({ event: url ? 'clicked' : 'opened' }),
keepalive: true,
}).catch(() => {})
: null;
event.waitUntil(Promise.all([report, url ? clients.openWindow(url) : null]));
});On the page, ask for permission from a real click (Safari refuses a request made on load), then subscribe with the app’s key and send the result to your server:
const registration = await navigator.serviceWorker.register('/sw.js');
const subscription = await registration.pushManager.subscribe({
userVisibleOnly: true,
applicationServerKey: vapidPublicKeyAsBytes, // the base64url key, decoded
});
await fetch('/your-server/push-subscription', {
method: 'POST',
headers: { 'content-type': 'application/json' },
body: JSON.stringify(subscription.toJSON()),
});iPhone and iPad web apps
iOS and iPadOS (16.4 and later) deliver web push only to a site added to the Home Screen, never to a Safari tab. To support it:
- Serve a web app manifest with
"display": "standalone", linked from your pages. - A Home Screen app keeps its own storage, separate from Safari’s, and opens at the
manifest’s
start_url(or, without one, the address it was added from). Anything the page needs to know at launch must come from that address or from your server. - Ask visitors to add the site to their Home Screen (Share › Add to Home Screen), open it from there, and allow notifications from a tap inside it.
Sending
One-to-one push (receipts, sign-in codes, alerts) is sent through the transactional API:
POST /v1/transactional/messages with a flat push object, scope transactional:send
(transactional messages). Name pushProjectId in push unless the
workspace has one project. It goes to every device that allows notifications, at high
urgency unless you set urgency. Unlike marketing push it does not need the contact’s push consent, as
transactional email needs no email consent.
Marketing push is sent through campaigns and journeys, to a project; a contact who left
its topic is skipped. Push has no suppression list: a contact stops push by withdrawing
consent (consent.push: false), and a device stops when its installation is removed or
invalidated. A journey push step marked transactional: true (an order shipped, a
security alert) goes as a transactional push does: no consent or topic needed, not
held by quiet hours or message limits.
A marketing push sent at a local time, and quiet hours, use the contact’s timezone;
for a contact without one, the time zone their most recently seen device reported.
Languages
Write the title and body in other languages under translations, keyed by language tag:
"push": {
"title": "Your order shipped", "body": "Track it here",
"translations": {
"fr": { "title": "Commande expédiée", "body": "Suivez-la ici" },
"pt-BR": { "body": "Acompanhe aqui" }
}
}Each device gets the text for the language it last reported (locale at registration):
the exact tag first, then its language (fr-CA gets fr). A device that reported none
gets the contact’s locale; anything else, the shared text. A translation replaces the
title and body on every platform, platform overrides included. Up to 30 languages.
Reaching devices by language or version
A segment’s installation condition can also require the device’s language (locale:
fr matches fr and fr-CA), its appVersion or its osVersion, each compared as
dotted numbers ({ "operator": "lt", "version": "2.10" }: older than 2.10, so 2.9.1
matches and 2.10.0 does not). The segment selects contacts with such a device; a send
still goes to all their devices.
Delivery options
All optional, in push of a transactional send or in a campaign’s push content:
| Field | Values | What it does |
|---|---|---|
urgency |
high, normal |
high asks the push service to deliver promptly, even to a locked or sleeping device; normal lets it wait for a good moment to save battery. Device settings and the app still decide whether and how it is shown. Defaults to high; choose normal for a push that can wait, knowing a locked phone may show it only once woken. Sent as APNs apns-priority (10 / 5), Android priority, and the Web Push Urgency header. |
ttl |
{ "value", "unit" }, up to 28 days |
How long Apple, Google or the browser’s push service keeps trying a device that is offline. Defaults to one day; a value of 0 delivers now or never. |
collapseKey |
up to 64 of A-Z a-z 0-9 _ - |
A newer notification with the same key replaces the older one: APNs apns-collapse-id, Android notification tag, the browser notification’s tag. |
overrides.ios.interruptionLevel |
passive, active, time-sensitive |
How iOS presents it. passive arrives without sound or lighting the screen; time-sensitive can break through Focus when the user allows it, and needs the app’s Time Sensitive Notifications capability. |
overrides.ios.threadId |
up to 64 of A-Z a-z 0-9 _ . - |
Groups notifications with the same thread in Notification Center (APNs thread-id). |
overrides.android.channelId |
the channel’s id | The Android notification channel, which your app creates. |
interruptionLevel and threadId reach iOS devices whether the app sends direct to Apple
or through Firebase. Android and web have no equivalent of either through these
providers: Firebase notification messages cannot group, and a browser notification’s
tag replaces rather than groups. critical interruption is not offered: Apple grants
that entitlement only to apps it approves. badge sets the icon’s number; neither Apple
nor Firebase can increment it, so send the count you want shown.
What each device reported
GET /v1/messages/{id}/deliveries
Authorization: Bearer kirora_… (messages:read)One row per device the message went to, with its installationId, platform and
status: accepted (Apple, Google or the browser’s push service took it, which does
not prove the device showed it), invalid (the device is gone and was retired),
rejected, retryable (will be tried again), unknown (the provider may have taken
it, so it is not resent), skipped, or pending / started while in flight.
The same endpoint covers a push sent through POST /v1/transactional/messages, with
the message id from that send. skipped means the device was not attempted: its app’s
credentials were refused for another device of the same app, or the message had already
ended.
What your app must do itself
Kirora sends the push; showing it well is the app’s job:
- Ask for permission at a moment the person understands, not on page load.
- In a service worker, wrap
showNotificationinevent.waitUntil. - On iOS, images and buttons need a notification service extension in the app; without one the push shows plainly.
- On Android, create the notification channels that
overrides.android.channelIdnames; a foreground app must show the push itself.
What each platform does with a device that has gone
When a user uninstalls the app or removes a site’s permission, the next push usually comes back “gone” and Kirora retires the device. Safari does not report it: after a browser unsubscribes, Apple keeps accepting pushes to it and drops them. Such a device drops out after 60 days without a registration; registering on every visit keeps the others current. A device not seen for 270 days is deleted, its past deliveries kept.
When a browser replaces a subscription (Firefox does; Chrome rarely), the web SDK’s
service worker reports the new one, so the device keeps receiving without waiting for the
next visit. With your own service worker, handle pushsubscriptionchange: send the new
subscription to your server and register it as in step 2, with the same
externalInstallationId.