MSTeams.PNG

Within our Cognigy.AI platform you're able to connect your Cognigy.AI Flows to Microsoft Teams by using our Microsoft Teams Endpoint integration. 

Microsoft Teams Deployment Options

This Endpoint is used to deploy a virtual agent to a Microsoft teams channel that answers when it is mentioned by a user in a post. To deploy a direct messaging bot that can be contacted via direct chat, please use the Azure Bot Services 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

Firstly, you must create an Endpoint of the type Microsoft Teams (see Figure 3.1). To do this, navigate to the Endpoints menu, found under Deploy in the resources panel on the left side of the Cogngiy.AI UI. Select "+ New Endpoint", give the endpoint a name and select Microsoft Teams from the available options. 

create.PNGFigure 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.

settings.PNG
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

Location: Microsoft Teams Platform

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.

0d13b73-Screenshot_from_2018-10-16_16-07-53.png
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.

b1214aa-Screenshot_from_2018-10-16_16-09-31.png
Figure 2.1b: Team apps

c7ec885-Screenshot_from_2018-10-16_16-55-00.png
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.

0fecb8c-Screenshot_from_2018-10-16_17-00-26.png
Figure 2.1d: Getting the security token

SecurityToken.PNG
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.

e58df7c-Screenshot_from_2018-10-16_17-03-43.png
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.

c240c40-manager.jpg
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.

Teams Card Sample

{
  "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 Azure Bot Services endpoint together with Microsoft Teams instead.


Comments

0 comments

Please sign in to leave a comment.

Was this article helpful?
1 out of 1 found this helpful