Overview
Table of contents
- What is SAP Alert Notification service for SAP BTP?
- Features
- Installation
- Usage
- Resources
- Alert Notification service Client API
- Constructor
- Methods
- create(type, data)
- update(type, data)
- get(type, name)
- getAll(type, params?)
- delete(type, name)
- importConfiguration(data)
- exportConfiguration()
- sendEvent(event)
- sendEvents(events)
- getMatchedEvent(eventId, params)
- getMatchedEvents(params)
- getUndeliveredEvent(eventId, params)
- 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
- Configuration management by using the SAP Business Technology Platform cockpit
- Credential management
- Catalog of available events
- Integration with Alert Notification service
- Undelivered event troubleshooting
- SAP API Business Hub related 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)
-
Description:
- Creates a single entity, which is of given type, with the given data .
-
Arguments:
-
type - EntityType (string) - type of the entity to be created
-
data - Action | Condition | Subscription - data of the entity to be created
-
-
Return value:
- Promise<Action | Condition | Subscription>
update(type, data)
-
Description:
- Updates the single entity, which is of the given type, with the given data.
-
Arguments:
-
type - EntityType (string) - type of the entity to be updated
-
data - Action | Condition | Subscription - data of the entity to be updated
-
-
Return value:
- Promise<Action | Condition | Subscription>
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:
- Promise<Action | Condition | Subscription>
getAll(type, params?)
-
Description:
- Get all entities of the given type, params argument provides you the ability to change the pagination settings.
-
Arguments:
-
type - EntityType (string) - type of the searched entity
-
params? - CommonQueryParams - query parameters
-
-
Return value:
- Promise<PageResponse<Action | Condition | Subscription»
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.
- Imports a configuration.
-
Arguments:
- data - Configuration - configuration to be imported
-
Return value:
- Promise<Configuration>
exportConfiguration()
-
Description:
- Exports your current configuration.
-
Arguments:
-
Return value:
- Promise<Configuration>
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:
- Promise<ResourceEvent>
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.
- Will send multiple events at once for ingestion to Alert Notification service.
-
Arguments:
- events - ResourceEvent[] - a collection of events to be sent to Alert Notification service
-
Return value:
- Promise<ResourceEvent[]>
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:
- Promise<ConsumerPagedResponse[]>
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:
- Promise<ConsumerPagedResponse[]>
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:
- Promise<ConsumerPagedResponse[]>
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:
- Promise<ConsumerPagedResponse[]>
For examples regarding the client, please check Examples section.