Microsoft Teams Deployment

Understand how to set up and deploy a OneBot App for Microsoft Teams

Written By Ben Lehmann

Last updated 8 months ago

Overview

This document is a guide to creating and setting up a new OneBot app to work with the Microsoft Teams chat client.

There are four stages to creating and setting up OneBot to run inside of Teams:

  1. Create a Teams configuration in the OneBot portal.

  2. Create a new bot inside the Developer Portal.

  3. Create an MS Teams app for the bot.

  4. Publish the package to your organisation.

Before you begin

Some aspects of the setup happen concurrently, and you will need to transfer information between them during the process. Therefore, it is easier to have both your OneBot service portal and the Teams client open during setup.

Finally, if you do not already have it, you will also need to Add the Developer Portal to Teams to create the bot and the app for Teams.

Create a Teams configuration in your OneBot portal

Follow these steps to create a Teams configuration in the OneBot portal:

Begin a new configuration

  1. Log in to your OneBot portal.

  2. Navigate to the OneBot App Store

  3. Click ‘Configure’ on the Microsoft Teams integration.

  1. Click ‘New Config’ in the top right.

Open the configuration view of Teams

Click ‘New Config’

Initialise configuration information

  1. Add a name for the instance.

  2. Add a description of the instance.

  3. Add a temporary Bot ID.
    This will be changed shortly, but an initial temporary value is required to create the instance.
    For example, an ID of ‘1000’ is fine.

  4. Set an ‘NLP Intent Configuration’.

  5. Click ‘Save’ in the top right, which will turn green and become available after the above steps are complete.

After clicking save in the previous step, the instance will be created in the OneBot portal, and the Endpoint will be generated.

  1. Either select and copy the Endpoint from the ‘Endpoint’ field or click the ‘Copy’ button to its right to capture the URL to the clipboard.

Add a Name, Description, and temporary Bot ID

Set the Bot Intent and Save

Capture the Endpoint URL

Create a new bot app

Switch over to Microsoft Teams and open the Developer Portal there, either from the sidebar or by searching for it from the ‘View more apps’ menu.

Open the Developer Portal

  1. Click on ‘View more Apps’.

  2. Type developer into the search field.

  3. Click on the ‘Developer Portal’ app to open it.

Open the Developer Portal inside Teams

Note

You can right-click on an app in the sidebar and choose to pin it there for easy access

Create a new bot

  1. Click the ‘Tools’ on the tab at the top from inside the developer portal.

  2. Click Bot Management to open the Bot Management view.

  1. Click + New Bot to add a new bot

  1. Give the bot a name and click Save

Open the Bot Manager

Create a new bot

Name your new bot

This will create your new bot and synchronise it using a new connection to Azure, so you may see a slight delay while this happens.

Configure your new bot

Once your new bot has been created, the first thing is to add the ‘Bot endpoint address’ copied to the clipboard, earlier.

  1. Paste this endpoint address to the ‘Bot endpoint address’ field and click ‘Save’. This configures the bot, so it knows where to talk back to.

Working down through the other options in the left side-panel:

  1. Select ‘Channels’ and make sure to have ‘Microsoft Teams’ selected.

  1. Leave ‘Meeting event subscriptions’ empty.

The final configuration stage for your bot is to create a secret for the bot to use as a password for secure authentication.

Note

Once you click away from the secret generation dialogue box, there is no way to view it again. If you find the secret is not copying correctly, or the dialogue closes before you have captured the secret, you will need to generate a new secret to use instead.

Continuing your Bot Configuration:

  1. Click ‘Client secrets’ to create a new Secret (password) for the bot to use.

  1. Click ‘Add a client secret for your bot’ to open the client secret generation dialog.

    The easiest way to copy the secret to your clip board is to first select it by triple-click it, and then copying it with a copy shortcut (e.g. Ctrl-C on Windows, or Command-C on MacOS).

Complete Teams configuration in the OneBot portal

Configure your bot’s secure secret

  1. Switch back to your OneBot portal.

  2. Click ‘Set Bot Password’ to open the change password dialog.

  1. Paste the copied secret into the ‘Bot Password’ and ‘Repeat Bot Password’

  2. Click ‘Set Bot Password’ to set the password for the Bot.

Configure your bot’s ID

