Git Product home page Git Product logo

slack-invite-automation's Introduction

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.

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

slack-invite-automation's People

Contributors

adonaldson avatar ahmetsina avatar aquaminer avatar bjorand avatar bogidon avatar camalot avatar chrif avatar dialex avatar frankghb avatar george-carlin avatar honzajavorek avatar hsiliev avatar jnfeinstein avatar josecage avatar jules2689 avatar klaascuvelier avatar lafiosca avatar lion3ls avatar lira92 avatar lookfirst avatar lukaskollmer avatar morenoh149 avatar nicastelo avatar outsideris avatar peterkaminski avatar samueldg avatar shian48263 avatar shwaydogg avatar stevebyerly avatar xtuc avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

slack-invite-automation's Issues

Invitation fails with Failed! missing_scope

I tested the invitation feature with a few different email addresses but none has succeeded.

I get Failed! missing_scope when using this app and the following result if I use curl command provided in the README.md.

{"ok":false,"error":"missing_scope","needed":"admin","provided":"identify,read,post,client"}

I've already checked https://api.slack.com/tokens page and it says that the token has admin scope.

Deploy on Dokku without SSL redirects to https://

I followed all the installation steps from the respository and I am able to run the slack invitation locally.

However, now I want to deploy it to my Dokku platform. I didn't specify a Procfile for Dokku, because I think that the Dockerfile should suffice for the deployment.

When I try to access the page now on my subdomain, http://my-slack-invitation.my-domain.com, I get a redirect to https://.... Obviously I have no SSL certificate in place yet.

Is there something in the application that makes an automatic redirect to https? When I curl the domain, curl http://my-slack-invitation.my-domain.com, I get:

<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

When I curl the https version, I get an error because there is no certificate yet. I planned to use a SSL certificate, but before it should be possible to run it without SSL, shouldn't it? Am I missing something?

Guest invite

Hello, would it be possible to use this app to invite guests?

Background is not full height

Probably only an issue on higher resolutions, but I have a white bar at the bottom because the image height is too low.

Error Code documentation

Is there any documentation on the error codes posted by the app. e.g. scope not defined, Failed not_allowed?

Error with email

I can't manage the app to work, I tried deploying it directly to Heroku but it didn't work.

"Failed! Something has gone wrong. Please contact a system administrator."

Is what I get, I tried then cloning the application directly from Heroku and setting up my configuration in the config.js file, then deployed it again and still didn't work.

What could be causing it?

Thanks!

Failed! missing_scope

Clicked the deploy button and quickly set up config vars on heroku. When I test with account, it gives me a Failed! missing_scope error. This is on newest code.

Deploy to Heroku workers die

I keep having to restart the app as the heroku workers die. Is this a known issue with a fix? This is a stock deploy to heroku instance and just doesn't stay alive

Load Google fonts over https

Necessary to fix this mixed content error:
Mixed Content: The page at 'https://<app-name>.herokuapp.com/invite' was loaded over HTTPS, but requested an insecure stylesheet 'http://fonts.googleapis.com/css?family=Lato:300,400,700,900,700italic|Open+Sans:700italic,400,600,300,700,800'. This request has been blocked; the content must be served over HTTPS.

Heroku Deploy issue

Hi, I want to ask only the paid slack account can use this? Why I keep getting application error?

Setting up API Gateway + Lambda + CloudFormation

Hello,

I am fairly new to the technologies listed in the title of this issue but I have been using AWS for things like S3 and EC2 from some time now. So far I've successfully created an API in API Gateway with the api-swagger-template.json file but have also been going through the process of setting up Lambda and CloudFormation for some time now but keep getting stuck. Would someone be kind enough to provide some sort of walk-through for this purpose. I've tried many others but the purpose of those apps are different which means they're set up differently. The documentation in the repo doesn't go very much in depth on how to deploy the app with AWS.

Are these even necessary fro deploying the app with AWS?

Much appreciated.

Problem with pt-br translation

Hi!
I cloned the repo and was testing it locally but when I set the locale to "pt" it still displays the page in "en".
Maybe I need to set another config?

Invite_Limit_Reached

Hey guys,

I'm having an issue where upon sign up, the API returns an error stating invite_limit_reached. Is this something I need to take up with Slack? Or do you think there's a bug in the code?

I've taken a look around and couldn't see anything obvious...

Slack Invite As a Service

This service is cool!

What would be even cooler is if I as a user won't have to install anything.
Can you make that magic work?

'slack' should be upper-cased

"Enter your email below to join XXX on slack!"

should be

"Enter your email below to join XXX on Slack!

Small, but it's bugging me!

