Skip to content
Browse files
Add Slackin.
  • Loading branch information
mwbrooks committed Jun 11, 2015
1 parent ffcb1ce commit 37d596fcdba627c7a43e3ae5dd5138aa9c2c799b
Showing 28 changed files with 3,153 additions and 47 deletions.
@@ -1,2 +1,3 @@
# OS X
@@ -0,0 +1,15 @@
FROM octohost/nodejs


ADD . /srv/www

WORKDIR /srv/www

RUN npm install

RUN make


@@ -0,0 +1,97 @@

0.5.0 / 2015-05-07

* allow for multiple guest channels [afeld]
* add important notes to README
* better error handling and tests [afeld]
* add Slack favicon and better title [frabrunelle]
* error when the token account is not an admin [martypenner]
* added Dockerfile [darron]

0.4.0 / 2015-04-10

* use SVG Heroku button
* fixed svg dimensions issues
* exclude bots (and slackbot) from users count
* improve mobile zoom
* use `<input type="email">`
* fix for single-channel guests invitation parameter name

0.3.1 / 2015-03-16

* fix meta tags for mobile support

0.3.0 / 2015-03-06

* update `babel`, fix all scenarios

0.2.9 / 2015-03-03

* package: bump ``

0.2.8 / 2015-02-03

* bump

0.2.7 / 2015-02-02

* support for custom css

0.2.6 / 2015-02-01

* fix issue with 6to5 and `-g install`

0.2.5 / 2015-02-01

* fix single channel invites to be ultra restricted

0.2.4 / 2015-02-01

* bump 6to5

0.2.3 / 2015-02-01

* fixed heroku button

0.2.2 / 2015-01-30

* fixed ability to `require('slackin')`

0.2.1 / 2015-01-30

* improved startup speed by leveraging pre-compilation

0.2.0 / 2015-01-30

* improved CLI interface [buildkite]
* support for ENV vars [buildkite]
* deploy to heroku button [buildkite]

0.1.2 / 2015-01-28

* fix bin name [brianloweswords]

0.1.1 / 2015-01-26

* fix typo

0.1.0 / 2015-01-26

* initial release
@@ -0,0 +1,13 @@

BABEL = ./node_modules/.bin/babel

all: node

node: lib
@mkdir -p node/assets/
@rm -rf node/assets/*
@cp -r lib/assets node/
@for path in lib/*.js; do \
file=`basename $$path`; \
$(BABEL) "lib/$$file" > "node/$$file"; \
@@ -0,0 +1 @@
web: make && bin/slackin --channels "$SLACK_CHANNELS" --port $PORT $SLACK_SUBDOMAIN $SLACK_API_TOKEN
147 100644 → 100755
@@ -1,63 +1,116 @@
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file except in compliance
# with the License. You may obtain a copy of the License at
# Unless required by applicable law or agreed to in writing,
# software distributed under the License is distributed on an
# KIND, either express or implied. See the License for the
# specific language governing permissions and limitations
# under the License.

# Cordova Labs
# slackin

> Caution: Safety Goggles are Recommended!
A little server that enables public access
to a Slack server. Like Freenode, but on Slack.

## Purpose
It provides

The purpose of this repo is for experimental code. Examples include demo apps,
native api explorations, or anything really that does not fit in an existing Cordova platform.
- A landing page you can point users to fill in their
emails and receive an invite (``)
- An `<iframe>` badge to embed on any website
that shows connected users in *realtime* with
- A SVG badge that works well from static mediums
(like GitHub README pages)

## Project Organization
Read more about the [motivations and history]( behind Slackin.

> Everyone works on a branch
## How to use

`master` branch should *never* have content.
### Server

Each project should create a separate branch to work on. There are major benefits
to this practice:

- Each project has an isolate git history, which allows for easy migration to
a new git repository;
- Working directory is not polluted with the files of other projects.
- Projects will not step on each others toes.
Or install it and launch it on your server:

## Migrating Repositories
$ npm install -g slackin
$ slackin "your-slack-subdomain" "your-slack-token"

One day, you labs project may grow up and need it's own repository.
You can easily move all of your Git history to your new repository with the
following steps:
You can find your API token at []( – note that the user you use to generate the token must be an admin. You may want to create a dedicated `@slackin-inviter` user (or similar) for this.

# cd to labs and checkout your project's branch
git checkout my-branch
The available options are:

# add your new repository as a remote
git add remote my-remote <url>
Usage: slackin [options] <slack-subdomain> <api-token>
# currently, my-remote should be empty (no commits)
# push my-branch to my-remote's master branch
git push my-remote my-branch:master
-h, --help output usage information
-V, --version output the version number
-p, --port <port> Port to listen on [$PORT or 3000]
-c, --channels [<chan>] One or more comma-separated channel names to allow single-channel guests [$SLACK_CHANNELS]
-i, --interval <int> How frequently (ms) to poll Slack [$SLACK_INTERVAL or 1000]
-s, --silent Do not print out warns or errors

# now clone your new project (my-remote)
git clone <url>
**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).**

### Realtime Badge


<script async defer src=""></script>

or for the large version, append `?large`:

<script async defer src=""></script>

### SVG


<img src="">

### Landing page


Point to ``.

**Note:** the image for the logo of the landing page
is retrieved from the Slack API. If your organization
doesn't have one configured, it won't be shown.

## API

Requiring `slackin` as a module will return
a `Function` that creates a `HTTP.Server` instance
that you can manipulate.

token: 'yourtoken', // required
interval: 1000,
org: 'your-slack-subdomain', // required
channels: 'channel,channel,...' // for single channel mode
silent: false // suppresses warnings

This will show response times from Slack and how many
online users you have on the console.

By default logging is enabled.

## Credits

- The SVG badge generation was taken from the
excellent [shields]( project.
- The button CSS is based on

## License

@@ -0,0 +1,21 @@
"name": "Slackin",
"description": "Let people invite themselves to your Slack",
"logo": "",
"repository": "",
"keywords": ["node", "slack"],
"env": {
"description": "Your Slack's subdomain (**this**",
"required": true
"description": "A Slack API token (find it on",
"required": true
"description": "Name of a single guest channel to invite them to (leave blank for a normal, all-channel invite). In order to make this work, you have to have a paid account. You'll only be able to invite as many people as your number of paying members times 5.",
"required": false
@@ -0,0 +1,34 @@
#!/usr/bin/env node

var pkg = require('../package');
var program = require('commander');
var slackin = require('../node');

.usage('[options] <slack-subdomain> <api-token>')
.option('-p, --port <port>', 'Port to listen on [$PORT or 3000]', process.env.PORT || 3000)
.option('-c, --channels [<chan>]', 'One or more comma-separated channel names to allow single-channel guests [$SLACK_CHANNELS]', process.env.SLACK_CHANNELS)
.option('-c, --channel <chan>', 'Single channel guest invite (deprecated) [$SLACK_CHANNEL]', process.env.SLACK_CHANNEL)
.option('-i, --interval <int>', 'How frequently (ms) to poll Slack [$SLACK_INTERVAL or 1000]', process.env.SLACK_INTERVAL || 1000)
.option('-s, --silent', 'Do not print out warns or errors')
.option('-c, --css <file>', 'Full URL to a custom CSS file to use on the main page')

if (program.args.length != 2) {;
} else { = program.args[0];
program.token = program.args[1];

// support deprecated option
if (!program.channels && {
program.channels =;

var port = program.port;
slackin(program).listen(port, function(err){
if (err) throw err;
if (!program.silent) console.log('%s – listening on *:%d', new Date, port);

0 comments on commit 37d596f

Please sign in to comment.