Fun, anonymous chats with random members of your Slack!
Whirl comprises of four components:
- The web server for receiving and responding to event payloads from Slack
- A MongoDB database to save chat metadata (e.g., start time, message count, participants, etc.) after a chat has ended
- A Redis cache for storing references to the users who should receive messages from a chat while it is ongoing
- The Slack app itself
Here are all the variables you need to set up on the server, with hints.
# Port to run the server on
PORT=3000
DATABASE_URL=mongodb://…
REDIS_URL=redis://…
# App config. Obtained from the "Basic Information" page of your app.
SLACK_CLIENT_ID=…
SLACK_CLIENT_SECRET=…
SLACK_SIGNING_SECRET=…
# Can be anything you want it to be.
SLACK_STATE_SECRET=…
# A chat must have at least this many messages for its metadata to be saved.
CHAT_METADATA_THRESHOLD=3
This section is only relevent to you if you’ve decided to run Whirl on a platform other than Heroku.
git clone https://github.com/ifvictr/whirl
cd whirl
# Install dependencies
yarn
# Start Whirl in production! This will build the source files and then run them.
yarn start
# Or, if you need to run it in development mode instead.
yarn dev
For Whirl to work, you’ll need to register a Slack app with the appropriate OAuth permissions, event subscriptions, and commands.
For Whirl to work, you’ll need to enable both the Home and Messages tabs of the app.
For the Request URL under the Interactivity section, enter http://<YOUR DOMAIN HERE>/slack/events
. This will be used for the app’s buttons.
The following commands are needed. Enter the same request URL you used in the previous section.
/end
: Ends the current chat/next
: Go to the next chat
Install the Slack app to your development Slack workspace first.
The following bot token scopes are required:
chat:write
: Used for sending messages.chat:write.customize
: Used for sending messages to the receiving side of a chat with the sender’s pseudonym.commands
: Used for/end
and/next
.im:history
: Used for reading the messages a user sends in a DM with Whirl. If they’re in a chat, Whirl will send it to the other users with a pseudonym.reactions:read
: Used for notifying users that reactions aren’t currently supported 😞reactions:write
: Used for chat read receipts.
Subscribe to the following bot events:
app_home_opened
message.im
reaction_added
The request URL is also the same here.
After you’ve followed all the above steps, you should see something like this in the console:
Starting Whirl…
Listening on port 3000