/serverless-slack-invite

A serverless service providing badge and invitation gateway for public Slack channels

Primary LanguageJavaScriptApache License 2.0Apache-2.0

serverless-slack-invite

Builds Slack workspace Maturity badge - level 2

A serverless service providing badge and invitation gateway for public Slack channels. You'll be able to bring this up on AWS in minutes.

Installation on Lambda

Step 1: Generate AWS access and secret key by creating a user in AWS IAM with AdministratorAccess permission.

Step 2: Generate a Slack token using this page.

Step 3: Set following ENV variables:

  • AWS_ACCESS_KEY_ID: Your AWS access key generated in Step 1
  • AWS_SECRET_ACCESS_KEY: Your AWS secret access key generated in Step 1
  • SLACK_API_TOKEN: The slack API token generated in Step 2
  • SLACK_SUBDOMAIN: Your slack subdomain for your workspace https://<your-subdomain>.slack.com

Step 4: Run following commands:

yarn install
yarn build
serverless deploy

You should be able to pass the ENV variables like this:

AWS_ACCESS_KEY_ID="abc" AWS_SECRET_ACCESS_KEY="abc" SLACK_API_TOKEN="abc" SLACK_SUBDOMAIN="your-subdomain" serverless deploy

It should give you a link to the service!

Running as standalone Webserver

Step 1: Set following ENV variables:

export SLACK_API_TOKEN='abc'
export SLACK_SUBDOMAIN='your-subdomain'

Step 2: Install, build and start:

yarn install
yarn build
yarn start

Endpoints

GET /badge.svg

Displays an SVG badge with the number of online users and total users in Slack.

You can embed this badge in your Github repo using following snippet:

[![Slack](https://slackinvite.dev.tophat.com/badge.svg)](https://opensource.tophat.com/#join-slack)

Slack


POST /invite

By posting email to this endpoint, a Slack invitation will be sent from the user who generated the Slack API token.

This enpoint will return 400 if the email is not valid or user is already invited with following JSON as response:

{"success": false, "message": "Error Message" }

GET /stats

Returns number of active and total members on Slack in following format:

{"success": true, "stats": {"total": 39, "active": 25}}

Contributors

Thanks goes to these wonderful people (emoji key):


Siavash Bidgoly

💻 📖 🚇

Jake Bolam

📖 🚇

Credits

Thanks to Carol Skelly for donating the github organization!