tinyspeck/hubot-slack — pull request #48 by jonursenbach (2014-03-21 22:47:31+00:00)
Title: Allow messages to be manually sent to any room.

So I spent the better part of today trying to get working on Slack only to realize something very silly.

As I was pushing up changes and trying to figure out why it wouldn't send a message to a room of mine, I realized how ```@channelMapping``` works. The way that this works is that in order to send a message to a room, the bot has to be aware of that room (which it can only be if it's previously sent something to said room).

So as I was rebooting my bot, this memory store was getting dumped out and when I was sending my notification to the room, hubot-slack didn't know about it because I hadn't interacted with my bot in there.

And that brings me to this change.

What if I wanted to send something (like a Jenkins notification) to a room that the bot doens't know about (like a private room, or any room that the bot hasn't been interacted with in). You can't.

Well now you can.

Instead of just relying on handling the channel name (```#general```, ```#engineering```, etc.) you can now pass the bot a channel ID (```CSOMEJUMBLEOFALPHANUM```, ```GSOMEJUMBLEOFALPHANUM```).

If the bot can't find the name of a room in the ```@channelMapping```, it falls back to whatever string you gave it and then sends the message away. Of course, if that room doesn't exist you'll get a failure, but that's your fault.