# Connect your chat account

> Link your Slack, Discord or Teams account to By Dawn, choose what By Dawn may do as you from chat, and unlink it.

This page shows you how to link your chat account to your By Dawn account. Once it's linked, a button you click or a
command you run in chat acts as you: you can create tickets, comment, move cards and start workers without opening
By Dawn.

You only need this to *act*. Anyone in a bound channel can file a request without linking (see
[Who may do what](https://docs.bydawn.com/chat/#who-may-do-what)).

## Before you start

- An org admin has connected your Slack workspace, Discord server or Microsoft 365 tenant to By Dawn. Settings shows each
  one you can link.
- Link one chat account per By Dawn organization. By Dawn matches you by your chat user id, never by your display name.

## Link from By Dawn

1. Open **Settings › You › Connections**. Each connected workspace, server or tenant you haven't linked shows
   **not linked**.

2. Choose **Link account** next to it. By Dawn sends you to the platform to sign in:
   - **Slack:** Sign in with Slack.
   - **Discord:** Discord asks to share your username (the `identify` permission). You must be a member of the
     connected server.
   - **Microsoft Teams:** you sign in with your work account, which must belong to the connected tenant.

3. Back in By Dawn, **Link your chat account** asks what By Dawn may do as you (see [Scopes](#scopes)). Choose **Link
   account**.

## Link from chat

Run `/saw link` in Slack or Discord, or send **link** to By Dawn in a Teams personal chat. By Dawn answers privately with
**Link my account**. Open it while you're signed in to By Dawn, then confirm the scopes as above.

The link is single-use and expires after 10 minutes, so ask for a new one if it has expired. It links the chat account
to whichever By Dawn member opens it, so don't forward it.

## Scopes

You choose these when you link, and you can change them any time under **What SAW may do as you here**:

| Scope | Lets chat… | Starts |
|---|---|---|
| **Tickets** | create and update tickets, comment, move cards and link threads | on |
| **Workers** | start and stop workers | on |
| **Answers** | approve plans, answer a worker's questions and re-run CI | on |
| **Merge** | approve and merge pull requests, where the project allows merging from chat | off |

A scope never gives you more than your role does. If you can't move a card in By Dawn, you can't move it from chat either.
**Merge** is off until you turn it on, because a merge ships code. Even then it only works where the project allows
it (see [Merging from chat](https://docs.bydawn.com/chat/#merging-from-chat)).

At least one scope stays on. To turn everything off, unlink.

## When By Dawn asks you to link again

You'll see "SAW could not act for you: your Slack link no longer works" (or Discord, or Teams) when By Dawn can't act as
you any more. That happens if you unlinked, an admin removed you from the organization, or your role changed. Choose
**Link my account** to link again. By Dawn never carries the action out some other way, for example with the channel's
authority.

If an org admin has to reconnect the platform, Settings says so on the link: **This workspace needs an org admin to
reconnect it before SAW works there again.**

## Unlink

Choose **Unlink** next to the account in **Settings › You › Connections**. By Dawn revokes what you let it do and
deletes the link at once. In Teams, the help card's **Unlink** button opens the same page.

> **Note:** Your past comments from chat stay on their tickets. Unlinking only stops new actions.

## Chat DMs

Once an account is linked, you can get attention notifications as a direct message: a worker's question, a permission
request, a stalled run, or a finished one. Turn each one on under **Settings › You › Notifications › Chat DMs**. They start
off, and your push and email settings don't change. A DM goes to every chat account you've linked.

## Where to go next

- [Chat command reference](https://docs.bydawn.com/chat-commands/): what you can run once you're linked.
- [Chat integrations](https://docs.bydawn.com/chat/#what-by-dawn-reads-and-keeps): what By Dawn reads and keeps.

Source: https://docs.bydawn.com/chat-accounts/
