Server SDK Reference
Reference guide for OneSignal server SDK API methods.
All server-side SDKs for User Model are currently under beta. User Model is a fundamental shift in how we think about a users and their subscriptions, so take special care when using a server-side SDK in your production app.
App Management
createApp()
Creates a new OneSignal app.
getApp()
View the details of a single OneSignal app.
getApps()
View the details of all of your current OneSignal apps.
updateApp()
Updates the name or configuration settings of an existing OneSignal app
Segmentation
A paid plan is required to create segments on your server programmatically. Users of our Free plan can continue creating segments within the OneSignal Dashboard.
createSegments()
Create segments visible and usable in the dashboard and API. Like creating Segments from the dashboard, you can pass in filters with multiple.AND
or OR
operators.
getSegments()
Get all segments created from the dashboard and the REST API.
deleteSegments()
Deletes segments. Note that this doesn’t delete devices or users in the given segment.
Outcomes
Outcomes are only stored on our servers for 30 days. You must export this data every month if you wish to keep it as outcomes older than 30 days are removed from our servers.
getOutcomes()
View the details of all the outcomes associated with your app.
Live Activities
updateLiveActivity()
Updates a specified live activity.
User Model
createUser()
Creates a User, optionally Subscriptions owned by the User and Aliases. Aliases provided in the payload will be used to look up an existing User.
fetchUser()
Returns an existing user matching a given Alias.
updateUser()
Updates an existing user matching a given Alias. To update Data Tags, modify the tags
property on the user object.
deleteUser()
Removes an existing user matching a given Alias.
fetchUserIdentity()
Lists all Aliases for an existing user matching a given Alias.
identifyUserByAlias()
Add one or more Aliases to an existing user matching a given Alias.
If a provided Alias Label doesn’t exist, it will be created automatically for you.
getEligibleIams()
Manifest of In-App Messages the subscription is eligible to display by the SDK.
Notifications
createNotification()
Send a notification to your users.
getNotifications()
View the details of multiple notifications.
getNotification()
View the details of a single notification and the outcomes associated with it.
cancelNotification()
Stop a scheduled or currently outgoing notification.
getNotificationHistory()
View the recipients of a notification.
All devices that received the message are returned if used within seven (7) days of the date sent; however, no history is available after seven days. After receiving a successful response, you can
- Poll the URL until a
.csv
file becomes available. Most exports complete in three minutes or less; we recommend pollingURL
in 10-second intervals. - If you prefer to receive an email, provide an email address you would like to receive an email report instead. Messages targeting fewer than 1,000 recipients will not have “sent” events recorded, but “clicked” events will.
Enable by navigating to OneSignal Dashboard -> Setting -> Integreations and activating Send History via OneSignal API.
Subscriptions
createSubscription()
Create a new subscription for an existing user.
Subscription Types
Email
SMS
iOSPush
AndroidPush
HauweiPush
FireOSPush
WindowsPush
macOSPush
ChromeExtensionPush
Chrome
SafariLegacyPush
SafariPush
FirefoxPush
updateSubscription()
Update an existing subscription.
transferSubscription()
Transfer a subscription from one user to another.
deleteSubscription()
Delete an existing subscription.