Skip to main content

Get Push Notifications

This endpoint retrieves a list of push notifications for a platform. It provides information about both sent and scheduled notifications, allowing administrators to monitor and manage their notification campaigns.

Endpoint

  • URL: /api/push-notifications
  • Method: GET
  • Authentication: Required (Admin access)

Query Parameters

ParameterTypeRequiredDescription
pageintegerNoPage number for pagination (default: 1)
limitintegerNoNumber of items per page (default: 10)
sortstringNoField to sort by (default: "createdAt")
orderstringNoSort order, either "ASC" or "DESC" (default: "DESC")
PlatformIdintegerNoFilter notifications by platform ID
GroupIdintegerNoFilter notifications by group ID

Response

Success Response

  • Code: 200 OK
  • Content:
{
"count": 2,
"rows": [
{
"id": 123,
"GroupId": 456,
"PlatformId": 789,
"title": "New Feature Announcement",
"message": "We've just launched a new feature! Check it out now.",
"status": "sent",
"scheduledFor": "2023-11-15T10:00:00.000Z",
"createdAt": "2023-11-10T08:30:00.000Z",
"updatedAt": "2023-11-15T10:01:00.000Z",
"parameterData": "{}",
"destinationPage": "Home"
},
{
"id": 124,
"GroupId": 456,
"PlatformId": 789,
"title": "Upcoming Maintenance",
"message": "The platform will be down for maintenance on Saturday.",
"status": "scheduled",
"scheduledFor": "2023-11-20T08:00:00.000Z",
"createdAt": "2023-11-10T09:15:00.000Z",
"updatedAt": "2023-11-10T09:15:00.000Z",
"parameterData": "{}",
"destinationPage": "Settings"
}
]
}

Error Response

  • Code: 400 Bad Request
  • Content:
{
"error": "Something went wrong"
}

Notes

  • The response includes both sent and scheduled notifications
  • The status field can be one of: "draft", "scheduled", "sent", or "error"
  • Notifications with a scheduledFor date in the past and a status of "scheduled" have already been sent
  • The parameterData field contains JSON data that can be used by the mobile app for deep linking
  • The destinationPage field specifies which page in the mobile app should be opened when the notification is tapped

Example

curl -X GET "https://api.example.com/api/push-notifications?PlatformId=789&limit=10" \
-H "Authorization: Bearer YOUR_AUTH_TOKEN"