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

Hubot for Microsoft Teams #1260

Closed
AzCii opened this issue Nov 15, 2016 · 17 comments
Closed

Hubot for Microsoft Teams #1260

AzCii opened this issue Nov 15, 2016 · 17 comments

Comments

@AzCii
Copy link

AzCii commented Nov 15, 2016

Have anyone looked at creating a Hubot adapter for Microsoft Teams (teams.microsoft.com)?

@tvvignesh
Copy link

Looking forward to this. It will be better if Hubot can integrate with Microsoft Bot Framework (which may support teams) in someway so that if they add/remove support, it can work well with Hubot.

@jvarness
Copy link

jvarness commented Dec 18, 2016

I've been trying to get some code working, but the bot I made for my company has some proprietary stuff I don't want out in public domain. That and I need a cloud endpoint that the bot can be reached from.

My idea is to use the Microsoft Node.js SDK to create a UniversalBot and setup events in the hubot adapter. As soon as I can get a proper test bed going to make sure it works I have no problem releasing it to the public.

The two frameworks are pretty different. Hubot aims to be a one-size-fits-all framework that you can deploy and use anywhere and extend infinitely. Microsoft bots appear to be geared more towards serving one specific purpose, being cloud hosted, with the ability to be placed into any Teams server.

The difference in design is uncanny as well: Hubots typically aim to do various small commands, whereas Teams bots can carry on whole conversations to get more complex things done. Pretty interesting to see the difference in design.

@calebmeyer
Copy link

calebmeyer commented Dec 29, 2016

Microsoft Teams currently has three layers for what you might consider bots:

  1. You can create a tab, which is an iframe around a website of your choice. I tried this for JIRA, but got about 20 console errors and gave up (there's no way to debug from within the teams desktop app).
  2. You can create a bot (including using the nodejs sdk), but it's limited to private (i.e. 1 on 1) chats, no channels. Microsoft's own T-Bot is an example of this.
  3. You can create a connector, which can push notifications into a channel via sending JSON over HTTP. Currently, there's no way for a connector to know what's being said in the channel. This makes it useful for seeing pull requests on github or CI builds, but not useful for hubot as we know it.

Reference: https://msdn.microsoft.com/en-us/microsoft-teams/index

You can vote for the features to allow hubot here: https://microsoftteams.uservoice.com/forums/555103-public-preview/suggestions/16937848-allow-adding-bots-to-channels

@ojacques
Copy link

The new custom bot capability in MS teams is heading there. From the look of it, one could now create an Hubot adapter for MS teams.
There is a sample custom bot in C# on Github. I haven't look at the code yet.

@combatpoodle
Copy link

According to https://microsoftteams.uservoice.com/forums/555103-public-preview/suggestions/16937848-allow-adding-bots-to-channels this has been completed on Microsoft's side; however I have not verified.

@calebmeyer
Copy link

@israelshirk I can verify that you can add bots to channels. Unfortunately, unless you @mention them specifically, they're not allowed to "listen" to the channel. This removes most of the utility of a bot (it makes it a special case of a slash command).

To fix this issue, please vote here: https://microsoftteams.uservoice.com/forums/555103-public/suggestions/18646171-remove-bot-mention-requirement

@combatpoodle
Copy link

Thanks @calebmeyer!

@markottaviani
Copy link

Looks like Microsoft has posted a Bot Framework Hubot adapter: https://github.com/Microsoft/BotFramework-Hubot

@wumingzhang
Copy link

Have anyone manage to actually get their hubot connected with ms teams?

@combatpoodle
Copy link

@wumingzhang Yes, works great

@ojacques
Copy link

ojacques commented Sep 29, 2017

It looks like with botFramework, hubot needs to be hosted on the public internet per this issue on botframework adapter for Hubot: microsoft/BotFramework-Hubot#15.
The issue with that is that it will require some sort of reverse proxy or VPN to reach infrastructure which is only on the intranet.
In the issue above, there is a mention about Orky, which looks like some sort of a botframework proxy, to which Hubot connects thanks to an Hubot adapter.

Hubot (on prem) w/orky adapter ----> Orky bot (internet) <----> MS Teams

@combatpoodle
Copy link

I got a question off list about this, which I'm going to answer on-list for posterity.

First, get hubot online

You'll want to have it booted up with BotFramework-Hubot and non-functioning credentials, but the right port. We'll add credentials later. Sounds weird, I know, but it'll work out in the end. Just trust me. You'll want port 3976 open to the interweb (or at least to Azure's cloud netmasks) so that Microsoft's REST API calls from Teams -> BotFramework -> your botframework implementation -> hubot make it through.

Botframework.com

So, first you're going to want to register yourself at https://dev.botframework.com/. This is the integration point.

  • There's a step through the M$ registration, and then you're logged into dev.botframework.com with a header menu that has an option of My Bots.
  • Click it.
  • Hit Create and do register an existing bot.
  • Fill in the next form really good-like. At messaging endpoint enter the endpoint you created above!
  • Now we'll create the Microsoft App ID and Password that the local Bot Framework wants. Just follow the buttons and you'll be good to go.
  • Paste in your App ID into the Bot Framework form because Microsoft's left hand doesn't talk to its right.
  • Add any other owners you'd like to have in case you get a cold and don't want to be on call.

Agree, and you're well on your way. Make sure you have microsoft teams selected as your chat framework (BotFramework is an aggregator service - so failing to select Microsoft Teams and the proper channels here can be painful).

Credential Hubot and restart

Pretty straightforwards.

Test

You can test hubot first from the dev.botframework.com dashboard. Any connectivity issues between BotFramework's APIs and your hubot can be sussed out by using that integration. As long as that is working with your hubot, your problem is then between your BotFramework configuration and your Microsoft Teams configuration. Which can be a hassle, but typically starting from scratch it's fairly straightforwards. Just make sure you're logged in with the right organization, account, privileges, and you should just end up in the right place from the beginning.

If you have any questions I'm a little time limited, but I'll help where I can on here or every once in a while I'm on the hubot slack. Hope this helps!

@mose
Copy link
Member

mose commented Oct 5, 2017

Great input @israelshirk thanks! 👍

@mose mose closed this as completed Oct 5, 2017
@wumingzhang
Copy link

the messaging endpoint require to be https, i guess you need do some haproxy between?

@combatpoodle
Copy link

combatpoodle commented Oct 9, 2017 via email

@wumingzhang
Copy link

thanks @israelshirk , still missing the last piece of the puzzle. I got it working in "test" mode in dev.botframework.com, but cannot connect properly into teams. anything special need to be done?

@toomuchio
Copy link

toomuchio commented Oct 31, 2017

Just in case anybody else gets stuck on this.

Port 8080 not 3976, you can reverse proxy it with Nginx to expose it publicly.
If you want to keep to hubot spec you should alter BOTBUILDER_ENDPOINT to be /hubot/api/messages as well.
curl -X POST -H "Content-Type: application/json" -d '{"test":"test"}' localhost:8080/api/messages

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

10 participants