# Slack: Deploy an Endpoint

**Cognigy Support**  
October 24, 2022

Within our **Cognigy.AI** platform you're able to connect your Cognigy resources to your **Slack Bot** by using our Slack Endpoint integration.

**Inject & Notify**  
You can use the **Inject** and **Notify** functionality with this type of Endpoint. For further details see the [Inject & Notify Documentation](https://docs.cognigy.com/docs/inject-notify) page.

With the implementation of a Slack Endpoint you can easily connect your Slack Bot with Cognigy.AI.

This _How to_ covers the necessary steps for creating and connecting a Slack Endpoint. If you want to get information about assigning a Flow to the Endpoint and setting up the _Data Management_ see [Endpoints.](https://docs.cognigy.com/docs/endpoints)

## Two Step Preparation Process

1. **Configure Your Slack App** for the usage of the Cognigy Endpoint on [Slack API](https://api.slack.com/apps)  
2. **Creation and Configuration of a Slack Endpoint** within Cognigy.AI

## 1 Configure Your Slack App

🔗 On [Slack API](https://api.slack.com/apps)

**Requirements**  
✔ Slack Login  
✔ A Slack Workspace

### 1.1 Create a Slack App

Create a Slack App for your Slack Workspace (see figure 1.1).

_Figure 1.1: Create a Slack App_

### 1.2 Add Permission Scopes

Your bot needs permission to post messages in a chat. For that go to the _OAuth & Permissions_ page of your Slack App. Scroll down to the _Scopes_ section and select the permission **chat:write**, **im:write** and **incoming:webhook** (see figure 1.3).

_Figure 1.3: Adding Permission Scopes_

### 1.4 Get the Verification Token

To successfully connect your Slack App with the Cognigy.AI Endpoint you'll need the **Verification Token** of your Slack App. Go to the _Basic Information_ page of your Slack App and scroll to the _App Credentials_ section. There you have to get the Verification Token (see figure 1.4) and save it (e.g. in a txt-file).

_Figure 1.4: Slack App Credentials_

### 1.5 Get the OAuth Access Token

Go to the _OAuth & Permissions_ page of your Slack App and scroll to the _Tokens for Your Workspace_ section (see figure 1.5). Copy the **Bot User OAuth Access Token** (starts with the characters **xoxb-**) and save it. You can also use the **OAuth Access Token**, but then the bot will only have the same permissions as your user account. You can find more information about the OAuth tokens [here](https://api.slack.com/docs/oauth).

**Missing Token**  
In case you can't find the token: be sure that your Slack app is installed to your workspace. After installing it'll generate the two tokens.

_Figure 1.5: OAuth Access Token_

### 1.6 Enable Interactive Responses for Quick Reply Buttons

In order to make Quick Reply messages work, the following documentation must be followed to enable the functionality: [https://api.slack.com/interactivity/handling#setup](https://api.slack.com/interactivity/handling#setup)

Within this article it talks about the **Request URL**, which is the **Slack Endpoint URL** of the Cognigy.AI Virtual Agent.

Now we are able to set up the **Slack Endpoint** within Cognigy.AI.

## 2 Creation and Configuration of the Slack Endpoint

🔗 On Cognigy.AI

**Requirements**  
✔ OAuth Access Token  
✔ Verify Token

### 2.1 Create a Slack Endpoint

First you have to create a Endpoint of the type _Slack_ (see figure 2.1).

_Figure 2.1: Endpoint Creation Menu_

### 2.2 Configure the Slack Endpoint

Expand the _Slack Setup_ panel (see figure 2.2) and paste the saved tokens (step 1.4 and 1.5) into the corresponding fields.

_Figure 2.2: Enpoint Configuration - Slack Setup_

### 2.3 Get the Endpoint URL

Move to the top of the Endpoint Configuration page and copy the _Endpoint URL_ which is displayed above the _General Settings_ (see figure 2.3).

_Figure 2.3: Endpoint configuration page of a Slack Endpoint_

## Final Step: Connect Your Slack App to the Endpoint

🔗 On [Slack API](https://api.slack.com/apps)

**Requirements**  
✔ Endpoint URL

Go to the settings page of your Slack App and open the _Event Subscription_ page. Paste the copied _Endpoint URL_ (step 2.3) into the **Request URL** field (see figure 2.4). A "verified" message should indicate that the entered URL is valid and that the Endpoint can be reached.

_Figure 2.4: Slack App Event Subscription page_

Now you just need to subscribe to the _Bot Events_ which will trigger the bot. You can subscribe to the **app_mention** and **message.im** events.

You should be all set up to use the Slack Endpoint you've created with a Flow of your choice.
