This project is a Grails application to moderate and approve users before they can join your Slack community. When a user requests to join Slack, a message is posted into a private Slack channel with two buttons to approve or reject the request. If approved the application sends an Slack invitation email to the user to join in.

inviter

Configuration

Slack configuration

  • Create a new private channel in Slack. This channel will be used to receive the requests from the users. Take a look at the channel id in your browser URL because you will need this later.

slack new channel
slack create app
  • Configure the permissions. Click on Interactive Components, enable the option and set the Request URL to the domain in which you plan to deploy the Grails application. Keep in mind that the url needs to finish with api/slack. Slack will send a POST request to this URL when you click on the Approve or Reject buttons on the user request.

slack configure app
slack set callback url
  • Select Basic Information on the left menu and scroll down to App Credentials. Copy the Verification Token because you will need this later to verify that the callbacks to the Grails application are from Slack.

slack app credentials
  • Select OAuth & Permissions on the left menu and add the scope Send messages as user. This permission is necessary to send the message with the user information to the channel.

slack scope permission
  • Create a Legacy Token for sending the invites to the users after they have been approved. It is recommended to use another new user for this instead of using your own user.

slack legacy token
  • Finall go back to OAuth & Permissions and click on Install App to Workspace.

slack install app to workspace
  • Once you install your app you will see an OAuth Access Token for your workspace.

slack oauth token

Deploy the app

In order to deploy the app.

Assemble:

./gradlew :app:assemble

Run it:

java -jar -DSLACK_CHANNEL=XXXX -DSLACK_LEGACY_TOKEN=XXXX -DSLACK_OAUTH_TOKEN=XXXX -DPRODUCTION_URL=https://yourserver.com -DSLACK_VERIFICATION_TOKEN=XXXX app/build/libs/app-0.1.war

Please note SLACK_CHANNEL, SLACK_LEGACY_TOKEN, SLACK_OAUTH_TOKEN, SLACK_VERIFICATION_TOKEN are the values extracted in the previous section of the documentation. PRODUCTION_URL is the server url where you deploy the app.

Picture Usage Rights

The picture used in the home screen is licensed under CC0 Creative Commons, Free for commercial use No attribution required.