An Amazon Lambda (serverless) Slack Team invitation service.
First, clone this repository!
Then:
- Get an Amazon Web Services account
- Get a Slack team account & an authentication token
- The 'jq' command line tool
- The 'aws-cli' command line tool
- run
utils.sh -d <slack-team> -t <slack-test-token> channels
- run
./deploy.sh -d <slack-team> -t <slack-test-token> create
You must have an AWS account.
The aws-cli
and jq
tools are used by the deploy.sh
script.
Install the 'aws-cli' command line tool. Install 'jq' for the appropriate operating system.
- In a web browser, go to api.slack.com/docs/oauth-test-tokens.
- Scroll to the bottom of the page.
- Find the team and username for which you'd like to create a token, and click the 'Create token' button.
The provided utils.sh
script has a channels
command.
./utils.sh -d <slack-team-subdomain> -t <slack-test-token> channels
You will see some output, like:
######################################################################## 100.0%
{
"name": "general",
"id": "C0AA00AAA"
}
{
"name": "random",
"id": "C0AA00AAA"
}
You can test that the Slack token and the channel ids are working correctly, by running the utils
script, and inviting a user by their email address to your team. The channel ids can be passed as well, if you have a paid team and wish to customise the list of channels beyond the default set in Slack.
For free teams:
./utils.sh -d <slack-team-subdomain> -t <slack-test-token> invite <you@yourdomain.com>
For paid teams:
./utils.sh -d <slack-team-subdomain> -t <slack-test-token> invite <you@yourdomain.com> C0AA00AAA,C0AA00AAA
./deploy.sh -d <slack-team-subdomain> -t <slack-test-token> -o http://www.myhost.com/ create
or, if you prefer to set the Slack values as environment variables:
export SLACK_DOMAIN=<slack-team-subdomain>
export SLACK_TOKEN=<slack-test-token>
./deploy.sh create
When create
has completed, the output will give an AWS ARN for the CloudFormation Stack and the URL for the API Gateway HTTP. It will look something like this (NB these are not 'real' values):
{
"id": "arn:aws:cloudformation:us-west-2:111111111111:stack/slackinviter/1a1a1a1a-1a1a-1a1a-1a1a-1a1a1a1a1a1a",
"url": "https://1a1a1a1a1a.execute-api.us-west-2.amazonaws.com/prod/invite"
}
The url
value is used in the next section.
If you have cloned this repository in GitHub, you can publish the docs
directory as a GitHub docs site.
You must edit the index.html file.
You must set the LAMDBA_URL
parameter.
You may set the SLACK_CHANNEL_IDS
if you want to customise the channels the user will be added to when they register.
<script type="text/javascript">
// ------------------------------------------------
// THESE VALUES MUST BE CUSTOMISED
var SLACK_TEAM_URL = "https://...";
var AWS_LAMDBA_URL = "https://...";
var SLACK_CHANNEL_IDS = "";
//
// ------------------------------------------------
</script>