Notification API

Available upon request

The Notification API is not activated by default and is available upon request from your Telenor Connexion representative.

The Notification API is used to manage configuration of push notifications for triggered rules.

UPDATE_PLATFORM_CONFIGURATION

Required role: ReadWrite Required domain: root

Updates the platform configuration for push notifications. Currently, the only supported platform is Firebase Cloud Messaging (FCM).

API Endpoint: [POST]: /notifications/platforms

Request

Headers

  • Authorization: The Authorization token returned from /auth/login
  • x-api-key: The API Key to identify the request

Body

  • type: The platform type (FCM) required
  • projectId: The Project Number for your Firebase project required
  • apiKey: The stringified private key object for a Service Account created through your FCM console. The Service Account needs to have permissions for firebasenotifications.messages.create. required
  • silent: Determines whether the push notification should be sent silently to the device (true | false).
    • Defaults to false.
    • If set to false the notification will display the name of the rule that triggered it. If set to true the notification will not be displayed and can be handled by the app in the background.

Example payload

{
  "type": "FCM",
  "projectId": "0000000000000",
  "apiKey": "<STRINGIFIED_PRIVATE_KEY>",
  "silent": true
}

Response

{}

Errors

Key Params Property Description
INVALID_ARGUMENTS query Returned if the request is invalid or does not meet the requirements specified above.
NOT_AUTHORIZED Returned if the user is not authorized for the operation.

REGISTER_DEVICE

Registers a device for the authenticated user to receive push notifications.

API Endpoint: [POST]: /notifications/devices

Request

Headers

  • Authorization: The Authorization token returned from /auth/login
  • x-api-key: The API Key to identify the request

Body

  • token: The FCM device token. required
  • platform: The device platform (android | ios) required

Example payload

{
  "token": "<FCM_DEVICE_TOKEN>",
  "platform": "ios"
}

Response

{}

Errors

Key Params Property Description
INVALID_ARGUMENTS Returned if the request is invalid or does not meet the requirements specified above.

DEREGISTER_DEVICES

Deregisters either a single device or all devices for the authenticated user.

API Endpoint: [DELETE]: /notifications/devices

Request

Headers

  • Authorization: The Authorization token returned from /auth/login
  • x-api-key: The API Key to identify the request

Query parameters

  • token: The token of the device to deregister for the user. If not set, all devices get deregistered. optional

Response

{}

Errors

Key Params Property Description
INVALID_ARGUMENTS query Returned if the request is invalid or does not meet the requirements specified above.

LIST_DEVICES

List all registered devices for the authenticated user.

API Endpoint: [GET]: /notifications/devices

Request

Headers

  • Authorization: The Authorization token returned from /auth/login
  • x-api-key: The API Key to identify the request

Response

  • An array containing all registered devices for the authenticated user.
    • userId: The id of the user.
    • token: The FCM device token.
    • platform: The device platform