Installation
- Bundle
- CDN
Schemes
Register for push (custom setups only)
Despia requests push permission and registers the device with OneSignal automatically at app launch. You do not need to call this. It is only available if you have disabled auto-registration in the Despia dashboard and want to trigger the permission prompt at a specific point in your own flow.Link user ID
Associates the device with your user. Call this on every authenticated app load, immediately after you confirm the user is logged in. This is how OneSignal knows which device to deliver a notification to when you send it.| Parameter | Required | Description |
|---|---|---|
user_id | Yes | Your user’s ID from your own database. This becomes the external_id in OneSignal. |
include_external_user_ids when sending notifications from your backend.
Check push permission status
Check whether the user has push notifications enabled on their device. Use this to show an in-app prompt directing them to their settings if they have not granted permission.| Return key | Type | Description |
|---|---|---|
nativePushEnabled | boolean | true if the user has granted push permission, false if denied or not yet requested |
settingsapp:// opens the device settings page for your app where the user can enable notifications directly.
Full client-side setup
Backend: send a notification
Send notifications from your backend using OneSignal’s REST API. Useinclude_external_user_ids to target specific users by the same ID you passed to setonesignalplayerid://.
Send to multiple users
Send to all users
Notification payload options
| Field | Type | Description |
|---|---|---|
app_id | string | Your OneSignal App ID |
include_external_user_ids | string[] | Target specific users by your user ID |
included_segments | string[] | Target a segment, e.g. ["All"], ["Active Users"] |
headings | object | Title per language, e.g. { en: "Title" } |
contents | object | Body per language, e.g. { en: "Message" } |
data | object | Custom key-value data delivered with the notification |
send_after | string | Schedule delivery, e.g. "2026-01-01T09:00:00Z" |
delayed_option | string | "timezone" to deliver at a specific local time |
delivery_time_of_day | string | Time for timezone delivery, e.g. "9:00AM" |
Deep linking from a notification
To navigate the WebView to a specific page when a user taps a notification, add aurl key inside the data field of the OneSignal REST API payload.
Segmentation
Beyondinclude_external_user_ids, OneSignal supports segments based on user behaviour. Set tags on users to create custom segments.
Resources
NPM Package
despia-native
OneSignal Dashboard
Configure your push notification app
Create Notification API
Full OneSignal REST API reference