Any framework (REST)
What every app does to receive Pushtifly notifications, without an SDK.
All the framework guides follow these five steps. If your framework doesn't have its own guide (NativeScript, Kotlin Multiplatform, others), this one is yours.
1. Get the push token
Use your framework's usual push library:
- Android: always FCM, as a registration token or as an Installation ID.
- iOS: direct APNs, or FCM if you use Firebase on iOS.
Ask the user for permission before getting the token on iOS and on Android 13+.
2. Register the device
Every time the app starts or the token changes:
POST https://api.pushtifly.com/v1/devices
Authorization: Bearer pk_live_YOUR_PUBLIC_KEY
Content-Type: application/json
{
"token": "TOKEN",
"platform": "ios",
"environment": "auto",
"language": "en",
"timezone": "America/New_York",
"appVersion": "2.4.0",
"osVersion": "18.1",
"deviceModel": "iPhone15,2",
"notificationsEnabled": true,
"framework": "flutter"
}
- It's an upsert: repeating it doesn't duplicate anything.
provider(fcm/apns) is detected from the token format.- On iOS,
environment: "auto"lets Pushtifly detect sandbox or production; if you know it, send it. - If the app doesn't have the provider's credential yet, the device stays
pending_credentialand becomes active automatically once it's uploaded.
3. Identify the user (optional, recommended)
When the user signs in, link the device to your user id. That way you can send to all their devices with target: { type: "external_users", ids: [...] }:
POST /v1/devices/{token}/identify
{ "externalUserId": "customer-123" }
On sign-out: POST /v1/devices/{token}/logout.
Tags and topics:
PUT /v1/devices/{token}/tagswith{"tags": {"plan": "gold"}};POST /v1/devices/{token}/topics/offers.
4. Show and open the notification
- With the app closed or in the background, the system shows the notification by itself.
- With the app open, many libraries don't show it: you have to do it in code. See your framework's guide.
- When it's tapped, read the payload data:
_phid: the send's id;deepLink: the deep link, if any;- your
data; _ph: JSON with media, buttons and link.
5. Report the events
So analytics can show delivery, opens and clicks:
POST /v1/events
{ "type": "opened", "token": "TOKEN", "notificationId": "<_phid>" }
Types:
received,opened,clicked(withactionIdif it was a button) anddismissed;permission_grantedandpermission_deniedwhen the permission changes.
You can send a batch of up to 100 with {"events": [...]}.
Test device
To test with test keys, pair the phone: the panel shows a 6-digit code and the app sends it with POST /v1/devices/{token}/pair and {"code": "123456"}.