Module default_api

Module default_api 

Source

Enums§

CancelNotificationError
struct for typed errors of method cancel_notification
CreateAliasBySubscriptionError
struct for typed errors of method create_alias_by_subscription
CreateAliasError
struct for typed errors of method create_alias
CreateAppError
struct for typed errors of method create_app
CreateNotificationError
struct for typed errors of method create_notification
CreateSegmentError
struct for typed errors of method create_segment
CreateSubscriptionError
struct for typed errors of method create_subscription
CreateUserError
struct for typed errors of method create_user
DeleteAliasError
struct for typed errors of method delete_alias
DeleteSegmentError
struct for typed errors of method delete_segment
DeleteSubscriptionError
struct for typed errors of method delete_subscription
DeleteUserError
struct for typed errors of method delete_user
ExportEventsError
struct for typed errors of method export_events
ExportSubscriptionsError
struct for typed errors of method export_subscriptions
GetAliasesBySubscriptionError
struct for typed errors of method get_aliases_by_subscription
GetAliasesError
struct for typed errors of method get_aliases
GetAppError
struct for typed errors of method get_app
GetAppsError
struct for typed errors of method get_apps
GetNotificationError
struct for typed errors of method get_notification
GetNotificationHistoryError
struct for typed errors of method get_notification_history
GetNotificationsError
struct for typed errors of method get_notifications
GetOutcomesError
struct for typed errors of method get_outcomes
GetSegmentsError
struct for typed errors of method get_segments
GetUserError
struct for typed errors of method get_user
TransferSubscriptionError
struct for typed errors of method transfer_subscription
UnsubscribeEmailWithTokenError
struct for typed errors of method unsubscribe_email_with_token
UpdateAppError
struct for typed errors of method update_app
UpdateLiveActivityError
struct for typed errors of method update_live_activity
UpdateSubscriptionError
struct for typed errors of method update_subscription
UpdateUserError
struct for typed errors of method update_user

Functions§

