Skip to content

Instantly share code, notes, and snippets.

@ojacques
Created July 22, 2021 11:22
Show Gist options
  • Save ojacques/a71e1de6b25e05c386932ffa7366a10f to your computer and use it in GitHub Desktop.
Save ojacques/a71e1de6b25e05c386932ffa7366a10f to your computer and use it in GitHub Desktop.
Hubot on MS Teams

A bot in Microsoft Teams is managed through the Bot Framework.

  1. Navigate to https://dev.botframework.com/bots/new.
  2. Fill in the blanks.
  3. Click on Create Microsoft App ID and password.
  4. Save the AppId and the Password, you will need it later.

Create your hubot bot

Use a Dockerfile to create the bot instance. Create the bot scripts following the instructions documented at https://hubot.github.com/docs/.

Deploy the bot

To deploy the bot use the botframework adapter during the deployment.

Don't forget to specify the BOTBUILDER_APP_ID and BOTBUILDER_APP_PASSWORD environment variables.

Add the bot to the team channel

Create the MS Teams application

To create the MS Teams application, package the MS Teams application in a zip file containing:

  • a manifest.json file,
  • icons referenced by the manifest.

Manifest.json sample

{
    "$schema": " https://developer.microsoft.com/en-us/json-schemas/teams/v1.3/MicrosoftTeams.schema.json",
    "manifestVersion": "1.3",
    "version": "1.0.1",
    "id": "<ID provided by the MS App>",
    "packageName": "com.dxc.hubot.doc",
    "developer": {
        "name": "",
        "websiteUrl": "",
        "privacyUrl": "",
        "termsOfUseUrl": ""
    },
    "name": {
        "short": "doc",
        "full": "Doc"
    },
    "description": {
        "short": "Handle operational tasks",
        "full": "Handle operational tasks"
    },
    "icons": {
        "outline": "icon.png",
        "color": "icon-192x192.png"
    },
    "accentColor": "#525354",
    "bots": [
        {
        "botId": "<ID provided by the MS App>",
        "needsChannelSelector": false,
        "isNotificationOnly": false,
        "scopes": [
            "team",
            "personal",
            "groupchat"
        ],
        "supportsFiles": true
        }
    ],
    "permissions": [
        "identity",
        "messageTeamMembers"
    ]
}

Add the application to your team

In MS Teams:

  • Select the team the bot is to be added to.
  • Right click.
  • Click on managed team.
  • Click on the Applications tab.
  • On the bottom right corner click on Load a custom application.

Add authorization scripts

Refer to the following documentation https://github.com/jayongg/TeamsHubot to learn how to add the authorization scripts.

References

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment