Microsoft Teams

The Microsoft Teams output in ArcGIS Velocity allows you to send Adaptive Cards to chats or channels in Microsoft Teams. Adaptive Cards can contain text, graphics, and buttons, providing an interactive and engaging mechanism to communicate information.  With Velocity, feature data can be included in the Adaptive Card posted to Microsoft Teams. This is a mechanism to communicate information effectively to users across different systems.

To use this output type, you must first generate a webhook URL in Microsoft Teams. The webhook URL is then used to configure the Microsoft Teams output in Velocity.

Example

The following is an example use case for the Microsoft Teams output:

An analyst configures a real-time analytic to post an Adaptive Card to a Microsoft Teams channel if a severe weather warning is issued that intersects the organization's service territory.

Usage notes

Consider the following when working with the Microsoft Teams output:

  • The Microsoft Teams webhook URL must be configured in Microsoft Teams.
  • When sending JSON in a request body, it must be formatted in the Microsoft Teams Adaptive Card format. Refer to the section below for JSON examples.

Microsoft Teams Adaptive Card JSON examples

When formatting the JSON request body, wrap the output JSON with the Text() Arcade function to properly format the JSON. The JSON must be in the format of a Microsoft Teams Adaptive Card with the following properties:

  • The type field must be set to message.
  • The attachments array contains a set of card objects.
  • The contentType field must be set to Adaptive Card type.
  • The content object is the card formatted in JSON.

The examples below show Arcade expressions configured to output Adaptive Cards in the JSON format. The resulting Adaptive Cards are posted to the chat or channel associated with the Microsoft Teams webhook URL.

The example below creates a basic Adaptive Card that displays vessel information, including the vessel name and ID.

Example 1—Basic Adaptive Card

 
 
// Output is wrapped in Text() 
Text({ 
    //type is set to "message":  
    "type":"message",  
    //attachments contains an array of card objects: 
    "attachments":[  
    { 
        //contentType is set to "application/vnd.microsoft.card.adaptive": 
        "contentType":"application/vnd.microsoft.card.adaptive",  
        "contentUrl":null, 
        //content is the Adaptive Card formatted in JSON 
        "content":{  
        "type": "AdaptiveCard", 
        "speak": "Vessel Information", 
        "version": "1.5", 
        "$schema": "https://adaptivecards.io/schemas/adaptive-card.json", 
        "body": [  
            { 
               "type": "TextBlock", 
                "text": "Vessel Information", 
                "wrap": true, 
                "style": "heading", 
                "color": "Good" 
            }, 
            { 
                "type": "FactSet", 
                "facts": [ 
                    { 
                        "title": "Vessel Name", 
                        "value": $feature.name 
                    }, 
                    { 
                        "title": "Vessel ID", 
                        "value": $feature.num 
                    } 
                ] 
            }] 
        } 
    }] 
})

Example 1 creates the following message that displays vessel information, including the vessel name and ID.

Vessel Information

The following example creates an Adaptive Card with an image and button.

Example 2—Adaptive Card with Image and Button

 
 
// Output is wrapped in Text() 
Text({ 
    //type is set to "message":  
    "type":"message",  
    //attachments contains an array of card objects: 
    "attachments":[  
    { 
        //contentType is set to "application/vnd.microsoft.card.adaptive": 
        "contentType":"application/vnd.microsoft.card.adaptive",  
        "contentUrl":null, 
        //content is the Adaptive Card formatted in JSON 
        "content":{ 
            "type": "AdaptiveCard", 
            "speak": "New vessel detected", 
            "version": "1.5", 
            "body": [ 
                { 
                    "type": "TextBlock", 
                    "text": "New vessel detected at " + $feature.ts, 
                    "wrap": true, 
                    "size": "Large", 
                    "weight": "Bolder", 
                    "color": "Attention" 
                }, 
                { 
                    "type": "ColumnSet", 
                    "columns": [ 
                        { 
                            "type": "Column", 
                            "width": "auto", 
	                           "items": [ 
                                { 
                                    "type": "Image", 
                                    "url": "https://www.esri.com/content/dam/esrisites/en-us/common/icons/product-logos/Analytics_for_IoT_220.png",
                                    "width": "24px", 
                                    "height": "24px", 
                                    "style": "Person", 
                                    "altText": "ArcGIS Velocity" 
                                } 
                           ], 
                            "verticalContentAlignment": "Center" 
                        }, 
                        { 
                            "type": "Column", 
                            "width": "stretch", 
                            "items": [ 
                                { 
                                    "type": "TextBlock", 
                                    "text": "ArcGIS Velocity ", 
	                                   "wrap": true 
                                } 
                            ], 
                            "spacing": "Small", 
                            "verticalContentAlignment": "Center" 
                        } 
                    ] 
                }, 
                { 
                    "type": "TextBlock", 
                    "targetWidth": "AtLeast:Narrow", 
                    "text": "Vessel Name " + $feature.name + ", traveling at " + $feature.speed + " miles per hour, was detected entering the service territory.\n \nClick the link below to see additional information.", 
                    "wrap": true 
                }, 
                { 
                    "type": "ActionSet", 
                    "actions": [ 
                        { 
                            "type": "Action.OpenUrl", 
                            "title": "Open", 
                            "url": "https://www.esri.com/en-us/arcgis/products/arcgis-velocity/overview" 
                        } 
                    ] 
                } 
            ], 
            "$schema": "https://adaptivecards.io/schemas/adaptive-card.json" 
        } 
    }] 
})

Example 2 creates the following message about a newly detected vessel, including the vessel name, date and time, and a button for additional information.

New vessel message generated in Teams

Parameters

The following are the parameters for the Microsoft Teams output:

ParameterDescriptionData type

Microsoft Teams webhook URL

(Required)

The incoming webhook URL created in Microsoft Teams.

String

POST body

(Required)

The JSON Arcade expression. The JSON must be formatted using the Microsoft Teams Adaptive Card format and must be wrapped in the Text() Arcade expression.

Arcade Expression

Additional logging

(Optional)

You can optionally enable logging for raw HTTP requests and responses generated by Velocity.

Note:

This parameter should only be enabled for troubleshooting purposes and disabled once troubleshooting is complete. When enabled, start the analytic and the debug level logs are available on the analytic logs page. If you need assistance with troubleshooting, contact  Esri Technical Support.

Boolean

Considerations and limitations

The following are considerations and limitations when using this output:

  • It is important to understand the velocity of the data. Each record sent to this output generates a separate request, and if more than four requests are made in a second, the client connection can be throttled. The best practice is to use this output for incidents that are expected to occur infrequently.
  • It is important to understand the message being sent. The current message size limit is 28 KB. If the message size exceeds this limit, you will receive an error.

Refer to creating incoming webhooks for more information.