Notifications API

Notifications API

The Staffbase API is available under the URI https://backend.staffbase.com/api/. For sending requests to the resources described here please add the desired resource to the end of this base path, e.g. the absolute URI for the /posts-resource will be https://backend.staffbase.com/api/posts.

If your app is hosted on our German infrastructure, please use https://de.staffbase.com/api/ as base URI for all requests.

All end points for our News API require authentication. To learn how authentication works with the Staffbase API please consider the authentication section.The token for the authentication needs to have one of the following access levels:

  • Administrator
  • Managing Editor
  • Editor

/notifications

POST

Third-party developers can now utilize our Notifications API to send notifications using the app. So custom plugins as well as the Staffbase plugins, like the Christmas Calendar, can now get direct attention for new or updated content in the plugin.

Notifications can be sent to specific users, user groups or all users in your company.

The Notifications API sends notifications to all users and users cannot deactivate this in their own notification settings. At the moment users can only deactivate mobile push notifications for posts, comments, and the chat. You should inform your users about this behavior and use the notifications in a reasonable manner.

Body

Examples:

Content-Type: application/json;charset=utf-8
{
"recipients": {
    "accessorIds": ["5bc5d9f3ccd66674cad763e9"], // accessorIds for all users in your company via the branchId of the app, groups or users
  },
  "content": {
    "en_US": {
      "title": "Look here!"
    }
  },
  // (optional)
  "link": "/content/page/58d29169e4b013dab75a444a"
}

Body Parameters

recipients array of strings Specify recipients as a list of IDs (accessorIds) which will receive the push notification. The recipients can be a single user, a group of users or all users of the company.
content key-value pair The text for the push notification. You can provide multiple localizations. For each user the notification is displayed in the language set in the user profile. If this language is not available then the company’s default language is used.
link string

Optional. Specify a path that is transformed to a link. The notification leads directly to the linked content within the app.
Options to give the path:

  • null
    This links to the app’s start page.
  • relative path
    e.g. pathToPlugin?[param]=[value]
    Appended to the link used for null.
  • absolute path, no transformation
    e.g. /pathToPlugin?[param]=[value]

Responses

200 OK

Returns the created notification with its content, link and the list of recipient IDs.

Examples:

Content-Type: application/json;charset=utf-8
{
  "id": "5bd069aa2158f0f32594fee1",
  "recipients": {
     "accessorIds": ["5bc5d9f3ccd66674cad763e9"]
  },
  "content": {
    "en_US": {
      "title": "Look here!"
    }
  },
  "link": "/content/page/58d29169e4b013dab75a444a",
  "type": "installation",
  "reference": {
    "id": "5bc5d9f4ccd66674cad763f3",
    "entityType": "installation"
  },
  "channels": ["push"],
  "createdAt": "2018-10-24T12:46:34.792Z"
}