View the devices sent a message
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.
Email Notification History
The Notification History API does not currently support "Opens" as a parameter.
Requirements
- A OneSignal Professional or Enterprise Plan.
- Enable Send History via OneSignal API in Settings -> Integrations. You cannot get data for Notifications sent before this was enabled.
- 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.
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. In which case, you set setup a retry to pull again after some time has passed. Otherwise the file itself will be returned.
Sample Response File
Timestamp column
The
timestamp
column is only included when viewing the history for "clicked" events.
player_id,onesignal_id,external_id,target_channel,timestamp
2c4fac95-7dfb-4113-9347-aba3a92ff557,ccddf35a-1233-4423-8a57-ac8c4b38eb81,a07aec27-2586-4b92-a24f-62660a1517fa,push,1628189160
68f5cf73-b20a-4de9-b6ee-79a863b8e7d8,d2f9f2f8-94af-4942-8183-115cef1213d5,4b66359f-3d94-4a73-806d-8ef5f0430b3d,push,1628187816