We now need to get the ID for the newly created Bot and add it as the Bot ID for this configuration, overwriting the temporary Bot ID that we set up earlier.

Configuring your bot’s ID

  1. Switch back to Teams. If you left Teams as it was in the prior step, navigate back to see your new Bot by clicking the button < Bots in the top-left. Alternatively, you can navigate to see your bots by going to Developer Portal > Tools > Bot Management as before.

You will see the Bot ID next to your newly created Bot. However, the Microsoft implementation here can again be difficult: currently, the only view of the ID is in this Bot management view. If you click on the ID to copy it, you will instead open the Configuration for the bot, and so cannot see its ID. The easiest work around is to copy the ID without releasing your mouse button.

  1. Click just to one side of the ID, holding down the mouse button.

  2. Drag select across all the ID characters, but do not release the mouse button.

  3. Use the copy shortcut to capture the Bot ID to your clipboard

The final step is to paste the copied Bot ID into OneBot

  1. Switch back to your OneBot portal and paste the copied Bot ID into the ‘Bot ID’ field.

  2. Click ‘Save’ to complete the Teams configuration.

Create an MS Teams app for the bot

We now need to create the app that will run on your Teams client.

Create the app

  1. Switch back to Teams and click on the ‘Apps’ tab at the top of the view.

  2. Click the ‘+ New app’ button in the top-left.

  1. Give your new app a name in the ‘Add app’ dialogue box that appears.

  2. Click ‘Add’ to create the app.

Configure basic information

  1. Give your OneBot App a ‘Short name’

  2. Give your app a ‘Full name’ (Optional)

  3. Give it a ‘Short description’ and a ‘Long description’ by completing the respective fields.

⚠️ Caution

When naming your app, be aware that both the short and long descriptions will be prominent in the published app and the store, so it is worth getting these right.

Continuing down Basis information:

  1. Leave the ‘Version’ number as it is. This can be incremented as needed for later releases of the app.

  2. Add the developer or company name to ‘Developer or company name’ field

  3. Add your website address to ‘Website’

  4. Add your privacy policy to the ‘Privacy policy’ field.

  5. Add any terms and conditions to the ‘Terms of use’ field.

  6. Click ‘Save’ to finish creating the basic information setup for your app.

Configure branding

  1. Select ‘Branding’ from the left side-panel to setup the branding for your app.

What you set here will be what appears in the app for your users. Be careful with the sizes for these options: Microsoft require sizes exactly as detailed on this page.

Configure Teams features

  1. Click ‘App features’ tab in the side-panel to specify the Teams features to include in your app.

  2. Select ‘Bot’

  3. Select the bot that you just created from the ‘Select an existing bot’ dropdown.

  4. Leave the options under ‘What can your bot do?’ unselected but do at least select ‘Personal’ under ‘Select the scopes where people can use your bot’ to give yourself access to it.

  5. Click ‘Save’ to complete creating your Teams app.

Publish your bot to your organisation

You can preview your bot before distributing it to your organisation.

Preview your bot

  1. Click ‘Preview in Teams’ in the top-right of the view.

  1. Click ‘Add’ in the dialogue box that appears. This will take you into the chat.

Publish your bot

To publish the app to your organisation, head back into the Developer Portal in Teams

  1. Select the Apps tab as before

  2. Open the app you just created

  1. Click ‘Publish’ in the top-right.

This will create a file, which you can either:

  1. Click ‘Publish to your org.’ if you want to distribute your app this way and you have the rights. In some cases, it will allow you to publish it and then you will have to approve it on the website itself.

Or:

  1. Click ‘Download the app package’ if you prefer this as an alternative. This will save the file as a zip. This allows you to upload it to your client directly.

  2. Click on the ‘+ Apps’ button in the sidebar of Teams to being uploading your app directly.

  3. Click ‘Manage your apps’ from the bottom of the left side-panel

  4. Click ‘Upload an app’ near to the top of the view.

This will open the ‘Upload an app’ dialog that will allow you to select the app file.

  1. Select ‘Upload a customised app’ to select and upload the zipped package from your chosen download location

  1. Click ‘Add’ from the app dialogue box that appears to add it to your installed applications in your Teams client.

The app will be visible on the left sidebar. It can be pinned there to keep it visible as a Teams application by right-clicking on it and choosing ‘Pin’ from the menu.