• Stars
    star
    1,496
  • Rank 31,385 (Top 0.7 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created almost 10 years ago
  • Updated almost 3 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

A tiny web application to invite a user into your slack team.

Slack Invite Automation

Build Status

A tiny web application to invite a user into your Slack team.

Inspired by How I hacked Slack into a community platform with Typeform and Socket.io's Slack page.

This project supports Heroku, Azure, Cloud Foundry, Amazon Web Services (AWS), and ic.dev.

Deploy to Heroku Deploy to Azure

Settings

You can set variables for your own purpose in config.js or environment variables.

config.js

Fill out config.js as your infomation.

  • community: your community or team name to display on join page.
  • slackUrl : your slack team url (ex.: socketio.slack.com)
  • slacktoken : Your access token for Slack. (see Issue token)
  • inviteToken: An optional security measure - if it is set, then that token will be required to get invited.
  • recaptchaSiteKey: An optional security measure - if it is set, and recaptchaSecretKey is set, then a captcha will be required to get invited.
  • recaptchaSecretKey: An optional security measure - if it is set, and recaptchaSiteKey is set, then a captcha will be required to get invited.
  • locale: Application language (currently cs, de, en, es, fr, it, ja, ko, nl, pl, pt, pt-BR, tr, zh-CN and zh-TW available).
  • subpath: Sub-path in URL. For example, if /example is set, it's served in /example, not /. Default is /.

Environment Variables

You can set environment variables directly or in .env file. If you want to use a .env file, create a file in the root called .env with the following key/value pairs. (.env files are added to the .gitignore.)

  • COMMUNITY_NAME : Your community or team name to display on join page.
  • SLACK_URL : Your Slack team url (ex.: socketio.slack.com)
  • SLACK_TOKEN : Your access token for Slack. (see Issue token)
  • INVITE_TOKEN: An optional security measure - if it is set, then that token will be required to get invited.
  • RECAPTCHA_SITE: An optional security measure - used to enable reCAPTCHA.
  • RECAPTCHA_SECRET: An optional security measure - used to enable reCAPTCHA.
  • LOCALE: Application language (currently cs, de, en, es, fr, it, ja, ko, nl, pl, pt, pt-BR, tr, zh-CN and zh-TW available).
  • SUBPATH: Sub-path in URL. For example, if /example is set, it's served in /example, not /. Default is /.

Sample

COMMUNITY_NAME=socketio
SLACK_URL=socketio.slack.com
SLACK_TOKEN=ffsdf-5411524512154-16875416847864648976-45641654654654654-444334f43b34566f
INVITE_TOKEN=abcdefg
LOCALE=en

You can test your token via curl:

 curl -X POST 'https://YOUR-SLACK-TEAM.slack.com/api/users.admin.invite' \
 --data 'email=EMAIL&token=TOKEN&set_active=true' \
 --compressed

Heroku / Azure

Add the application settings that are defined in the environment variables above.

Amazon Web Services (AWS)

If you have an AWS account and have already installed and configured the AWS CLI tool, you can easily deploy this application to API Gateway and Lambda via CloudFormation in a few minutes.

Instead of editing config.js, take these steps:

  1. Copy aws/config.example.sh to aws/config.sh
  2. Edit the values in aws/config.sh, which correspond to the variables described above, plus these:
    • StackName: the name of the CloudFormation stack to create
    • S3BucketArtifacts: the name of an existing S3 bucket you have write access to, for storing deployment artifacts
    • S3PrefixArtifacts: the prefix to use within that S3 bucket for all deployment artifacts written
  3. Run aws/deploy.sh to create the CloudFormation stack and deploy your application, outputting the URL
  4. (Optional) For a friendlier URL, log into the AWS web console and establish a custom domain pointing to the API Gateway stage deployed in step 3.

ic.dev

If you haven't already installed the IC CLI, please refer to the documentation.

Deploy the lsuss.slack_inviter brick directly from the IC Public Index:

$ ic aws up lsuss.slack_inviter slack_inviter --params community_name='Your Community Name',slack_url=yourcommunity.slack.com,slack_token=xoxp-xxx-xxx-xxx-xxx

Retreive the id and url of the API:

$ ic aws value slack_inviter

Run

Node.js is required.

$ git clone https://github.com/outsideris/slack-invite-automation.git
$ cd slack-invite-automation
$ npm install
$ npm start

You can access http://localhost:3000 on your web browser.

Run with Docker

It's easy to run this service if you have installed Docker on your system. Pull the Docker image from Docker Hub.

$ docker pull outsideris/slack-invite-automation
$ docker run -it --rm -e COMMUNITY_NAME="YOUR-TEAM-NAME" -e SLACK_URL="YOUR-TEAM.slack.com" -e SLACK_TOKEN="YOUR-ACCESS-TOKEN" -p 3000:3000 outsideris/slack-invite-automation

Or, You can build a Docker image yourself.

$ git clone https://github.com/outsideris/slack-invite-automation.git
$ cd slack-invite-automation
$ docker build -t outsideris/slack-invite-automation .
$ docker run -it --rm -e COMMUNITY_NAME="YOUR-TEAM-NAME" -e SLACK_URL="YOUR-TEAM.slack.com" -e SLACK_TOKEN="YOUR-ACCESS-TOKEN" -p 3000:3000 outsideris/slack-invite-automation

Issue token

You should generate the token in admin user, not owner. If you generate the token in owner user, a missing_scope error may occur.

There are two ways to issue the access token.

Legacy tokens

  1. Visit https://api.slack.com/custom-integrations/legacy-tokens.

  2. Click Create token.

OAuth tokens

  1. Visit https://api.slack.com/apps and Create New App.

  2. Click "Permissions".

  3. In "OAuth & Permissions" page, select admin scope under "Permission Scopes" menu and save changes.

  4. Click "Install App to Workspace".

  5. Visit https://slack.com/oauth/authorize?&client_id=CLIENT_ID&team=TEAM_ID&install_redirect=install-on-team&scope=admin+client in your browser and authorize your app.

    • This form requires the client permission. Otherwise, you can see {"ok":false,"error":"missing_scope","needed":"client","provided":"admin"} error.
    • Your TEAM_ID is the subdomain for your slack team, e.g. myteam.slack.com - your TEAM_ID is myteam.
    • Your CLIENT_ID found in "Basic Information" section for your App.
    • You will be shown a Installed App Settings > OAuth Tokens for Your Team screen.
    • You can test auto invites with curl by providing the OAuth Access Token.
    curl -X POST 'https://myteam.slack.com/api/users.admin.invite' \
    --data '[email protected]&token=OAuthAccessToken&set_active=true' \
    --compressed

Badge

You can use the badge to show status of user in your slack.

  • With default colors:

    <img src="https://your.domain/badge.svg">
    
  • With custom colors:

    • ?colorA=abcdef Set background of the left part (hex color only)
    • ?colorB=fedcba Set background of the right part (hex color only)
    <img src="https://your.domain/badge.svg?colorA=155799&colorB=159957">
    

reCAPTCHA

Register a new site in Google reCAPTHCA as reCAPTCHA v2 type.

Set "Site key" as recaptchaSiteKey or RECAPTCHA_SITE, and "Secret key" as recaptchaSecretKey or RECAPTCHA_SECRET.

Associate fork with heroku

If you use the "Deploy to Heroku" button and want to modify your App you should fork this project. After forking and making changes you should associate your repo with the deployed instance by running:

$ heroku git:remote -a thawing-inlet-61413 replacing your heroku app's name and running

$ git push heroku master to upload the changes. For full details see Heroku: deploying with git

More Repositories

1

popularconvention

analyzing code convention from github commits for Github data challenge II
CoffeeScript
740
star
2

citizen

A Private Terraform Module/Provider Registry
JavaScript
609
star
3

learning-spring

Learning Spring framework
XSLT
59
star
4

node.js-programming

"Node.js 프로그래밍 : 클라우드 컴퓨팅 시대의 고성능 자바스크립트 플랫폼"의 예제소스
JavaScript
45
star
5

issue-translator-extension

Chrome extension - Translates issues, pull requests and comments on GitHub for non-English-based programmers
JavaScript
43
star
6

headless-chrome-for-lambda

a docker container to compile chrome headless shell for AWS Lambda
Python
19
star
7

request-blog-post

https://blog.outsider.ne.kr 에서 설명해줬으면 하는 주제를 받습니다.
17
star
8

Socket.IO-Slide

Socket.Io Slide for FRENDS, Korea FRont ENd DeveloperS
JavaScript
13
star
9

socket.io-examples

HTML
11
star
10

infrastructure

HCL
11
star
11

potential-conflicts-checker-action

Check if this Pull Request can be conflict after other Pull Requests merged
JavaScript
10
star
12

side-effect-studio

JavaScript
10
star
13

page-back-example

JavaScript
8
star
14

curlybrace

Stackoverflow Homage
Scala
8
star
15

github-page-switcher

chrome extension to show one-touch icon to change github repository and github page.
JavaScript
8
star
16

outsider-gollum

my private wiki
7
star
17

summernote-markdown

experimental markdown editor based on summernote
JavaScript
7
star
18

.vim

my vim setting & dotfiles
Shell
6
star
19

outsideris

5
star
20

presentations

JavaScript
5
star
21

nodejs-ko-bot

tweet nodejs-ko blog posts
JavaScript
5
star
22

terraform-recipes

Terraform recipes by scenarios
HCL
4
star
23

blog-comments

3
star
24

twicussion

Twicussion
JavaScript
3
star
25

involved

App to encourage to contribute to open source project on github
JavaScript
3
star
26

scala-static-server

scala-static-server
Scala
3
star
27

lambdas

my own lambdas
JavaScript
2
star
28

terrace

Web Management UI for terraform
Python
2
star
29

TeslaCamViewer

JavaScript
2
star
30

frodo

wiki based scala and mecurial influenced by gollum
Scala
2
star
31

atom-angularjs

angular.js support in atom editor
CoffeeScript
2
star
32

gittip-links

show gittip link on github and bitbucket
JavaScript
2
star
33

refactoring-2e

1
star
34

cc-assignment

JavaScript
1
star
35

actions-demo-2112

Shell
1
star
36

programming-kubernetes

Go
1
star
37

githug

I juse leave this for back-up (webapp like native app for github)
JavaScript
1
star
38

learn-x

TypeScript
1
star
39

meta-tags-generator

JavaScript
1
star
40

Outsider

1
star
41

review-reminder

JavaScript
1
star
42

cli-example

1
star
43

nodeconf

play.node() - Node.js Korea Conference
JavaScript
1
star
44

retrotech

MDX
1
star
45

blocks-test

TypeScript
1
star
46

codespaces-dotfiles-test

Shell
1
star
47

gh-actions-test-2020

JavaScript
1
star
48

pc2

1
star
49

learn-mocha

JavaScript
1
star
50

actions-test

JavaScript
1
star
51

deploy-test

JavaScript
1
star
52

f8-hackathon

JavaScript
1
star
53

jten

JavaScript
1
star
54

ibm-developer-connect-example

JavaScript
1
star
55

gatsby-starter-netlify-cms

JavaScript
1
star
56

cla-checker

JavaScript
1
star
57

dotfiles

dotfiles for Codespaces
Shell
1
star
58

learn-react

JavaScript
1
star
59

primer-nextjs-navlist

CSS
1
star