Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

messageRoom still does not work #268

Open
gcao opened this issue Dec 25, 2015 · 7 comments
Open

messageRoom still does not work #268

gcao opened this issue Dec 25, 2015 · 7 comments

Comments

@gcao
Copy link

gcao commented Dec 25, 2015

Hi,

When I try to send a message to a room, nothing shows up. I noticed an issue (#24) was opened long time ago and was closed. I've tried the various workaround in it and nothing works. Not sure whether this is related to the adapter or hipchat or my setup.

Thanks,
Cao

Code

module.exports = (robot) ->
  robot.messageRoom "[email protected]", "Test"

Hubot log

<message to="[email protected]/TestBot" type="groupchat"><body>Test</body></message>

OS: Mac OS X 10.11 El Capitan
node 4.2.1
Extracted from package.json:

    "hubot": "^2.13.2",
    "hubot-hipchat": "^2.12.0-5",
@bbuck
Copy link

bbuck commented Feb 1, 2016

I successfully implemented a "messageRoom" feature for my teams Hubot. You can send it a room name like "Hipchat Room" and I transform into a format that is used for the messageRoom call. Here's the function that transforms it:

channelID: (name) ->
  temp = name.toLowerCase().replace(/\s/g, "_")
  "#{HIPCHAT_ROOM_ID}_#{temp}@conf.hipchat.com"

Where HIPCHAT_ROOM_ID is the numeric value used before each room name. So the name "Hipchat Room" is transformed to [email protected] and then passed to robot.messageRoom.

I also believe that Hubot has to either be in the room or have access to join the room if he's not in it in order for message that room to work. If he's not in the room and can't automatically join them, then you may want to invite him to the rooms you want to message prior to testing messageRoom.

@incompl
Copy link

incompl commented Jul 13, 2016

This worked for me. What you're calling HIPCHAT_ROOM_ID is a global Jabber ID for your Hipchat account, not a unique ID for each room. You can find it in your Hipchat settings on their site, or maybe in an environment variable.

@incompl
Copy link

incompl commented Jul 13, 2016

Would it be reasonable to build this into hubot-hipchat itself so users can simply specify a room name?

@bbuck
Copy link

bbuck commented Jul 14, 2016

I don't know if it's necessarily a "good idea" so to speak, but I think it would be great to have an adapter-agnostic means to get a room ID. Something like robot.roomIDFromName(someRoomName) (obviously better names exist, this is an example). Mostly because I migrated our hubot implementation from HipChat to Slack and had to rebuild all the room related messaging functionality to work with Slack's method for identifying rooms.

@incompl
Copy link

incompl commented Jul 14, 2016

@bbuck I think that's a good idea! I would definitely use that.

@toadkicker
Copy link

I ran into this snag and just did this:

process.env.HUBOT_HIPCHAT_JID.split("_")[0] which is the same as HIPCHAT_ROOM_ID you mentioned above.

@178inaba
Copy link

178inaba commented Aug 27, 2016

Please try my PR (#280)!
Even if the room name is changed it will work.

Please fix your hubot package.json:

{
  ...
  "dependencies": {
    ...
    "hubot-hipchat": "178inaba/hubot-hipchat#rooms",
    ...
  },
  ...
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants