/SlackEngine

Easy to use Slack Inviter running on Google App Engine

Primary LanguagePHPApache License 2.0Apache-2.0

SlackEngine

Enable public access to your Slack server!

This is a (partial) clone of slackin for Google App Engine.

It provides

  • A landing page you can point users to fill in their emails and receive an invite
  • A free SSL-secured endpoint at https://<your-project>.appspot.com!

Why Google App Engine?

Most Slack inviters require you to run a server 24/7 to work. However, most users will visit the app once and never come back to it!

With App Engine, you can run your Slack inviter with the App Engine free tier and never worry about it again! If your community starts to receive a lot of traffic, App Engine will automatically scale to handle the load as well.

Slackin is my favorite Slack inviter, but won't run on App Engine without using the Flexible environment. So SlackEngine was born!

How to use

Setup

  • Install the App Engine SDK for PHP if you don't have it.
  • Visit the Google Developers Console, and create a new project.
  • Visit reCAPTCHA, and register your website.
  • Install reCAPTCHA library with Composer
    • run composer install
  • Rename constants.php.example to constants.php
    • Run: mv constants.php.example constants.php
  • Edit constants.php
    • Replace <YOUR-SUBDOMAIN> with your team's Slack subdomain, e.g., if your Slack is myteam.slack.com, your subdomain is myteam
    • Replace <YOUR-API-TOKEN> with your Slack API token
      • You can find your API token at https://api.slack.com/custom-integrations/legacy-tokens
      • Note that the user you use to generate the token must be an admin.
      • You should create a dedicated @slackin-inviter user (or similar), mark that user an admin, and use a token from that dedicated admin user.
      • Replace <YOUR-reCAPTCHA-SECRET> with your reCAPTCHA secret
      • Replace <YOUR-reCAPTCHA-SITEKEY> with your reCAPTCHA site key
      • Replace <YOUR-NOTE> with a small note you want to display
      • Optional Performance Improvements
        • By default, $GETINFO is set to 'true', so SlackEngine will query the Slack API to get the following values. However, this can impact performance once your community goes above 5000 users, causing App Engine to run out of memory and crash.
        • There are two choices to fix this:
          • Set $GETINFO to 'false' and define the following constants:
            • Replace <<YOUR-COMMUNITY-IMAGE> with the URL of a square image representing your community.
            • Replace <<YOUR-COMMUNITY-NAME> with the name of your community.
            • Replace <<YOUR-COMMUNITY-USERCOUNT>> with the approximate number of users in your community.
          • Edit app.yaml
            • Upgrade the instance_class from F1 to F2, F4, or F4_1G.
            • Note: This will stop App Engine from crashing, but will increase costs (only F1 instances are eligible for the free tier). It also won't fully solve the performance issues. The first method will be much faster and cheaper.
  • Launch your app:
    • Run gcloud init to select your project
    • Run gcloud app deploy to deploy to App Engine

Credits

  • The look and feel is heavily inspired by slackin
  • The decision to use PHP was inspired by this gist

License

Licensed under Apache 2.0, see LICENSE for details.

Disclaimer

This is not an official Google product.