Skip to main content

OneSignal Push Notification API

This application provides a wrapper for the OneSignal REST API.

Available Endpoints

Currently, the application exposes two endpoints for sending push notifications:

  • Create notification
  • Retrieve delivery status

Authentication

Endpoints are secured using JWT (JSON Web Token) authentication. This is already implemented in the Aleteia platform.

Refer to this example for implementation.

The payload should contain only the application_id, and you must include the exp claim (short expiration, e.g., 1–2 minutes) to prevent replay attacks.

The JWT must be sent in the Authorization header prefixed with Bearer. Example here.

Create Notification

POST https://reports.aleteia.org/push_notifications/:application_id/create

Parameters (as JSON):

{
"notification": {
"title": "Notification Title",
"message": "Test Notification",
"link": "http://example.com",
"image": "http://placehold.it/256x256?text=Icon",
"web_image": "http://placehold.it/1024x768?text=Big+Image",
"locale": "it"
}
}

Response

HTTP 201 with JSON:

{
"id": 2,
"message": "Some message",
"link": "http://example.com",
...
}

Error: HTTP 422 (validation) or HTTP 403 (auth error).

Retrieve Notification Status

GET https://reports.aleteia.org/push_notifications/:id

Response format:

{
"id": 5,
"title": "Notification Title",
"message": "Final development test",
...
"full_status": {
"delivery_status": "completed",
...
}
}