# Slack

### Create a Slack app

1. Go to [*https://api.slack.com*](https://api.slack.com)*.*&#x20;
2. Under *Customize your workspace*, click the *Create an app* button
3. Select create *From scratch*
4. Enter a name under *App Name*
5. Select a workspace for developing your app
6. Click *Create App >* This brings up the *Slack api* page for Your Apps with your newly-created app selected in the dropdown of the upper left:

<div align="left"><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2Fo6WRqEoGRv2qr0khIhid%2FSlackAPIAppspage.jpg?alt=media&#x26;token=0fa931d6-f7be-4528-a431-87d9e768bd2f" alt="Slack api page for your apps"></div>

7. Next, define what your bot can access by Click *OAuth & Permissions* under the *Features* in the menu bar&#x20;
8. Scroll to the *Scopes* section and under *Bot Token Scopes* > Click *Add an OAuth Scope* button&#x20;
9. Select the *Chat:write* permissions scope

### Generate Bot user access token

10. Under *Features* in the Slack account menu, select *OAuth & Permissions.*&#x20;
11. Under *OAuth Tokens for Your Workspace***,** click the *Install to Workspace* button&#x20;
12. Click *Allow*&#x20;

{% hint style="info" %}
An OAuth token is automatically generated for your workspace and the value now displays in the Bot User OAuth Token.
{% endhint %}

<div align="left"><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2FpiILANRQrmq75MsKu8st%2FSlackOAuthTokenGenerated.jpg?alt=media&#x26;token=05d69462-0688-4dc5-91ca-97260b355685" alt=""></div>

### **Access Signing secret**&#x20;

13. Under *Settings* in the menu, select *Basic Information* and look under *App Credentials*

{% hint style="info" %}
The *Signing Secret* value is hidden by default. Click *Show* to reveal the value.
{% endhint %}

<div align="left"><figure><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2FpaqqLlzZ5DhT9UKvgSaQ%2FSlackSigningSecret.jpg?alt=media&#x26;token=1b60fbca-98f2-4395-9ff1-829c4fa555e4" alt=""><figcaption><p><em>Slack api</em> page for your app</p></figcaption></figure></div>

### Add channel to app

14. Select *Configuration* tab of your [Core application](https://docs.nlx.ai/platform/nlx-platform-guide/ai-applications/types/core) in your NLX workspace&#x20;
15. Choose *+ Add channel* under *Delivery* section > Choose Slack
16. Enter *Bot user access token* found under the *OAuth & Permissions* page of your Slack app
17. Enter *Signing Secret* found on the *Basic Information* page of your Slack app

> Optional:
>
> * *Language*: Allows you to select the language used for this channel
> * *Token endpoint:* For retrieving a Slack access token for a given Slack conversation
> * *Token endpoint API key:* The API key that protects the Token endpoint

18. Click *Create channel*
19. Click *Save*

{% hint style="success" %}
Before proceeding to Step 5, create a [build and deploy your application](https://docs.nlx.ai/platform/nlx-platform-guide/types/core#deployment).
{% endhint %}

### Add URL to Slack

Once you've set up the Slack channel and deployed your application in NLX, you'll need to provide the URL to your *Slack api.*

20. From the *Configuration* tab of your application, click the *Slack* channel and choose the Setup instructions tab
21. Copy the *Application URL*
22. Go to the *Slack api* page (if you have more than one app in Slack, make sure the correct app is selected in the dropdown on the upper-left of the page)&#x20;
23. Under *Features,* select *Interactivity & Shortcuts* from the menu
24. Set the toggle to enable interactivity&#x20;
25. Paste the *Application URL* into the Request URL field

<div align="left"><figure><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2F8E3qTDdkPCXGV3ZLuZdh%2FSlackPasteBotURLinSlack.jpg?alt=media&#x26;token=b742f45d-7bd9-4093-b6ad-87a811f0b80e" alt=""><figcaption><p>Providing the Bot URL in Slack</p></figcaption></figure></div>

26. Under *Features,* click *Event Subscriptions* from the menu
27. Set the toggle to enable events
28. Paste the *Application URL* into the *Request URL* field

<figure><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2FHYyb7yfN2nIdHQpUjOmX%2FSlackAddDeployURLtoEventSubscriptionsSlack.jpg?alt=media&#x26;token=64e165c2-d4f9-46c1-b44d-fd494b390af3" alt=""><figcaption><p><em>Enable Events</em> in Slack</p></figcaption></figure>

29. Click the down caret to the right of the *Subscribe to bot events* section

<div align="left"><figure><img src="https://2737319166-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FHCxYxhIU0Bqkjj942mGk%2Fuploads%2FEoEa7ek2UVogHO8ajCwX%2FSlackSubscribetoBotEvents.jpg?alt=media&#x26;token=f473274c-c236-45ad-8fcf-9aca1c4041a1" alt=""><figcaption><p>Adding Bot User Events in <em>Slack</em></p></figcaption></figure></div>

30. Click the *Add Bot User Event* button, then select from the list to add the appropriate events
31. When finished, click *Save Changes*
