How to Create a Slack Chat Community with Auto-invites

Slack

UPDATE: New Public/Shared Slack Invite Links — The solution below that I’ve written might be obsolete very soon. Slack has no doubt taken notice how many communities (not just company teams) are utilizing Slack. They haven’t given in completely yet, but it’s just a matter of time.

They’re currently testing a new Shared Invite Link feature, which can be set for up to 30 days (they’ll eventually allow an infinite option I’m sure). Anyways, the feature hasn’t yet been officially released yet, but you can email support@slack.com and request it for your Slack Team.

From Slack Support:

“If you’re interested, please let us know the following:

  1. Your team’s URL (i.e., teamname.slack.com)
  2. How many days you want the link to be valid (up to 30 days total)
  3. The maximum number of signups you want this link to allow (up to 1000 new signups)

Once we have this information, we’ll generate a shared invite link and send it to you.”

While this means you’ll have to renew once a month (at least for now), it’ll certainly be a much easier and clean way to essentially get the same effect we’re now jumping through tons of hoops to rig up, which ends up being buggy and semi-reliable anyways. With this option, you can place a simple and elegant button on your site:

Join Our Slack Community


What Gmail did for email, Slack has done for chat. Basically an overnight success, Slack has quickly become the most popular way for teams to organize and communicate. However, Slack’s usefulness has far transcended that initial intended use for the tool. Slack is now considered the most popular and useful all-around tool for chatting as a whole, regardless of purpose.

Besides private team discussions, Slack has now become a very popular tool for public community discussions, with endless possibilities. Since this is not the primary focus of Slack, until features are added to better accommodate this type of use (which considering how smart the folks at Slack are, can be considered inevitable), we have to come up with workarounds and hacks to allow people to join our Slack groups more quickly and easily, as manually requiring members to request access and then manually approving them one by one, is simply not practical.

While not everyone will consider the following method ideal, it is certainly the easiest free option:

Step 1.

Of course, start by creating a new Slack team if you haven’t already. Depending on whether you want it to be easily discoverable or not, you can create it with an obfuscated, randomly generated slug like jAy8prUz or if it’s meant to be friendly and easy to remember, something simple like your organization’s name abcmoving.

Step 2.

Being logged into your Slack team, go to: https://api.slack.com/web, click “Create token”, and copy it down to Notepad or TextEdit for use in a later step.

Step 3.

Go to: https://github.com/rauchg/slackin (update: people are reporting to have more success with the https://github.com/Wiredcraft/slackin fork) and click on the purple “Deploy to Heroku” button, which will prompt you to create a free Heroku account.

Step 4.

After creating, confirming, and logging into your Heroku account, you should now see the final form for creating and deploying your Slack app. Simply add your Slack slug that you assigned in step 1, your API token that you copied down from step 2, and click “Deploy for Free”. Your app is now live at: https://yourslug.herokuapp.com/. You can share this link on your website or over social media to invite people to join, hassle-free.

That’s it; you’re done.

If you need a branded solution without users needing to leave your website, continue to the next steps…

Step 5. (Optional)

Create a new page: yourwebsite.com/chat (or whatever you like) and add the following code (making sure to change the app slug to your own):

<style>#slack-signup-wrapper{position:relative;width:100%;height:300px;overflow:hidden}#slack-signup{position:absolute;top:-175px;left:0;width:100%;height:500px;margin:0;padding:0;border:0}@media all and (max-width:380px){#slack-signup-wrapper{height:250px}#slack-signup{left:-20px;top:-150px;width:120%}}</style>
<div id="slack-signup-wrapper"><iframe src="https://yourslug.herokuapp.com/" id="slack-signup" scrolling="no"></iframe></div>

Recommended: Not all members will be aware that their email address is viewable my all other members. At some point, Slack will likely add a privacy feature to disable this, but until then, it’s a good idea to inform people of this in advance.

Update: As predicted, Slack has now added a privacy feature to hide member email addresses. Be sure to go to https://yourslug.slack.com/admin/settings and uncheck the “Email Display” option. Then, you won’t need to display a courtesy warning to members.

If your Slack community is intended to be free and open to the public, you’re done.

If you intend for the community to be private, continue to the final step…

Step 6. (Optional)

You’ll want to noindex and nofollow the page:

<meta name="robots" content="noindex, nofollow" />

If you’re using WordPress, you can accomplish this with this plugin.

If access to your Slack community is part of a paid subscription, you can completely hide the page altogether only allowing access after payment, registration, and log in, or simply redirect to a hidden URL from PayPal or Stripe after successful payment.

Conclusion

Naturally, every scenario will probably be unique, so I’ll be available to help in the comments below, but this should be a great start to get you on track.

  • Yeah, you should be good:

    You can find or generate your API test token at api.slack.com/web – note that the user you use to generate the token must be an admin. You need to create a dedicated @slackin-inviter user (or similar), mark that user an admin, and use a test token from that dedicated admin user. Note that test tokens have actual permissions so you do not need to create an OAuth 2 app. Also check out the Slack docs on generating a test token.

  • Terris Linenbach
  • Amin Lakhani

    Awesome guide, thanks so much. FYI the page to get your token has been updated to https://api.slack.com/custom-integrations/legacy-tokens

  • Greencat53

    you’re my hero! – had the same issue, but putting in my team subdomain correctly fixed it for me too!

  • AB

    I am looking to do this with a Javascript front end, and eventually hopes to pull data fromthe site to a SQL DB. Will using heroku allow me to eventually do this, and to also build a front end using jQuery?

  • No idea. Try: support@heroku.com.

  • AB

    Iused the original repo and got an error, then did the fork and redownloading slacking in a new direction and am getting this error
    /usr/local/lib/node_modules/slackin/lib/index.js:6
    import express from ‘express’;
    ^^^^^^
    SyntaxError: Unexpected token import
    at createScript (vm.js:53:10)
    at Object.runInThisContext (vm.js:95:10)
    at Module._compile (module.js:543:28)
    at Object.Module._extensions..js (module.js:580:10)
    at Object.loader (/usr/local/lib/node_modules/slackin/node_modules/6to5/lib/6to5/register.js:48:16)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.require (module.js:498:17)
    at require (internal/module.js:20:19)
    Aarons-MacBook:newslack AaronBell$

  • AB

    I’m getting error on both repos =/

  • I might have some good news for you. Let me update the article…

  • Major update at the top of the article. All the pain and grief to get auto-invites working might be a thing of the past very soon.