Overview

Table of contents

  1. What is SAP Alert Notification service for SAP BTP?
  2. Features
  3. Installation
  4. Usage
  5. Resources
  6. Alert Notification service Client API
    1. Constructor
    2. Methods
      1. create(type, data)
      2. update(type, data)
      3. get(type, name)
      4. getAll(type, params?)
      5. delete(type, name)
      6. importConfiguration(data)
      7. exportConfiguration()
      8. sendEvent(event)
      9. sendEvents(events)
      10. getMatchedEvent(eventId, params)
      11. getMatchedEvents(params)
      12. getUndeliveredEvent(eventId, params)
      13. getUndeliveredEvents(params)

What is SAP Alert Notification service for SAP BTP?

Alert Notification service is part of the DevOps portfolio of the SAP Business Technology Platform. The service is specialized in instant delivery of events coming straight from the core platform services, e.g. database or application monitoring tools. This way you’re always the first one notified whenever an issue with your dependency occurs. Additionally, Alert Notification service provides means for posting real-time crucial events directly from your application. All those events altogether - either your custom events or the platform ones, could be received on whatever channel is preferred - e-mail, Slack, custom webhook, etc. Furthermore, events can even be stored in Alert Notification service storage and pulled from it later.

Features

  • Post custom events
  • Pull already stored events - either custom or platform events, and on the other hand, either stored by request or stored because the requested action has failed for some reason
  • Manage your actions, conditions and subscriptions

Installation

Node package manager will be used in order to install Alert Notification service client:

$ npm i @sap_oss/alert-notification-client

Usage

In order to use the client you will first have to import it and create an instance:

import { AlertNotificationClient, RegionUtils, BasicAuthentication } from '@sap_oss/alert-notification-client';

const client = new AlertNotificationClient({
  authentication: new BasicAuthentication({
    username: '<your-technical-client-username>', // Replace with your username
    password: '<your-technical-client-password>' // Replace with your password
  }),
  region: RegionUtils.EU10 // Choose your region
});

Resources

Alert Notification service Client API

Constructor

Field Type Description
authentication BasicAuthentication | OAuthAuthentication Used for retrieving authorization header value
region Region Region on which your Alert Notification service instance resides
axiosRequestConfig? AxiosRequestConfig Used for overwriting the default configuration of the HTTP client
retryConfig? RetryConfig Retry configuration, which enables the retriability of failed requests to Alert Notification service

Methods

create(type, data)

update(type, data)

get(type, name)

  • Description:

    • Get a single entity with given name of the given type
  • Arguments:

    • type - EntityType (string) - type of the searched entity

    • name - (string) - name of the searched entity

  • Return value:

getAll(type, params?)

delete(type, name)

  • Description:

    • Deletes an entity with the given name and of the given type.
  • Arguments:

    • type - EntityType (string) - type of the searched entity

    • name - (string) - name of an existent entity

  • Return value:

    • Promise<void>

importConfiguration(data)

  • Description:

    • Imports a configuration.

      Note: Your current configuration will be overwritten.
  • Arguments:

  • Return value:

exportConfiguration()

  • Description:

    • Exports your current configuration.
  • Arguments:

  • Return value:

sendEvent(event)

  • Description:

    • Will send an event for ingestion to Alert Notification service.
  • Arguments:

    • event - ResourceEvent - an event to be sent to Alert Notification service
  • Return value:

sendEvents(events)

  • Description:

    • Will send multiple events at once for ingestion to Alert Notification service.

      Note: They will be ingested in the order they are sent, starting from the first one.
  • Arguments:

    • events - ResourceEvent[] - a collection of events to be sent to Alert Notification service
  • Return value:

getMatchedEvent(eventId, params)

  • Description:

    • Get a matched event with eventId (received on response) from Alert Notification service store. You can filter the received events by supplying params object.
  • Arguments:

    • eventId - (string) - event id generated by Alert Notification service and returned upon send

    • params - ConsumerQueryParams - query parameters allowed when requesting Alert Notification service consumer API

  • Return value:

getMatchedEvents(params)

  • Description:

    • Gets all matched events from Alert Notification service store. You can filter the received events by supplying params object.
  • Arguments:

    • params - ConsumerQueryParams - query parameters allowed when requesting Alert Notification service consumer API
  • Return value:

getUndeliveredEvent(eventId, params)

  • Description:

    • Get an undelivered event with eventId (received on response) from Alert Notification service store. You can filter the received events by supplying params object.
  • Arguments:

    • eventId - (string) - event id generated by Alert Notification service and returned upon send

    • params - ConsumerQueryParams - query parameters allowed when requesting Alert Notification service consumer API

  • Return value:

getUndeliveredEvents(params)

  • Description:

    • Get all undelivered events from Alert Notification service store. You can filter the received events by supplying params object.
  • Arguments:

    • params - ConsumerQueryParams - query parameters allowed when requesting Alert Notification service consumer API
  • Return value:

For examples regarding the client, please check Examples section.