---
title: Slack
description: How Hindsight uses your Slack account, and how it adds people to Slack channels.
sidebar:
  order: 9
---

Hindsight reads your Slack account and, if the people running the server turn it on, adds you to some Slack channels. It never posts messages. There's no daily digest and no bot chatting in your DMs.

## Where your Slack account comes in

You sign in to Hindsight with Hack Club, and Hack Club hands over your Slack id if your account has one. That's the only link. You don't connect Slack separately.

Hindsight uses the id to look up your Slack display name and picture, through a public Slack profile cache (`cachet.dunkirk.sh`). It does this when your account is made, and it names the account after your Slack display name. After that your name and picture are yours to change. Hindsight remembers a lookup for an hour (ten minutes after a failed one).

To copy them again, open Settings, then Connections. Under **Accounts**, **Slack** has a "Linked" tag and your id. Press **Use Slack name and picture** and your profile matches Slack again. It confirms with "Your name and picture now match Slack." If Slack doesn't answer, it says so and you can try again in a minute.

No Slack on your Hack Club account? The row says "No Slack on your Hack Club account." and there's nothing to copy.

## Slack channels

A Hindsight server can add everyone who signs in to Slack channels automatically, so a program's people end up in the right place. This is a server setting, not something you turn on or off. If you use the hosted Hindsight, you don't set it up. If you [self-host](/docs/developers/self-hosting), here's how it works.

It's off unless you set both of these environment variables. Setting one without the other stops the server from starting.

| Variable | What it holds |
|---|---|
| `SLACK_BOT_TOKEN` | The bot token of your Slack app. It must start with `xoxb-`. |
| `SLACK_CHANNELS` | Channel ids, separated by commas, like `C0123ABCDEF`. Names such as `#hindsight` are refused. |

Find a channel's id at the bottom of its details in Slack. Public channels start with `C`. Older private channels start with `G`.

### Making the Slack app

In Slack, go to `api.slack.com/apps`, choose Create New App, then From a manifest, and use the manifest in the repo at `deploy/slack-app-manifest.yml`. It makes an app called Hindsight with a bot user and three scopes:

- `channels:join`, so the bot can join a public channel itself,
- `channels:write.invites`, to add people to public channels,
- `groups:write.invites`, to add people to private channels the bot is in.

Install it to your workspace and copy the bot token from OAuth & Permissions. For a private channel, add the bot to the channel by hand first, since a bot can't join one.

### What it does

One background task does the work. It runs when someone signs in, and again once an hour in case a round was cut short. Everyone who has a Slack id and hasn't been asked about a channel yet gets one invite per channel. When you turn the bot on, that means everyone already signed up, oldest accounts first. After that it's each new person at their first sign-in.

It goes about 50 invites a minute (one every 1.2 seconds), which is as fast as Slack allows for this call. If Slack asks it to slow down, it waits.

Whatever Slack answers for a person is written down, and Hindsight never asks about that person for that channel again. So if someone leaves a channel, they stay out. People Slack won't take (guests, deactivated accounts, people already in the channel) are marked done and skipped. A person whose Slack id changes is asked again.

If the bot isn't in a channel, it tries to join. When it can't (a private channel), it logs a warning telling you to add it, and tries again next round.