cancel_notification
Used to stop a scheduled or currently outgoing notification
create_alias
Upserts one or more Aliases to an existing User identified by (:alias_label, :alias_id).
create_alias_by_subscription
Upserts one or more Aliases for the User identified by :subscription_id.
create_app
Creates a new OneSignal app
create_notification
Sends notifications to your users
create_segment
Create a segment visible and usable in the dashboard and API - Required: OneSignal Paid Plan The Create Segment method is used when you want your server to programmatically create a segment instead of using the OneSignal Dashboard UI. Just like creating Segments from the dashboard you can pass in filters with multiple "AND" or "OR" operator’s. 🚧 Does Not Update Segments This endpoint will only create segments, it does not edit or update currently created Segments. You will need to use the Delete Segment endpoint and re-create it with this endpoint to edit.
create_subscription
Creates a new Subscription under the User provided. Useful to add email addresses and SMS numbers to the User.
create_user
Creates a User, optionally Subscriptions owned by the User as well as Aliases. Aliases provided in the payload will be used to look up an existing User.
delete_alias
Deletes an alias by alias label
delete_segment
Delete a segment (not user devices) - Required: OneSignal Paid Plan You can delete a segment under your app by calling this API. You must provide an API key in the Authorization header that has admin access on the app. The segment_id can be found in the URL of the segment when viewing it in the dashboard.
delete_subscription
Deletes the Subscription.
delete_user
Removes the User identified by (:alias_label, :alias_id), and all Subscriptions and Aliases
export_events
Generate a compressed CSV report of all of the events data for a notification. This will return a URL immediately upon success but it may take several minutes for the CSV to become available at that URL depending on the volume of data. Only one export can be in-progress per OneSignal account at any given time.
export_subscriptions
Generate a compressed CSV export of all of your current user data This method can be used to generate a compressed CSV export of all of your current user data. It is a much faster alternative than retrieving this data using the /players API endpoint. The file will be compressed using GZip. The file may take several minutes to generate depending on the number of users in your app. The URL generated will be available for 3 days and includes random v4 uuid as part of the resource name to be unguessable. 🚧 403 Error Responses You can test if it is complete by making a GET request to the csv_file_url value. This file may take time to generate depending on how many device records are being pulled. If the file is not ready, a 403 error will be returned. Otherwise the file itself will be returned. 🚧 Requires Authentication Key Requires your OneSignal App’s REST API Key, available in Keys & IDs. 🚧 Concurrent Exports Only one concurrent export is allowed per OneSignal account. Please ensure you have successfully downloaded the .csv.gz file before exporting another app. CSV File Format: - Default Columns: | Field | Details | | — | — | | id | OneSignal Player Id | | identifier | Push Token | | session_count | Number of times they visited the app or site | language | Device language code | | timezone | Number of seconds away from UTC. Example: -28800 | | game_version | Version of your mobile app gathered from Android Studio versionCode in your App/build.gradle and iOS uses kCFBundleVersionKey in Xcode. | | device_os | Device Operating System Version. Example: 80 = Chrome 80, 9 = Android 9 | | device_type | Device Operating System Type | | device_model | Device Hardware String Code. Example: Mobile Web Subscribers will have Linux armv | | ad_id | Based on the Google Advertising Id for Android, identifierForVendor for iOS. OptedOut means user turned off Advertising tracking on the device. | | tags | Current OneSignal Data Tags on the device. | | last_active | Date and time the user last opened the mobile app or visited the site. | | playtime | Total amount of time in seconds the user had the mobile app open. | | amount_spent | Mobile only - amount spent in USD on In-App Purchases. | | created_at | Date and time the device record was created in OneSignal. Mobile - first time they opened the app with OneSignal SDK. Web - first time the user subscribed to the site. | | invalid_identifier | t = unsubscribed, f = subscibed | | badge_count | Current number of badges on the device | - Extra Columns: | Field | Details | | — | — | | external_user_id | Your User Id set on the device | | notification_types | Notification types | | location | Location points (Latitude and Longitude) set on the device. | | country | Country code | | rooted | Android device rooted or not | | ip | IP Address of the device if being tracked. See Handling Personal Data. | | web_auth | Web Only authorization key. | | web_p256 | Web Only p256 key. |
get_aliases
Lists all Aliases for the User identified by (:alias_label, :alias_id).
get_aliases_by_subscription
Lists all Aliases for the User identified by :subscription_id.
get_app
View the details of a single OneSignal app
get_apps
View the details of all of your current OneSignal apps
get_notification
View the details of a single notification and outcomes associated with it
get_notification_history
-> View the devices sent a message - OneSignal Paid Plan Required This method will return all devices that were sent the given notification_id of an Email or Push Notification if used within 7 days of the date sent. After 7 days of the sending date, the message history data will be unavailable. After a successful response is received, the destination url may be polled until the file becomes available. Most exports are done in ~1-3 minutes, so setting a poll interval of 10 seconds should be adequate. For use cases that are not meant to be consumed by a script, an email will be sent to the supplied email address. 🚧 Requirements A OneSignal Paid Plan. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on. Must be called within 7 days after sending the message. Messages targeting under 1000 recipients will not have "sent" events recorded, but will show "clicked" events. Requires your OneSignal App’s REST API Key, available in Keys & IDs.
get_notifications
View the details of multiple notifications
get_outcomes
View the details of all the outcomes associated with your app 🚧 Requires Authentication Key Requires your OneSignal App’s REST API Key, available in Keys & IDs. 🚧 Outcome Data Limitations Outcomes are only accessible for around 30 days before deleted from our servers. You will need to export this data every month if you want to keep it.
get_segments
Returns an array of segments from an app.
get_user
Returns the User’s properties, Aliases, and Subscriptions.
transfer_subscription
Transfers this Subscription to the User identified by the identity in the payload.
unsubscribe_email_with_token
Unsubscribe an email with a token when using your own custom email unsubscribe landing page
update_app
Updates the name or configuration settings of an existing OneSignal app
update_live_activity
Updates a specified live activity.
update_subscription
Updates an existing Subscription’s properties.
update_user
Updates an existing User’s properties.