microsoft / BotFramework-Hubot

Hubot adapter for botframework
MIT License
111 stars 40 forks source link

Does robot.hear work? #22

Closed martin-goette closed 6 years ago

martin-goette commented 6 years ago

I wonder if "hearing" = listening to a conversation without being explicitly @mentioned is supposed to work in Microsoft Teams.

Example:

module.exports = (robot) ->
  robot.hear /badger/i, (res) ->
    res.send "Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS"

The same question goes for robot.messageRoom, example:

module.exports = (robot) ->

  robot.hear /green eggs/i, (res) ->
    room = "mytestroom"
    robot.messageRoom room, "I do not like green eggs and ham.  I do not like them sam-I-am."

So, if I just mention the word "badger" in any conversation inside a channel, I would expect hubot to respond with Badgers? BADGERS? WE DON'T NEED NO STINKIN BADGERS.

Does a Channel translate to a Room? I couldn't make it work so far, so I wonder if I just can give up trying. Thanks you!

MatSFT commented 6 years ago

Microsoft Teams does not send messages to a bot unless it is @mentioned in them. This means hear will not work the hubot way unfortunately. I think hear regexs will get matched if there is an at mention though, but I don't remember if there are any caveats there.

MatSFT commented 6 years ago

Channel <-> room is a little complicated in the Microsoft Teams world as well. The room Id that you receive in messages will usually be something of the form channel id;message thread id. This is because inside of a channel, Microsoft Teams organizes chat in another level of message threads. So essentially if you reply to just the channel id, your bot will create a new chat thread, and if you reply to the channel id + message id, your bot will respond inside of the existing chat thread.

martin-goette commented 6 years ago

I suspected something like that already, and your reply confirms it. Thanks a lot for the quick response, then I will refactor my scripts to @mention.