Technology Blogs by SAP
Learn how to extend and personalize SAP applications. Follow the SAP technology blog for insights into SAP BTP, ABAP, SAP Analytics Cloud, SAP HANA, and more.
cancel
Showing results for 
Search instead for 
Did you mean: 
milenamarinova
Participant
For the sake of readability, we often use SAP BTP as a short form of the complete “SAP Business Technology Platform” name and Alert Notification as a short form of the complete “SAP Alert Notification service for SAP BTP” name.

Introduction


Have you ever considered the usage of cloud-based SMS mobile messaging service for important events, affecting your resources?  Actually, this could be a timely and cost efficiently communication channel for you. In this article you are going to learn how SAP Alert Notification for SAP BTP can be integrated with such a service. For ensuring a better understanding of the concept, the presented configurations are in the context of a concrete SMS platform service - Sinch. Regardless of the example, the approach will be similar with various cloud-based messaging services. Give it a try!

How it works? By leveraging the SMS platform service's API, the SMS delivery of each important event can be configured as one of the communication channels (referred as actions) in Alert Notification. Furthermore, by defining an event's payload template, the message is customized to your needs. In addition, Alert Notification takes care to deliver only events, matching explicit policies predefined by you. No message flooding!

For utilizing this integration, the required resources are:

  • Active Alert Notification service instance either in SAP BTP Cloud Foundry or Neo environment. If you haven’t configured one yet, check the following links – Initial Setup for SAP BTP Neo and Initial Setup for Cloud Foundry to do so

  • Active account in an SMS platform service provider. For this demo, we have an account in Sinch, but you can use any SMS service provider exposing API


 

Configurations in Alert Notification


In this case, the service is enabled for SAP BTP Cloud Foundry account. I would like to receive any events related to my business-critical application called "demoapp-sap". For all changes in the status (start, stop, update, etc.), I will be notified via SMS sent to my mobile phone. Check the full list of application events for SAP BTP Cloud Foundry here.

Let's create a subscription and define matching conditions.


If you want to narrow the scope of the incoming alerts, just add more specific matching conditions. For more details how to manage subscriptions in Alert Notification, check the official documentation.

Let's create a new action for our subscription.  We are going to use Webhook action type.

Note: In the demonstrated scenario, Sinch SMS API requires authorization token. Therefore, the selected type of Webhook action is "Webhook with Authorization Token". Check what are the requirements for your SMS service provider's API and select the correct option. For more details about the Webhook actions in Alert Notification, refer to this link.


As a prerequisite for the integration with Alert Notification, we need to provide some details derived from our account in Sinch. Find the list below:

  1. Check Sinch SMS API specification

  2. Get your service plan ID. Navigate to your dashboard -> section SMS ->  APIs

  3. While in the same location, obtain REST messaging API token

  4. Make sure you have a verified number, validated for your account. Navigate to your dashboard -> Numbers -> Verified numbers

  5. Get a virtual number to enable two-way communication. Navigate to your dashboard -> Numbers -> Get virtual numbers. If you already have one, check its value in Numbers -> Your virtual numbers


Having the values from the steps above, provide the following details:

Note: Once provided, the Authorization token is stored securely in Alert Notification. You need to provide its value again, only in case the URL destination address is changed.

  • In Payload Template's field enter a template to customize the payload sent to the Webhook. You may enter a free text that includes parameter placeholders which are dynamically replaced with the value of the corresponding event property at runtime


One example would be:
	{ 
"body": "{subject}",
"from": "<VIRTUAL_NUMBER>",
"to": [
"<VERIFIED_NUMBER>"
]
}

Note: Do not forget to replace the placeholders "<>" in all fields with your values.



Note: Check the maximum number of characters for a single message, allowed by the SMS platform service of your choice. Exceeding this limit is potential reason for not receiving text messages sent by Alert Notification. For Sinch, try with this link.

The last step is to add the new action to your subscription.

When changes in the application status occur, the condition for our subscription is matched and Alert Notification sends event to Sinch. In a second, Sinch delivers SMS notification to the configured mobile number.


This is how leveraging the integration between Alert Notification and Sinch can ensure prompt and convenient SMS notification for all important events within your landscape. Don't forget to check the REST API specification for your favorite SMS platform provider, configure Alert Notification as per your needs and never miss an alert.