I recently stumbled across a tweet by Melvin Davis on Twitter where he mentioned a simple tool that he had created using Go that instantly sends a Slack invite when an email is entered. This allows us to make a public slack community that anyone can join.
Check-out the auto invite sender to join #slack written in #Golang https://t.co/fwcurIsZ3w This tool is extremely helpful when you maintain an community slack channel— Melvin Davis (@melvinodsa) January 2, 2019
You will find joinslack on github here. This will run as a standalone program and all you need to do is configure the parameters and upload the assets and template folders. Parameters can be defined as command line arguments or as I did, a config.json file like this.
{
"Token": "api-token-goes-here",
"Workspace": "gophpgroup",
"WorkspaceName": "GoPHP",
"InviteURL": "shared-invite-url-goes-here"
}
You can find your api token if you are logged in to your workspace by going here. To find your invite link go to the invites page, click on “Invite new members” and at the bottom of that page you should see “Share invite link” which will reveal the link to create new invitations.
Place this config.json in the same directory as the directory you will run joinslack from along with the assets and template folder. When running the program it will default to port 9000 and if you navigate to http://localhost:9000 you should see the slack invite page which will ask for an email.

In order to host this behind a url I used Caddy Server which automatically configures SSL for free via Let’s Encrypt. I used the following caddy configuration which points any request going to slack.gophp.io on https to the local server with the script running on port 9000.
slack.gophp.io {
tls m@rkus.io
proxy / localhost:9000
}
Now you can go to slack.gophp.io in order to join the GoPHP Slack community! I use supervisord to keep joinslack running at all times even if the server restarts. I will try to cover setting up Caddy on a server in a future post.
I hope you found this post useful, please leave a comment if you have any questions or would just like to leave some feedback!