> ## Documentation Index
> Fetch the complete documentation index at: https://docs.germainux.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Slack

> GermainUX alerts can automatically be posted to Slack channels, allowing teams to receive and respond to critical events in real time.

Components
[`Engine`](https://docs.germainux.com/main/germain-ux-engine)

Availability
2020.2 or later

> **[Integration Overview](#integration-overview)**
>
> Post alerts to channels

> **[Create a Slack App](#create-a-slack-app)**
>
> Bot token and OAuth scopes

> **[Example Slack API Request](#example-slack-api-request)**
>
> Sample message posting call

> **[Recommended Practices](#recommended-practices)**
>
> Avoid duplicate high-priority posts

## Overview

GermainUX alerts can automatically be posted to Slack channels, allowing teams to receive and respond to critical events in real time.

Messages can be triggered by:

* SLA conditions
* Scheduled executions
* Other GermainUX automation events

## Integration Overview

GermainUX integrates with Slack through **HTTP Actions** and the Slack Web API. When a configured condition occurs, GermainUX calls Slack’s `chat.postMessage` method to publish a message to the selected channel.

![Example of Slack Integration for GermainUX](https://mintcdn.com/germain-ux/uY3MrHiwPZBkcqjb/images/main/slack/image-20230531-140402.png?fit=max\&auto=format\&n=uY3MrHiwPZBkcqjb\&q=85\&s=395bdef471151750fc1f852ee7b1d33d)

## Create a Slack App

If you do not already have a Slack app:

1. Create an app in your Slack workspace.
2. Add the required OAuth scopes.
3. Install or reinstall the app in the workspace.
4. Copy the generated bot token.
5. Identify the ID of the destination channel.

   ![Minimum permissions required by Slack App to post messages to channel](https://mintcdn.com/germain-ux/uY3MrHiwPZBkcqjb/images/main/slack/image-20230530-131729.png?fit=max\&auto=format\&n=uY3MrHiwPZBkcqjb\&q=85\&s=1c73531a966b6a15b3b03246829ef5d7)

The Slack app requires the `chat:write` scope to publish messages. Add `chat:write.public` only if the app must post to public channels of which it is not a member. If the channel ID must be retrieved programmatically, the app may also require `channels:read`. See Slack’s [message-sending guide](https://docs.slack.dev/messaging/sending-and-scheduling-messages/) and `chat:write.public`[documentation](https://docs.slack.dev/reference/scopes/chat.write.public/).

## Example Slack API Request

The following request posts a message to a Slack channel:

```text theme={null}
curl "https://slack.com/api/chat.postMessage" \
  --request POST \
  --header "Accept: application/json" \
  --header "Content-Type: application/json" \
  --header "Authorization: Bearer xoxb-your-token" \
  --data '{
    "channel": "YOUR_CHANNEL_ID",
    "text": "GermainUX detected CPU utilization of 91%, which exceeds the expected threshold."
  }'
```

Store the Slack bot token in a secure GermainUX credential configuration. Do not include a production token directly in the HTTP Action.

## Automatically Post GermainUX Alerts to Slack

Go to **GermainUX Workspace --> Left Menu --> Settings → Automation -> HTTP**.

This screen displays the available HTTP Actions and identifies those associated with SLAs. Select an existing action to edit it, or click **+** to open the **HTTP Action** wizard.

### 1 Step 1: Configure the Action

Enter:

| Field | Value |
| - | - |
| **Name** | `Slack Message Creation - CPU Alert` |
| **Execution Count** | `1` |

Click **Next**.

![First page of creation wizard of a new HTTP Action showing the required fields](https://mintcdn.com/germain-ux/uY3MrHiwPZBkcqjb/images/main/slack/image-20230530-133234.png?fit=max\&auto=format\&n=uY3MrHiwPZBkcqjb\&q=85\&s=f574b1288687b60ad66d6f2af1d65487)

### 2 Step 2: Configure the HTTP Request

| Field | Value |
| - | - |
| **Path** | `https://slack.com/api/chat.postMessage` |
| **Request Method** | `POST` |
| **Content Type** | `application/json` |
| **Expected HTTP Response** | `200` |
| **Authorization Header** | `Bearer <SLACK_BOT_TOKEN->` |

Use the following request body:

```json theme={null}
{
  "channel": "YOUR_CHANNEL_ID",
  "text": "GermainUX detected that ${context.kpi.name}, with a value of ${context.displayValue}, exceeded its configured SLA threshold."
}
```

A successful Slack API response contains `"ok": true`. Because Slack can return an HTTP success status with `"ok": false` in the response body, validate the `ok` property whenever the GermainUX HTTP Action configuration supports response-content validation. See the `chat.postMessage`[API documentation](https://docs.slack.dev/reference/methods/chat.postMessage/).

![Second page of creation wizard of a new HTTP Action showing the required fields](https://mintcdn.com/germain-ux/uY3MrHiwPZBkcqjb/images/main/slack/image-20230530-134838.png?fit=max\&auto=format\&n=uY3MrHiwPZBkcqjb\&q=85\&s=4d1c3994b34e872972d6e55a02df1444)

### 3 Step 3: Select the Trigger

Select the **CPU Usage SLA** that should trigger the Slack message.

When the SLA is breached, GermainUX will post the configured message to the selected Slack channel.

Click **Finish** to save the configuration.

## Recommended Practices

* Use a dedicated Slack app with only the required OAuth scopes.
* Store the bot token securely and never expose it in documentation or logs.
* Use a channel ID rather than a channel name.
* Apply an execution limit or quiet period to avoid duplicate messages.
* Include the affected system, KPI, current value, threshold, and Analysis Dashboard link.
* Test the integration in a dedicated Slack channel before enabling it in production.

## Get Help

> **[Contact GermainUX Support](https://docs.germainux.com/main/support.md)**
>
> The Germain Team can help you set this up.

> **Can't find what you need?**
>
> Search all GermainUX docs with **Ctrl + K**, or use the feedback buttons at the bottom of this page to tell us what is missing.

The content of this document is proprietary to GERMAIN SOFTWARE.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.