# Slack (Custom App)

### Creating Your Own Slack App

If you prefer not to use OAuth2, you can connect via a custom Slack App using a **Bot Token** and a **Channel ID**. [Go here](https://docs.stackai.com/getting-started/tutorials-and-examples/slackbot-guide) for an interactive guide to this process.

⚠️ **Important:** Each action or trigger in Slack requires specific permissions. When connecting via API tokens, you are responsible for configuring the right scopes in your Slack App. Missing permissions may prevent certain actions, triggers, or even configuration selectors from working as expected.\
For this reason, we **recommend using the OAuth2 connection** whenever possible, as it comes pre-configured with all the necessary permissions and ensures full functionality.

**Step 1: Create a Slack App**\
Go to [Slack API: Your Apps ](https://api.slack.com/apps)and create a new app in your workspace.

{% @arcade/embed flowId="nmk8EChKMTJyKIb4YS7b" url="<https://app.arcade.software/share/nmk8EChKMTJyKIb4YS7b>" %}

**Step 2: Configure OAuth & Permissions (add all the ones they need!)**\
Under **OAuth & Permissions**, add the following scopes to your Bot Token:

```
app_mentions:read
assistant:write
bookmarks:read
bookmarks:write
calls:read
calls:write
canvases:read
canvases:write
channels:read
channels:write.invites
channels:write.topic
channels:join
channels:manage
channels:history
conversations.connect:write
conversations.connect:manage
conversations.connect:read
chat:write
chat:write.customize
chat:write.public
commands
dnd:read
emoji:read
files:read
files:write
groups:read
groups:history
groups:write
groups:write.topic
groups:write.invites
im:read
im:history
im:write
im:write.topic
incoming-webhook
lists:read
lists:write
links:read
links:write
links.embed:write
metadata.message:read
mpim:read
mpim:history
mpim:write
mpim:write.topic
pins:read
pins:write
reactions:read
reactions:write
reminders:read
reminders:write
remote_files:read
remote_files:write
remote_files:share
team:read
team.billing:read
team.preferences:read
triggers:read
triggers:write
usergroups:read
usergroups:write
users:read
users:read.email
users:write
users.profile:read
workflow.steps:execute
workflows.templates:read
workflows.templates:write
```

Under the **User Token Scopes**:

```
search:read
```

Once added, install (or reinstall) the app in your workspace to apply these permissions.

{% @arcade/embed flowId="FbawAiaShtEeEEGXeHXO" url="<https://app.arcade.software/share/FbawAiaShtEeEEGXeHXO>" %}

**Step 3: Include the URL for Interactivity:**

Some actions, like Send & Wait for Response, require to include the url `https://stack-us-east-1.onrender.com/workflow/v1/resume` in the Interactivity & Shortcuts to work out. If you do not include that url, you will not be able to resume workflows using that particular action.

So now, it is time to include the URL. For that, enable Interactivity and include the URL, as follows:

{% @arcade/embed flowId="gpRLQdaIbKF2tEF8aGr8" url="<https://app.arcade.software/share/gpRLQdaIbKF2tEF8aGr8>" %}

**Step 4: Add the Integration to a Channel**

Once the app is installed in your workspace, you need to invite it to the channel where it should operate.

1. Open Slack and go to the target channel.
2. In the message box, type:

   ```
   /invite @YourAppName
   ```
3. Hit **Enter**. The bot is now a member of the channel and will be able to read/write messages according to the permissions you configured.

**Step 5: Retrieve Your Bot Token**\
Copy the **Bot User OAuth Token** (starts with `xoxb-`). This token uniquely identifies your bot when making requests. Here more information on how to get it: [Official guide](https://api.slack.com/tutorials/tracks/getting-a-token).

You can also copy the User Token, highly recommended if you want to perform Search Messages.

**Step 6: Find Your Channel ID**\
Locate the ID of the Slack channel you want to connect.  Here more information on how to get it: [Guide to finding Channel IDs](https://help.socialintents.com/article/148-how-to-find-your-slack-team-id-and-slack-channel-id)

**Step 7: Configure the Connection in StackAI**\
Enter the **Bot Token** and **Channel ID** in the connection form. Optionally, you can also provide a **User Token** (starts with `xoxp-`) for user-level search operations.

Once saved, the connection will be validated and ready for use in actions and triggers.
