Deploy a Microsoft Teams Endpoint

Description

This tutorial covers the necessary steps for creating and connecting a Microsoft Teams Endpoint to Microsoft Teams. If you want to get information about assigning a Flow to the Endpoint and setting up the Data Management see Endpoints.

Setup Process

  1. Create a Microsoft Teams Endpoint in COGNIGY.AI
  2. Integrate the Microsoft Teams Endpoint with your Microsoft Teams team
  3. Send messages to your Teams Bot

1. Create a Microsoft Teams Endpoint

Location: COGNIGY.AI

The first thing you need to do is to create a Microsoft Teams Endpoint in COGNIGY.AI. In order to do this, navigate to your Project, click on the button in the lower left corner and create an Endpoint.

Figure 1.1: Creating a Microsoft Teams EndpointFigure 1.1: Creating a Microsoft Teams Endpoint

Figure 1.1: Creating a Microsoft Teams Endpoint

After creating your Endpoint, you should be navigated to the Endpoint configuration of your Microsoft Teams Endpoint. Here you need to set the Flow that the Endpoint should point to, and you can change the NLU Connector of the Endpoint.

Figure 1.2: A Created Microsoft Teams EndpointFigure 1.2: A Created Microsoft Teams Endpoint

Figure 1.2: A Created Microsoft Teams Endpoint

Now that you have created the Microsoft Teams Endpoint, all that is left to do is to connect it to Microsoft Teams. The Microsoft Teams Endpoint contains Microsoft Teams Settings which is one setting we need in order to connect to your Microsoft Teams team. The setting is:

  • A security token

The next chapter will describe where you can find this setting in Microsoft Teams.

2. Integrate the Microsoft Teams Endpoint with Microsoft Teams

Requirements
Endpoint URL

In order to connect your Microsoft Teams Endpoint to Microsoft Teams, you have to create a Webhook in Microsoft Teams so that all messages that mention your bot is sent to your COGNIGY.AI Flow. Do this by opening the menu next to the Microsoft Team where you wish to add the bot, and click on Manage team.

Figure 2.1a: Navigating to the Webhooks page.Figure 2.1a: Navigating to the Webhooks page.

Figure 2.1a: Navigating to the Webhooks page.

You now need to navigate to the Apps tab in your team overview. This will give you a list of all apps that are currently installed in your team, as well as the option to create new ones. We need to create a new outgoing Webhook for our bot, which you can do by clicking the Create an outgoing webhook button in the lower right corner.

๐Ÿšง

Button to create Webhook is missing

In case you cannot see the Create an outgoing webhook button in the lower right corner, then you have to follow this guide here: Outgoing Webhooks. The guide covers how to setup your Office 365 tenant to allow for uploading Webhooks.

Figure 2.1b: Team appsFigure 2.1b: Team apps

Figure 2.1b: Team apps

Figure 2.1c: Creating a WebhookFigure 2.1c: Creating a Webhook

Figure 2.1c: Creating a Webhook

When creating the Webhook, you first need to give the Webhook a name. This will be the name of your Bot. You thereafter need to copy the EndpointURL of your Microsoft Teams Endpoint which will be used as the Webhook URL. You can find the EndpointURL in your Microsoft Teams Endpoint in the COGNIGY.AI User Interface.

You can then give your Webhook a description and upload an optional image for your Bot. When finished, click on Create to create the Webhook. This will open a popup containing a security token. Copy this token and paste it into the Microsoft Teams Settings tab in the Endpoint configuration in the COGNIGY.AI User Interface. If you lose the security token, then you have to create a new Webhook.

Figure 2.1d: Getting the security tokenFigure 2.1d: Getting the security token

Figure 2.1d: Getting the security token

Figure 2.1e: Configuring the Endpoint with the security tokenFigure 2.1e: Configuring the Endpoint with the security token

Figure 2.1e: Configuring the Endpoint with the security token

You are now finished connecting your Endpoint with your Microsoft Teams! Go into a channel in your team and mention your bot to talk to it.

๐Ÿ“˜

Mentioning the bot

You always have to mention the bot, e.g. @Bot, when saying something to it. Otherwise the message will not be sent to your Flow.

2.1.f: Sending a message to the bot2.1.f: Sending a message to the bot

2.1.f: Sending a message to the bot

3. Sending Messages to a Teams Bot

You can have your bot reply simple text messages by just adding text to the Default tab of a Say Node or you can reply with structured content, called Cards in Teams.

Card in Microsoft TeamsCard in Microsoft Teams

Card in Microsoft Teams

You can simply enter the Teams Card JSON into the Microsoft Teams tab on a Say
Node.

๐Ÿ“˜

Card Reference

Microsoft offers a large number of Card examples on the Teams Card Reference Page

The JSON for the example card above is shown below.

{
  "attachments": [
    {
      "contentType": "application/vnd.microsoft.card.hero",
      "content": {
        "title": "Seattle Center Monorail",
        "subtitle": "Seattle Center Monorail",
        "text": "The Seattle Center Monorail is an elevated train line between Seattle Center (near the Space Needle) and downtown Seattle. It was built for the 1962 World's Fair. Its original two trains, completed in 1961, are still in service.",
        "images": [
          {
            "url": "https://upload.wikimedia.org/wikipedia/commons/thumb/4/49/Seattle_monorail01_2008-02-25.jpg/1024px-Seattle_monorail01_2008-02-25.jpg"
          }
        ],
        "buttons": [
          {
            "type": "openUrl",
            "title": "Official website",
            "value": "https://www.seattlemonorail.com"
          },
          {
            "type": "messageBack",
            "title": "My MessageBack button",
            "displayText": "I clicked this button",
            "text": "User just clicked the MessageBack button",
            "value": "{\"property\": \"propertyValue\" }"
          }
        ]
      }
    }
  ]
}

๐Ÿšง

Postbacks are unsupported on the Microsoft Teams Endpoint

If your card includes postback functionality (e.g. messageBack), then this is not supported in the Microsoft Teams endpoint. To get this functionality, you can use the Microsoft Bot Framework endpoint together with Microsoft Teams instead.


Did this page help you?