Invented by the founders of Trello, Glitch is said to be the friendly community where you can build a web app of your dreams. It holds out the promise of revolution in the way we develop software. The idea behind it is to give developers a hospitable and free environment to code, create apps, remix and modify them without a bulk of unnecessary coding tools that raise barriers to your creativity. With Glitch developers can create apps with ease and instantly deploy them. The platform is fairly new, with not so many users who have tested it so far, so we decided to give it a go and see how it delivers on its promises.
What I like the most about creating applications is coding their actual logic. Setting up development environment, configuring the server - it’s neither easy nor pleasant, especially if you are new to technology. It can quickly become frustrating - I just want to write an app and not spend hours on server configuration. Glitch.com comes to the rescue for developers in need. Glitch handles automatic deployment and hosting of code. Glitch also upgrades their servers and cloud infrastructure in the background for you. This way you can spend your valuable time on actually coding application logic! Yay, success!
What is also nice about Glitch is that you don’t have to start from scratch. There are existing open source projects that you can `remix` and start working on your version (I would compare it to forking the repository on github). There is a simple Slack slash command application to remix so I thought about using it in my project.
Glitch also has some downsides: it lacks a dubugger and CSS compiler of any kind. Also, it supports only Node.js.
Glitch in Practice: Building Stackbot
We use Slack extensively at Netguru. As a developer, this is my second most used application - after a text editor of course. That’s why all bots, integrations and slash commands are extremely useful for us. Slack slash command seemed to be the perfect choice for our first app in Glitch, as we wanted to facilitate the work of our developers.
I turn to StackOverflow very often and I know that many other coders do as well. It’s the biggest programming Q&A forum in the world, where you can find answers to problems from distinct areas. I end up there several times a day looking for answers. What if you could look up questions directly from Slack, saving your precious time? With Stackbot you can. This easy-in-setup and effective plugin allows you to access the resources of StackOverflow straight from a Slack channel and immediately present the results.
I found Slack Slash Command and decided to leverage it in my bot. I remixed the app, integrated it into our Slack and voila - it worked. No configuration, no need to set up the environment, nothing. There is even a file for storing environmental variables in it (variable values are not copied when you remix the app). It just simply works.
How Stackbot will make you life easier
When Stackbot is prompted with /stackbot “your question”, it uses the StackOverflow API to look up most relevant questions and displays them to you along with the number of votes and number of answers.
My implementation uses tinyspeck as an adapter to interact with Slack’s Web and RTM APIs and stackexchange npm package to query the StackOverflow API.
Tinyspeck handles all communication with Slack for us - dissecting incoming requests and sending responses to Slack. Messages to Slack can take the form of plain text or attachments. I decided to go with attachments. They are more versatile and support more options, making information more readable and transparent.
Before we send a response to Slack we need to query StackOverflow API through stackexchange npm package. By specifying a proper filter (the values of which are based on user request) we can acquire the needed data with one API call.
The only remaining work is to put the data into attachments and send it back to Slack.
The Promising Future of Glitch.com
Glitch.com is a fledgling initiative fromFog Creek Software to make it easier for more people to create software. Indeed, Glitch is super easy to use and facilitates many processes in development, like hosting or deployment. The remix feature is pretty cool as well. It significantly reduced the time and effort needed to set up the app, so you can just focus on coding.
That’s the very first approach we took, but we can already see Glitch.com has enormous potential for success.