# Slack Integration

Avantra integrates with Slack in the same way that Avantra can integrate with any 3rd party system that offers a web API such as "REST" or "SOAP". In this case, for Slack, you can integrate using "REST" and add it as an Output Channel within your Notification set up.

The example shown here is designed to alert to a Slack channel when a new SAP Security Note has been impacted (or SAP HotNews) and it impacts on of the systems in your landscape:

## Slack Webhook

In order to be able to send data from Avantra to Slack you will need something known as a "Webhook". This is simply a URL provided to you from Slack that allows messages to be sent from Avantra into a specific channel within your Slack instance. Rather that try to detail these steps here you can simply follow Slack’s own documentation on how to create a webhook link here.

Once you have your webhook URL it should look like this:

    https://hooks.slack.com/services/T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX

## Create your Slack output channel

Within Avantra you can now create an output channel specifically for your Slack channel by following the procedure to Define a REST Output Channel and use the HTTP method "POST" within the set up. The example below shows how you could use this to send SAP Security Note and SAP HotNews alerts to Slack when a system is affected. Your Notification Action should be of the type "Action for SAP HotNews Events" and be set to trigger on "systems affected by SAP HotNews"

| You can use the Slack Block-kit builder (for designing or changing the code below).

    {
      "blocks": [
        {
          "type": "header",
          "text": {
            "type": "plain_text",
            "text": "HotNews Impact Alert",
            "emoji": true
          }
        },
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "*${system.name} (${sapSystem.realSapSid}) is affected by new HotNews*"
          }
        },
        {
          "type": "section",
          "text": {
            "type": "mrkdwn",
            "text": "*Customer*: ${customer.name}\n*SAP Note*: ${message.sapNote.noteId?c} \n ${message.sapNote.description}"
          },
          "accessory": {
            "type": "image",
            "image_url": "https://www.avantra.com/hubfs/Customer_Office_Linked_Assets/Ticket_Alert.png",
            "alt_text": "Alert"
          }
        },
        {
          "type": "divider"
        },
        {
          "type": "section",
          "fields": [
            {
              "type": "mrkdwn",
              "text": "*Priority:* ${sapNote.priority}"
            },
            {
              "type": "mrkdwn",
              "text": "*Release Date:* ${sapNote.releaseDate}"
            },
            {
              "type": "mrkdwn",
              "text": "*Category:* ${sapNote.category}"
            },
            {
              "type": "mrkdwn",
              "text": "*Version:* ${sapNote.noteVers}"
            },
            {
              "type": "mrkdwn",
              "text": "*Component(s):*\n ${sapNote.component}"
            }
          ]
        },
        {
          "type": "divider"
        }
      ]
    }