Recently I’ve created one team in Slack. It’s basically an effort to communicate with all, who wants to communicate with me. In one way it’s an AMA from me. I don’t know if someone wants to contact with me or not. But at-least I should keep some channels open to connect.
I really appreciate this AMA initiative by Sindre Sorhus. And I think that everyone should keep open some channel to contact. Not email. Because email lacks the visibility for everyone. Email is good for one-to-one communication. But forum conversations are generally meant for publicly visible. Conversations as GitHub’s issue-comment presentation is a overkill, if not a little awkward. So, I was searching for an alternative to start my AMA. I like the UI of the currently popular traditional forum softwares, like vBulletin, phpBB and many others. But main problem with them is, I’ve to host them personally and hosting a public facing forum needs a lot of time and experience, which I don’t have. There are also some choices for free forum hosting. But, they gives annoying ads all over the pages and have some irrational constraints like limit on users (how can, or why should I put restrictions on user registrations, after all it’s purpose is to communicate with all. I’m not saying my forum is going to be that big. But at-least I should have no such limitations.), limit on posts (this is another disturbing limitation) etc.
Slack has become popular for quite some time. And I really like the UI and it’s made for conversation. But one problem with the Slack teams, is joining of new members is depended upon invitation. It’s a little obstacle. Though this can be overcome if we can automate the sending of invitations. And fortunately there are some opensource projects, already solved the problem. One of the projects of this sort is Slackin.
Slackin is a really simple web app with NodeJs backend. It’s simple to host and modify. But it needs one backend. Can’t be hosted with GitHub pages. There are a few free options like heroku, openshift to host a NodeJs application. Heroku does not accept custom domains with free plan. So, my obvious choice is always Openshift in such cases. Openshift’s previous version was more generous towards the free plan. There was no mandatory sleep time, like with the new version (Openshift’s version 3 requires at-least 18 hours of sleep time in a contiguous span of 72 hours). I’ve an account with the previous version. So, I could configure Slackin with one gear (in-simple-words containers are termed as gear in Openshift’s terminogy).
I’ve modified Slackin a little. In original software there is no check for spam. Though it does not matter if invitations are generated with automated scripts, as all the requests will be submitted to Slack. But, it’s better to have means to prevent spams in all publicly accessible websites. I have also checked that, Slack server is not testing the requested emails for invitation. Invitation requests to Slack’s API with email adddresses like, `firstname.lastname@example.org` is returning success. So, it’s needed to employ a captcha at-least to prevent spams upto some level.
I’ve used Google Recaptcha. It’s simple to integrate to websites and innovative. Really. You should try this. If havn’t already.
Slackin’s guide to host with Openshift didn’t work for me. So, I modified the Slackin code to incorporate recaptcha and used different template to deploy the app to Openshift.
Let’s dive into the details of deploying Slackin with Openshift. I’m writing this conforming to my modifications of the original app. But this guide should work with the original app and different enviroment than Openshift also.
First let’s create one recaptcha token for our site. Go to Recaptcha site. Click on “Get Recaptcha“ and login with the desired Google login. Register a new site to the bottom of the page. Choose “Recaptcha V2”. Give the domain or subdomain name. By giving the domain name, all the subdomains to that domain are also authorised to use the same token. We’ve to use this feature wisely. And we’ve to include
localhost, to test the recaptcha during development.
Next, we’ve to create one Slack team, where we will invite everyone to join. And create API token to authorize our app to Slack servers. So, head over to Slack website and click on
Once the procedure of creating team and validation of email is complete, login to the Slack account and head over to create new token here.
So, the tokens we’ll use, Slack team calls legacy token, as they have introduced OAUTH app style authorization with
client secret and
client id. Legacy Token is fine. There are nothing wrong with it. Let’s work with it for now. Later I’ll try to modify this app to work with the new authorization.
Now, let’s clone the repo in your workstation. And install NPM packages and run the application to test.
If NodeJs is not installed in the workstation it can be downloaded from here and installed.
git clone https://github.com/arnabdas/slackin.git
Test whether the recaptcha widget is loaded properly, once the captcha is confirmed and invitation is requested with valid email id, invitation link is received by the provided email id or not. Once it’s configured properly, it’s time to deploy the application to Openshift.
For Openshift install
rhc by following this. Invoke
rhc setup to login to Openshift from console and configure the workstation to work with Openshift API.
# create slacin application in Openshift cloud
It should go fine and the app should be available at the intended url. And we’ve got our own forum. Cheers. Happy coding. :)