Faild Paid only

It seems that Slack has disabled auto subscribe facility. Every body is getting "Failed, paid only" message when user enter email and press enter

Token?

Is the "token" still called token on Slack? There is nothing called "token" in https://api.slack.com/web#auth. All I can do is register an app and generate api key/secret...with which the app fails with {"ok":false,"error":"invalid_auth"} no matter if the app was registered by owner or by admin user.

Error:Error: getaddrinfo ENOTFOUND https https:443

When deploying on Dokku, I get this error after entering an email address and hitting enter.

Error:Error: getaddrinfo ENOTFOUND https https:443

It's just a white page with black text, the browser location is at /invite.

Would this happen if my token wasn't from an admin account or something?

Vulnerable Node.js

Juste received a mail from Heroku warning the node.js used for the application may be outdated and as such at risk of DoS attacks.
Do we know if the application is up to date?
Thanks in advance!

Invite new users to specific channel automatically

Is there a way to specify a specific channel for new users who are invited through this app? Not as single-channel guests—they can have access to any channel, but I want to make sure that they're a part of a specific one from the start.

How to contribute a new translation?

Thank you for this great app, i really like it. We use it for invites for a small Hungarian tech community channel. It would be nice if there was a Hungarian translation available, which i am happy to contribute, i am just not too familiar with apps like this one, so i would really appreciate a little guidance about how to add new translations.

Thanks,
Adam

Error when deploying lambda AWS with custom domain name.

Followed instructions, set up custom domain name in the API gateway, but when landing on the custom domain I see this error:

Not Found
404
Error: Not Found
    at /var/task/app.js:42:17
    at Layer.handle [as handle_request] (/var/task/node_modules/express/lib/router/layer.js:95:5)
    at trim_prefix (/var/task/node_modules/express/lib/router/index.js:317:13)
    at /var/task/node_modules/express/lib/router/index.js:284:7
    at Function.process_params (/var/task/node_modules/express/lib/router/index.js:335:12)
    at next (/var/task/node_modules/express/lib/router/index.js:275:10)
    at /var/task/node_modules/express/lib/router/index.js:635:15
    at next (/var/task/node_modules/express/lib/router/index.js:260:14)
    at Function.handle (/var/task/node_modules/express/lib/router/index.js:174:3)
    at router (/var/task/node_modules/express/lib/router/index.js:47:12)

What did I do wrong? Thanks!

"client" permission required

So I tried to set this up, but when attempting the curl request, I got the following response:

{ "ok": false, "error": "missing_scope", "needed": "client", "provided": "admin,identify,users.profile:write" }

Apparently slack now requires client permissions? I replaced the token with the token I grabbed by opening the slack app devtools, and it worked fine.

Probably not much you can do about this, but I wanted to give a heads up and ask if maybe you know a nicer way to handle this.

Error with Deploy To Azure

Deployment Error
InvalidRequestContent: The request content was invalid and could not be deserialized: 'Could not find member 'default' on object of type 'TemplateInputParameter'. Path 'properties.template.parameters.siteLocation.default', line 15, position 21.'.

Any idea ?

Azure Deploy issue

Hi, I got issue during deploy via Azure Deploy:
The request content was invalid and could not be deserialized: 'Could not find member 'default' on object of type 'TemplateInputParameter'. Path 'properties.template.parameters.siteLocation.default', line 15, position 21.'.

For your information I used all default values and I added tokens, slack team name.

Typo in repo description

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

Should be changed to user into.

invite email not being sent

Set this up on heroku, everything appears fine; curl test works. It never sends the invite email.

SLACK_TOKEN set
INVITE_TOKEN empty

Nothing of note in the logs.

Is it bot-proof?

We used Slackin for our self-invite system and it got hit by a script bot and mass invited 9k email addresses to our account. There were a lot of angry people on Twitter that day.

Is there anything to throttle/prevent that from happening with this project?

Error entering an email address

After deploying, I get

"Failed! Something has gone wrong. Please contact a system administrator."

I see nothing in our logs

image

Dutch locale

I translated this for you in Dutch ; can you add ?

{
"HEADER": "Voer uw email adres in om deel te nemen aan %s op Slack!",
"ENTER_EMAIL": "Voer uw email adres in",
"ENTER_TOKEN": "Voer het token in dat u kreeg bij uw uitnodiging",
"TITLE": "Neem deel aan de %s gemeenschap op Slack!"
}

Add the options to invite guests in multichannel

Currently:

You can invite an email. You cannot specify its a multi channel guest or single channel guest.

Enhanced functionality:
Can we add functionality to select the type of guest being invited and specify the channels?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.