Microsoft Teams

通过 ArcGIS Velocity 中的 Microsoft Teams 输出,您可以将自适应卡片发送至 Microsoft Teams 中的聊天或频道。 自适应卡可以包含文本、图形和按钮,提供一种交互式且吸引人的机制以供交流信息。  使用 Velocity 时,可以在发布到 Microsoft Teams 的自适应卡片中包含要素数据。 这是一种跨不同系统与用户有效交流信息的机制。

要使用此输出类型,必须首先在 Microsoft Teams 中生成 webhook URL。 此 webhook URL 后续将用于配置 Velocity 中的 Microsoft Teams 输出。

示例

以下是 Microsoft Teams 输出的使用示例:

一名分析员配置了一个实时分析,以便在严重天气预警与组织的服务区域重叠时,将自适应卡片发布到 Microsoft Teams 频道。

用法说明

使用 Microsoft Teams 输出时,请考虑以下内容:

Microsoft Teams 自适应卡片 JSON 示例

格式化 JSON 请求正文时,使用 Text() Arcade 函数包装输出 JSON 以正确格式化 JSON。 JSON 必须是具有以下属性的 Microsoft Teams 自适应卡片格式:

  • type 字段必须设置为 message
  • attachments 阵列包含一组卡片对象。
  • contentType 字段必须设置为 Adaptive Card 类型。
  • content 对象是 JSON 格式的卡片。

下面的示例显示了配置为以 JSON 格式输出自适应卡的 Arcade 表达式。 生成的自适应卡片将发布到与 Microsoft Teams webhook URL 关联的聊天或频道。

下方示例创建了一个显示轮船信息(包括轮船名称和 ID)的基础自适应卡片。

示例 1 - 基础自适应卡片

 
 
// 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 
                    } 
                ] 
            }] 
        } 
    }] 
})

示例 1 创建了以下显示轮船信息的消息,包括轮船名称和 ID。

轮船信息

下面的示例会创建一个包含图像和按钮的自适应卡片。

示例 2 - 包含图像和按钮的自适应卡片

 
 
// 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" 
        } 
    }] 
})

示例 2 创建了有关新检测到的轮船的以下消息,包括轮船名称、日期和时间以及用于提供附加信息的按钮。

Teams 中生成了新轮船消息

参数

以下是 Microsoft Teams 输出的参数:

参数描述数据类型

Microsoft Teams webhook URL

(必填)

Microsoft Teams 中创建的传入 webhook URL。

字符串

POST 正文

(必填)

JSON Arcade 表达式。 JSON 必须使用 Microsoft Teams 自适应卡片格式进行格式化,并且必须包装在 Text() Arcade 表达式中。

Arcade 表达式

其他日志记录

(可选)

可以选择为 Velocity 生成的原始 HTTP 请求和响应启用日志记录。

注:

仅当进行故障排除时,才应启用此参数,并且应在完成故障排除时禁用。 如果在启用参数后启动分析,调试级别日志即会出现在分析日志页面上。 如果需要故障排除方面的帮助,请联系 Esri 技术 支持

布尔

注意事项和限制

下面是使用此输出时的注意事项和限制:

  • 了解数据的速度至关重要。 发送到此输出的每个记录都会生成一个单独的请求,如果在一秒钟内发出四个以上的请求,则可以限制客户端连接。 最佳做法是将此输出用于不经常发生的事件。
  • 理解所发送的消息十分重要。 当前消息大小限制为 28 KB。 如果消息大小超过此限制,您将收到错误提醒。

有关详细信息,请参阅创建传入 webhook