Introducing Slack-Twitter

Have you heard of Slack? If you work in the tech industry, or have friends who work in the tech industry, there’s a pretty good chance you’ve heard of it, (though I do still encounter tech-savvy people who haven’t heard of it). The explanations of what it is vary depending on whom you talk to. It’s often described as group chat with link previews or an email-killer. It’s really whatever it is you want it to be since it can integrate with just about anything.

“An API for knowledge” is a pretty good, if maybe abstract, descriptor of what it is. Matt Haughey, in a podcast announcing his retirement from MetaFilter and his new job at Slack, described his employer’s product as a toy that people use at work. I liked that description so much that I left the Slack teams that didn’t have a well-defined purpose (such as work) or topic (such as the Ingress faction I belong to).

Since I’m now spending quite a lot of time using Slack, I wanted a way to read tweets in Slack. The official Twitter integration for Slack “only” pulls in mentions and expands tweet URLs so that it shows the entire text (and photo if there is one) of the tweet. That’s pretty darn cool, but there’s no functionality within the official integration to have your own timeline, i.e. the tweets of people you follow, show up in Slack nor is it possible to post tweets from Slack. Using Twitter’s Streaming API and Slack’s Real Time Messaging API, I built the middle piece that do those two things. I can post tweets from Slack and read tweets from my timeline. Cool, right?

You have to know a little bit about Twitter and Slack tokens to get this hooked up. You don’t have to host the program yourself: once you’ve gotten the tokens sorted out, you can quickly deploy it to Heroku. I recommend, nay, urge you to hook this up to a separate channel for the single purpose of reading and posting tweets. Posting any message under 140 characters will be published on your Twitter account.

I’ve only tried this with my personal Slack “team” and not a real world example. I can see how this might be interesting for a group to join the channel and read the tweets that the organization account follows, as well as ‘collaboratively’ post. I can’t wait to see what bugs that might cause, in a very public way.

It crashes every now and then, thanks to a memory leak somewhere along the line. There’s another heisenbug that periodically tweets a URL of a tweet from your timeline but I don’t know the pattern yet. Still interested? Take a look at the instructions and deploy to Heroku. It’s free!


Also published on Medium on March 24th, 2015.