Skip to content

CivicTechTO/civictechto-slack-invite

 
 

Repository files navigation

About this Fork

The purpose of this fork is to add documentation for how to deploy CivicTechTO's instance of this app.

Features

  • A landing page you can point users to fill in their emails and receive an invite (https://slack.yourdomain.com)
  • An <iframe> badge to embed on any website that shows connected users in realtime with socket.io.
  • A SVG badge that works well from static mediums (like GitHub README pages)
  • Abuse prevention via Google reCAPTCHA

Check out the Demo or read more about the motivations and history behind Slackin.

Usage

Set up Now on your device and run this command. Now will automatically ask you for the required information and then spin up a deployment instantly. That easy!

now rauchg/slackin

Other platforms:

Tips

Your team id is what you use to access your login page on Slack (eg: https://{this}.slack.com).

You can find or generate your API test token at api.slack.com/web – note that the user you use to generate the token must be an admin. You need to create a dedicated @slackin-inviter user (or similar), mark that user an admin, and use a test token from that dedicated admin user. Note that test tokens have actual permissions so you do not need to create an OAuth 2 app. Also check out the Slack docs on generating a test token.

Important: If you use Slackin in single-channel mode, you'll only be able to invite as many external accounts as paying members you have times 5. If you are not getting invite emails, this might be the reason. Workaround: sign up for a free org, and set up Slackin to point to it (all channels will be visible).

Here is where to generate a secret and sitekey for Google reCAPTCHA.

Badges

Realtime (demo)

<script async defer src="https://slack.yourdomain.com/slackin.js"></script>
<!-- append "?" to the URL for the large version -->

SVG (demo)

<img src="https://slack.yourdomain.com/badge.svg">

API

Loading slackin will return a Function that creates a HTTP.Server instance:

const slackin = require('slackin')

slackin.default({
  token: 'yourtoken',                             // required
  interval: 1000,
  org: 'your-slack-subdomain',                    // required
  path: '/some/path/you/host/slackin/under/',     // defaults to '/'
  channels: 'channel,channel,...',                // for single channel mode
  silent: false                                   // suppresses warnings
}).listen(3000)

This will show response times from Slack and how many online users you have on the console. The returned http.Server has an app property that is the express application that you can define or override routes on.

All the metadata for your organization can be fetched via a JSON HTTP request to /data.

CivicTechTO Deployment

We use Heroku to host our app: https://civictechto-slack-invite.herokuapp.com/

  1. Get access to the Heroku app. See the "Heroku" entry in the CivicTechTO Services Inventory to figure out who to ask. Anyone with current access can give you your own access.

  2. Make the change on the develop/civictechto branch of this code repository. Pull requests are preferred, so that someone else can review the change.

  3. Once your change is committed to the develop/civictechto branch, you can push to Heroku via Git, from your local workstation:

     git remote add heroku https://git.heroku.com/civictechto-slack-invite.git
     git push heroku develop/civictechto:master
    
  4. You should see the deploy process from the command-line, and when it's done, your change will be live!

Caught a Bug?

  1. Fork this repository to your own GitHub account and then clone it to your local device
  2. Uninstall slackin if it's already installed: npm uninstall -g slack
  3. Link it to the global module directory: npm link
  4. Transpile the source code and watch for changes: npm start

Yey! Now can use the slack command everywhere.

About

CivicTechTO fork of Slackin, a small app for public Slack invites.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages

  • JavaScript 91.7%
  • Shell 4.8%
  • CSS 3.5%