# Connect Slack

At the end, your team says a task in Slack, and the thread shows what will run and how it goes.

## 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**.

**What you need:**

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

**Steps:**

1. Create the Slack app
2. Paste two tokens
3. Check the matches, pick the workspace, Connect
4. Say a task

The app runs on your box beside the runner and connects out to Slack, so Slack needs no way in. The tokens stay on the box.

## 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, press **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 of your org's members 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 a few seconds. An error says what to fix.

9. **In Slack, say a task**, such as "Fix the typo on the pricing page", one of three ways:
   - open Loopgate's **Home** and press **New task** (or **Give a task** beside an agent or a workflow), pick who works it, the workspace and where the thread goes (your Loopgate messages, unless you pick a channel), then press **Open thread** on the answer;
   - type `/loopgate Fix the typo on the pricing page` in a channel Loopgate is in;
   - write to `@Loopgate` in a channel, or in its **Messages** tab.

   You should see: a thread with one card: who works it, your task in your words, the workspace, each step's engine, the access and the most it may spend, with **Start**, **Customize** and **Change…**.

   > **Customize** sets each step's model, thinking and instructions for this run, and the run's access: Full access, shown as ⚠, unless you lower it to Workspace or Read only. **Change…** reopens the form to change who works it, the task or the workspace. Every change is listed on the card before Start.

10. **Press Start.**

    You should see: the same card turn into the progress card, one line per step with its state and time, and the cost so far.

## Check

The card updates in place, and the thread gains a post only for a step's reply, a question for you, a stop or the finish: the final reply, what it cost, **Open pull request** and **Open in workbench**. No task opens a pull request on its own; that button is yours.

In the thread you approve, choose or check a document with buttons (a document shows its first 2,800 characters), answer a free-text question with your next reply, talk to the step at work (start with `@<step>` to pick one; ✅ marks a delivered reply), **Stop**, and **Retry** a failed step. Only the person who started a thread is heard in it. Several questions at once, a whole document, raising the spending limit after a stop and retrying with changed settings open in the workbench, where a link with no sign-in yet offers **Sign in** through the portal. Home lists what needs you and your tasks, each linking its thread.

The app's own messages:

```sh
docker compose logs slack
```

> **Already set up?** When Settings → Slack says the app needs its new abilities: in Slack open the app's settings, **App Manifest**, paste the manifest from **Copy manifest**, save, **Install App → Reinstall**, then paste the new bot token on the page.

## Next

For links that survive a restart, [a permanent address](address-cloudflare.md). Later, [Update, back up, fix](care.md).

## If something is off

- **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.
- **Slack says "This button has expired."** The task moved on, or the person was unmapped. Use the newest post in the thread.
- **A link from an older thread does not open.** The temporary address changed at a restart; open the task from the portal's **Devices → Open**, or give the runner [a permanent address](address-cloudflare.md).

## Doing it by hand

[By hand](by-hand.md) sets Slack from `slack.env`, which wins over the page.
