# Slack bot (coming soon)

> Coming soon: how to start Cloud runs from Slack by mentioning the screw-bugs bot with a site or a pull request.

Source: https://docs.screwbugs.dev/bots/slack

## Testing from Slack (Coming soon)

Mention `@screw-bugs` with a site or a pull request, and it runs a [Cloud run](/cloud/cloud-runs.md) and answers in the thread.

> **Note: Waiting for Slack's approval**
>
> The app works, and is waiting for Slack Marketplace review. Until Slack approves it, only
>   UXstudio's workspace can install it.

## Connect Slack first

Runs are your screw-bugs Cloud account's, so link Slack to it once.

1. Sign in to `screwbugs.dev` with GitHub.
2. On **Account** (`/account`), click **Connect Slack** and sign in with Slack.

Emails are never matched. If you haven't connected, the bot replies with a link to do it.

## Ask for a run

```text
@screw-bugs https://arlo.app check the signup flow
@screw-bugs uxstudioteam/arlo#236
```

| You give                            | It does                                                                                |
| ----------------------------------- | -------------------------------------------------------------------------------------- |
| A site (with or without `https://`) | Tests that site                                                                        |
| A PR (a link or `owner/repo#123`)   | Tests the PR's preview and plans from its change, as a [PR comment](/bots/github.md) does |
| `--url https://…`                   | With a PR: test that address instead of the preview found                              |
| `--account trial-user`              | Test signed in as that one of your [test accounts](/cloud/test-accounts.md)               |
| Anything else                       | The instructions                                                                       |

- **In a thread**, a bare `@screw-bugs` tests what the thread is about: the one PR, or else the one site, earlier messages name.
- **In a DM**, skip the mention.
- When it can't tell what to test, it asks, listing the options. Answer with a number, an address or a PR (mentioning the bot in a channel).

## In the thread

1. 👀 on your message.
2. A status message, updated in place, with a **Stop** link.
3. Its questions, if any (which address, or a [sign-in](/cloud/test-accounts.md#sign-in-requests-during-a-run) only you can open).
4. When it ends, a reply that mentions you: the summary, the top findings, the tests under a **Show tests** button, and the report link.
5. ✅ when every case passed, ❌ otherwise, in place of 👀.

## More commands

| Message                          | What it does                                                     |
| -------------------------------- | ---------------------------------------------------------------- |
| `@screw-bugs rerun` (or `retry`) | In a run's thread: run it again; words after it add instructions |
| `@screw-bugs help`               | Show the help                                                    |
| `/screw-bugs help`               | Show the help, only to you. The slash command never starts runs  |

## Who can run what

- You must have connected Slack and be a full member of the workspace (not a guest).
- **A PR:** you must see the repository on GitHub, and it must have the [GitHub App](/bots/github.md). The run uses the repository's preview headers only if you can push to it.
- **A site that is one of a repository's PR previews:** when you can push to that repository, the run is the repository's, with its preview headers.
- **Any other site:** tested by itself, with nothing of a repository's. Only you (or an admin) can answer its questions or stop it.
- Every run signs in only with **your own** test accounts, and counts against your [cap](/cloud/cloud-runs.md#cost).

## How it works

- Slack sends mentions and DMs to `/api/slack/events`. Cloud checks Slack's signature first, answers at once, and works after the answer.
- Each message is acted on once; Slack's retries and edits are ignored.
- The bot reads a thread only when it is mentioned there and the message names nothing.
- A PR runs exactly as from a PR comment, and has one run at a time from either place.

Setup and details: `docs/slack.md` (Cloud).

**Next:** [Decisions](/decisions.md)