Skip to content

ifvictr/whirl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whirl

Whirl

Fun, anonymous chats with random members of your Slack!

Add to Slack

Whirl home tab Example chat

Deploy

Deploy

Setup

Whirl comprises of four components:

  1. The web server for receiving and responding to event payloads from Slack
  2. A MongoDB database to save chat metadata (e.g., start time, message count, participants, etc.) after a chat has ended
  3. A Redis cache for storing references to the users who should receive messages from a chat while it is ongoing
  4. The Slack app itself

Environment variables

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

Starting the server

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

Creating the Slack app

For Whirl to work, you’ll need to register a Slack app with the appropriate OAuth permissions, event subscriptions, and commands.

App Home

For Whirl to work, you’ll need to enable both the Home and Messages tabs of the app.

Interactivity & Shortcuts

For the Request URL under the Interactivity section, enter http://<YOUR DOMAIN HERE>/slack/events. This will be used for the app’s buttons.

Slash Commands

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

OAuth & Permissions

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.

Event Subscriptions

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

License

MIT License

About

🌀 Fun, anonymous chats with random members of your Slack

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published