---
title: Slack actions
source: https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/slack/slack-chat
---

This page provides a reference for all Slack chat actions available in the workflow automation actions catalog. These actions enable Slack messaging operations from your workflows.

## Prerequisites

Before using Slack actions in workflow automation, ensure you have:

-   A Slack workspace with appropriate permissions.
-   A Slack bot token configured as a secret in workflow automation.
-   Access to the Slack channels where you want to send messages.

## Configure Slack integration [#slack-configuration]

This section details the instructions for setting up a Slack application with the minimal scope permissions to allow the workflow automation Slack actions.

### Create a Slack app

1.  Go to the [Slack API](https://api.slack.com/apps) > **Create New App > From Scratch**
2.  Give your app a name and select a workspace, then click **Create App**.
3.  Upon creating, go to **App Home** on the left navigation and ensure your bot is online.

    ![The Slack App Home page with the My Bot online status highlighted.](https://docs.newrelic.com/images/my-bot-always-online.webp "Always show My Bot as Online")

### Configure OAuth permissions

1.  On the left navigation, select **OAuth & Permissions**.

2.  Scroll down to the **Bot Token Scopes** section, and add the following scopes to allow the workflow automation action usages:

    -   `chat:write` - Required to post a message
    -   `reactions:read` - Required to get reaction from a thread
    -   `files:write` - Required to upload a file attachment to a thread

        ![The image of the scope that needs to be added for workflow automation Slack actions.](https://docs.newrelic.com/images/slack-workflow-scopes.webp "Workflow automation Slack scopes")

3.  Scroll back up and click the **Install to [workspace]** button to start the OAuth setup with your Slack workspace.

4.  You should see a confirmation prompt. Click **Allow** to confirm.

5.  Upon success, copy the **Bot token** and keep it for the next step. The token should start with `xoxb-...`.

### Add app to channels

Now that the Slack app is created and configured, add it to the Slack channel(s) you'd like to use by editing that channel's **Integrations** and adding the Slack app to it.

### New Relic configuration

Once you've set up a Slack application and obtained a bot token, store this credential in New Relic secrets management using the GraphQL mutation below:

```graphql
mutation {
  secretsManagementCreateSecret(
    scope: {type: ACCOUNT id: "12345678"}
    namespace: "slack"
    key: "my-app-bot-token"
    description: "A slack token to send messages with newrelic workflow automation"
    value: "xoxb-..."
  ) {
    key
  }
}
```

Configure the following values:

-   `id` - Your New Relic account ID
-   `namespace` - Optional, use any alphanumeric string to categorize your secret
-   `key` - Use an alphanumeric string for referencing this secret
-   `description` - Optional description for the secret
-   `value` - The Slack bot token you copied from the previous step

You can execute this mutation using the [NerdGraph GraphiQL explorer](https://one.newrelic.com/nerdgraph-graphiql) with your New Relic user API key. Once submitted successfully, you should see a result similar to this:

```json
{
  "data": {
    "secretsManagementCreateSecret": {
      "key": "my-app-bot-token"
    }
  }
}
```

### Use the Slack token in workflows

Use the workflow automation feature by leveraging the Slack bot token secret stored with your namespace and key names.

**Example:**

```yaml
name: to-slack

steps:
  - name: postCsv
    type: action
    action: slack.chat.postMessage
    version: 1
    inputs:
      channel: test-channel-workflow
      text: "Hello World!"
      token: ${{ :secrets:slack:my-app-bot-token }}
```

> #### 💡 TIP
>
> If you didn't use a namespace, remove the `:namespace` part from the token input, like this: `${{ :secrets:my-app-bot-token }}`

## Slack actions

| Action identifier         | Description                                                                    | Reference                                                                                                                                      |
| ------------------------- | ------------------------------------------------------------------------------ | ---------------------------------------------------------------------------------------------------------------------------------------------- |
| `slack.chat.postMessage`  | Sends a message to a Slack channel, with an optional file attachment.          | [Post a message](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/slack/slack-chat-post-message)         |
| `slack.chat.getReactions` | Gets emoji reactions on a Slack message, waiting up to a configurable timeout. | [Get message reactions](https://docs.newrelic.com/docs/workflow-automation/setup-and-configure/actions-catalog/slack/slack-chat-get-reactions) |
