Skip to main content

Content server integration

To trigger dispatch of a push notification to all subscribers, there needs to be some code running when the content authors publish a new article or other content item. This can typically be implemented using a webhook, but will vary between CMS-es and depend the availablity of development resources and server code access.

Step 1

To initiate a dispatch of a push notification, you will notify the Subrite API. If you specify the optional field topic, only subscribers to that specific topic will receive a notification. If you don't supply a topic, all subscribers will be notified, no matter what topics they have subscribed to.

  • Method: POST
  • Route: {baseUrl}/api/v1/app-push/pushcontent
  • Authorization: Bearer token (using the M2M generated in Basic setup, step 5)
  • Body: See example below

Example of body :

{
"title": "Subrite",
"body": "Breaking! Subrite has won the Platform of the year Award",
"data": {
// insert the data you need to open the app in the preferred state here
// it will be delivered as part of the payload
},
"topic": "subrite"
}

Step 2

Once a campaign has been dispatched, you can read it back from the Subrite API. All three endpoints below accept the same M2M token as step 1, and require the Push Content section with Read selected (push-content:read) on the M2M client.

The endpoints only return campaigns belonging to the tenant the M2M token was issued for.

List campaigns

  • Method: GET
  • Route: {baseUrl}/api/v1/app-push/pushcampaign
  • Authorization: Bearer <M2M token>
  • Query parameters: page (default 1), take (page size, default 10, max 50), orderDirection (ASC or DESC by creation date, default DESC)

Example of response :

{
"items": [
{
"id": 1234,
"createdAt": "2026-08-12T09:15:00.000Z",
"updatedAt": "2026-08-12T09:16:04.000Z",
"title": "Breaking news",
"body": "A new article has just been published",
"data": {
// the payload delivered to the app, as supplied when dispatching
},
"tenantId": 1,
"status": "dispatched",
"topics": ["news"],
"segmentId": null,
"scheduledAt": null
}
],
"meta": {
"page": 1,
"take": 10,
"count": 1,
"pageCount": 1,
"hasPreviousPage": false,
"hasNextPage": false
}
}

Get a single campaign

  • Method: GET
  • Route: {baseUrl}/api/v1/app-push/pushcampaign/{id}
  • Authorization: Bearer <M2M token>

The response is a single campaign object, identical to one entry of the items array above.

Get campaign delivery stats

  • Method: GET
  • Route: {baseUrl}/api/v1/app-push/pushcampaign/{id}/stats
  • Authorization: Bearer <M2M token>

Example of response :

{
"total": 1500, // notifications queued for this campaign
"sending": 0, // still in flight
"sent": 1476, // delivered to the push provider
"failed": 24, // permanently failed, e.g. expired device tokens
"opened": 412 // opened in the app, as reported by the open tracking call
}

And you're done, good luck!