Grues in the workplace: How to play Zork in Slack
By Tim Lefler (@tlefca) on 2014-04-09
I hate the Internet on April Fools.
This year, instead of avoiding online new sites, I thought I'd do something fun for the team I work with, the team at Slack. I decided to build something that wold allow the team to play the 1979 text adventure game Zork, inside of Slack.
Needless to say, it was a very fun game to play collaboratively. Commands were handled separately then chat, so discussions could happen along side the adventure. and anyone could type a command at any time. Team mates would hop in the #zork channel when they had a few minutes, read what had happened since their last visit, and maybe make a few moves of their own. It was entertaining to watch unfold.
Since this little private experiment went over so well with the team, and a few of you on twitter, I've decided to make the code I wrote to make it work, available up on GitHub.
What's that? You don't want to download the code, set it up and host it yourself? Fine! I've also opened up the instance on my personal server available for you to connect to and play with. Just follow the instructions below and you'll be playing in no time.
Create or choose a channel
Within Slack, choose a channel to play Zork in, I would recommend a new channel. Maybe something like #zork.
Create an incoming webhook:
- Set the channel to the one you chose above (#zork)
- Give your bot a name (something like 'zork')
- Upload an icon for your bot (um)
- Copy the incoming webhook token for use in the next step
- Copy the incoming webhook URL for use in the next step
Build your outgoing-webhook URL
Determine the following parameters:
session_id- A unique string. I recommend the incoming webhook token you copied earlier
data_id- The game you want to play (values can be
output-webhook- This must be the incoming webhook URL you copied earlier
With this data, build your URL:
http://tlef.ca/projects/restful-frotz/?play&session_id=<your session_id value>&data_id=<your data_id value>&handler=slack&output-webhook=<your output-webhook value>
Create an outgoing webhook:
- Create a new Outgoing Webhook integration from within Slack.
- Select the same channel as in the previous steps (#zork)
- Choose a bot-name and upload an icon (optional, as you'll only see this if an error occurs)
- Choose a trigger word. I recommend just using z. (You want something short, as you'll need to type it before every command).
- Copy the URL you created above as the webhooks URL
How to play
Using your trigger word (z) in the channel (#zork) you setup will send the command to Zork. Leaving off the trigger word will not do anything, so normal discussions can still happen.
For example, to look, type:
> z look You are standing on the top of the Flood Control Dam #3, which was quite a tourist attraction in times far distant. There are paths to the north, south, and west, and a scramble down. > Damn! Look at that > z south
NOTE: I don't own the rights to Zork, and this is not affiliated with Slack at all, just something fun for personal use.
This comes with no guarantee of uptime, compatibility or support, and may be taken down at any time. Any abuse of the system and it will simply be removed.
Any questions, comments or improvements, feel free to tweet me at @tlefca