This is a simple example on how to integrate SAP Cloud ALM with a SLACK channel, to post the SAP Cloud ALM alerting information.
This blog referred following help documentation:
Create a new Slack Channel
Build a new APP for the incoming webhook message.
Create a Destination under the SAP Cloud ALM subaccount
Create a new Webhook in SAP Cloud ALM - External API Management with the BTP destination.
Create a new mapping rule for the Slack integration.
{
"_information": {
"_version": "1",
"_source": "SAP Cloud ALM Event Situation",
"_destination": "Slack",
"_name": "SAP Cloud ALM Event Situations to Slack",
"_comment": "SLACK - Channel #calm(Workplace CALM)"
},
"switches": [
{
"name": "switchPriority",
"cases": [
{
"when": "FATAL",
"then": "Highest"
},
{
"when": "ERROR",
"then": "High"
},
{
"when": "WARNING",
"then": "Low"
},
{
"when": "INFO",
"then": "Lowest"
}
],
"default": "Lowest"
}
],
"structure": {
"request": {
"ok": true,
"username": "<user name>",
"channel": "<channel ID>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*SAP Cloud ALM Event: EVENT-SITUATION.CREATED*"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Subject: #{subject}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Description: rating:#{rating} - priority:${SWITCH(switchPriority,rating)} - serviceType:#{serviceType} - serviceId:#{serviceId} - eventType:#{eventType} - eventName:#{eventName}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "workNotes: #{workNotes}"
}
}
]
},
"response":
{
"chatCreated": true
}
},
"eventTypeMapping": {
"_comment": "Specificeventtypemapping",
"operationMappings": [
{
"eventType": "EVENT-SITUATION.CREATED",
"operation": "POST",
"responseRoot": ""
},
{
"eventType": "EVENT-SITUATION.CLOSED",
"operation": "POST",
"responseRoot": "",
"structure": {
"request": {
"ok": true,
"username": "<user name>",
"channel": "<channel ID>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*SAP Cloud ALM Event: EVENT-SITUATION.CLOSED*"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Subject: #{subject}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Description: rating:#{rating} - priority:${SWITCH(switchPriority,rating)} - serviceType:#{serviceType} - serviceId:#{serviceId} - eventType:#{eventType} - eventName:#{eventName}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "workNotes: #{workNotes}"
}
}
]
},
"response":
{
"chatCreated": true
}
}
},
{
"eventType": "EVENT-SITUATION.UPDATED",
"operation": "POST",
"responseRoot": "",
"structure": {
"request": {
"ok": true,
"username": "<user name>",
"channel": "<channel ID>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*SAP Cloud ALM Event: EVENT-SITUATION.UPDATED*"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Subject: #{subject}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Description: rating:#{rating} - priority:${SWITCH(switchPriority,rating)} - serviceType:#{serviceType} - serviceId:#{serviceId} - eventType:#{eventType} - eventName:#{eventName}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "workNotes: #{workNotes}"
}
}
]
},
"response":
{
"chatCreated": true
}
}
},
{
"eventType": "EVENT-SITUATION.PING",
"operation": "POST",
"responseRoot": "",
"structure": {
"request": {
"ok": true,
"username": "<user name>",
"channel": "<channel ID>",
"blocks": [
{
"type": "section",
"text": {
"type": "mrkdwn",
"text": "*SAP Cloud ALM Event: EVENT-SITUATION.PING*"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Subject: #{subject}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "Description: rating:#{rating} - priority:${SWITCH(switchPriority,rating)} - serviceType:#{serviceType} - serviceId:#{serviceId} - eventType:#{eventType} - eventName:#{eventName}"
}
},
{
"type": "section",
"text": {
"type": "plain_text",
"text": "workNotes: #{workNotes}"
}
}
]
},
"response":
{
"chatCreated": true
}
}
}
]
}
}
Create a new Subscription with the Webhook and Mapping rule created in the above steps.
Testing the Slack integration under any Alert generated in the SAP Cloud ALM Monitoring application
Verify the Console log in the External API Management for troubleshooting
In case there is some error happens, or the notification can't be sent successfully. It is possible to check the console log in the "Console" tab of the "External API Management" application for more details.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
| User | Count |
|---|---|
| 48 | |
| 46 | |
| 27 | |
| 23 | |
| 21 | |
| 16 | |
| 14 | |
| 13 | |
| 12 | |
| 12 |