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

  1. A OneSignal Paid Plan.
  2. Turn on Send History via OneSignal API in Settings -> Analytics. Cannot get data before this was turned on.
  3. Must be called within 7 days after sending the message.
  4. Messages targeting under 1000 recipients will not have "sent" events recorded, but will show "clicked" events.
  5. Requires your OneSignal App's REST API Key, available in Keys & IDs.

Example Code - Notification History

curl -X POST \
  https://app.onesignal.com/api/v1/notifications/{notification_id}/history \
  -H 'Authorization: Basic YOUR_REST_API_KEY' \
  -H 'Cache-Control: no-cache' \
  -H 'Content-Type: application/json' \
  -d '{
    "events": "clicked",
    "app_id": "YOUR_ONESIGNAL_APP_ID",
    "email": "[email protected]"
}'
{
    "events": "sent",
    "app_id": "OneSignal_App_Id",
    "email": "Email_to_send_data"
}

Result Format - Notification History

{
    "success": true,
    "destination_url": "https://onesignal-aws-link.com"
}
{
    "errors": [
            "param `email` must be a valid email"
    ],
    "success": false
}
Language
Authentication
Basic
base64
: