# Connect Slack

At the end, Slack is connected to your team's runner, your teammates are matched to their Slack accounts, and every task said in Slack has a spending limit.

## At a glance

**Time:** 10 minutes. An owner or admin of your Loopgate org who is also a Slack admin does it, in the runner's **Settings → Slack**.

**You need:**

- The runner, with your engines signed in and a workspace added: [Engines, GitHub and a repository](sign-in.md)
- A Slack admin

## Steps

1. **Open the runner, then Settings → Slack.**

2. **Press Create the app in Slack**, signed in to Slack as an admin. Pick your workspace, **Next**, then **Create**.

3. **Make the app-level token:** **Basic Information → App-Level Tokens → Generate Token and Scopes**. Name it `loopgate`, add the scope `connections:write`, press **Generate**, and copy the token. It starts `xapp-`.

4. **Make the bot token:** **Install App → Install to Workspace**, allow it, and copy the **Bot User OAuth Token**. It starts `xoxb-`.

5. **Paste both tokens on the page and press Save tokens.**

   You should see: `Tokens set · <your Slack workspace>`. A wrong token is named in red instead.

6. **Check the members.** Each member of your org is matched to the Slack person with the same email. Pick a person for anyone left unmatched.

7. **Choose the workspace tasks work in, and the most one task may spend** in dollars and hours. Every task started from Slack stops there.

8. **Press Connect.**

   You should see: `Connected to <your Slack workspace>` within seconds, or an error saying what to fix.

9. **Try it:** in Slack, type `/loopgate Say hello in a new file HELLO.md` in a channel Loopgate is in.

   You should see: a thread with one card of what will run. The rest is [From Slack](slack.md).

## Good to know

- The app runs on your box and connects out to Slack, so Slack needs no way in. The tokens stay on the box.
- The worker reads the page's settings every few seconds, so a change on the page needs no restart.
- The app's own messages, on the box in the `loopgate` folder:

  ```sh
  docker compose logs slack
  ```

- When Settings → Slack says the app needs new abilities: paste **Copy manifest** into the app's **App Manifest** in Slack, save, **Install App → Reinstall**, and paste the new bot token on the page.
- To set Slack from a file instead of the page, see [By hand](by-hand.md); the file wins over the page.

## If something is off

- **A token is named in red.** Make that one again in the Slack app's pages, step 3 or 4, and paste it once more.
- **Slack says "Ask your Loopgate admin to map your Slack ID …"** Pick that person on their row in Settings → Slack, or press **Match again** after they join your org.
- **Connected, but nothing answers in Slack.** Read `docker compose logs slack` on the box; it names what Slack refused.

## Next

- [From Slack](slack.md)
- [A permanent address with Cloudflare Tunnel](address-cloudflare.md)
