具有任意可iframe网站内容的Microsoft Teams Bot任务模块?

时间:2019-11-28 21:52:43

标签: microsoft-teams

我有一个C#机器人,该机器人已经使用SDK使用自适应卡来创建任务模块,但是我想尝试使用任意Web内容进行尝试。我已经创建了这样的Continue响应(只是将可访问Internet的IIS页面作为要测试的URL):

 {
    "Status": 200,
    "Body": {
        "task": {
            "value": {
                "title": "webTest",
                "url": "https://icechris.computertalkrnd.com/iisstart.htm",
                "card": null,
                "fallbackUrl": "https://icechris.computertalkrnd.com/iisstart.htm",
                "completionBotId": "BOT_ID"
            },
            "type": "continue"
        }
    }
}

如果我退回了一张自适应卡,我的回答如下:

{
    "Status": 200,
    "Body": {
        "task": {
            "value": {
                "title": null,
                "height": null,
                "width": null,
                "url": null,
                "card": {
                    "contentType": "application/vnd.microsoft.card.adaptive",
                    "contentUrl": null,
                    "content": {
                        "type": "AdaptiveCard",
                        "version": "1.0",
                        "body": [CARD BODY]
                    },
                    "name": null,
                    "thumbnailUrl": null
                },
                "fallbackUrl": null,
                "completionBotId": null
            },
            "type": "continue"
        }
    }
}

哪种渲染效果很好(为简洁起见,我剪切了卡片json)。

我的机器人清单中有以下内容用于有效域:

"validDomains": [ "*.computertalkrnd.com", "icechris.computertalkrnd.com", "computertalkrnd.com", "computer-talk.com" ]

是否不可能让任务模块显示这样的任意Web内容,还是在响应中缺少其他内容?我注意到没有为自适应卡设置completedBotID,但是对于网络情况,无论是否设置它都不会有所不同。

我确实调出了Teams中的开发工具,并在测试调用时注意到了这一点:

2019-11-28T21:32:51.245Z AppsService: getInstalledAppForUser - Invalid appId specified
(anonymous) @ angular.min.js:113
e.logMessage @ msteams-web-ng1-services.min.js:1
e.error @ msteams-web-ng1-services.min.js:1
t.getInstalledAppForUser @ msteams-web-ng1-services.min.js:1
t.getAppDefinitionFromCurrentContext @ msteams-web-ng1-services.min.js:1
t.getAppDefinitionFromCurrentContext @ msteams-web-ng1-services.min.js:1
t @ msteams-web-ng1.min.js:1
t @ msteams-web-ng1.min.js:1
invoke @ angular.min.js:36
R.instance @ angular.min.js:84
n @ angular.min.js:59
g @ angular.min.js:53
g @ angular.min.js:53
g @ angular.min.js:53
(anonymous) @ angular.min.js:52
(anonymous) @ 2-vendor.min-40cd418b.js:138
(anonymous) @ angular.min.js:154
e @ angular.min.js:40
(anonymous) @ angular.min.js:43
setTimeout (async)
Zf.k.defer @ angular.min.js:43
f @ angular.min.js:154
(anonymous) @ 2-vendor.min-40cd418b.js:138
f @ angular.min.js:126
(anonymous) @ angular.min.js:126
$eval @ angular.min.js:141
$digest @ angular.min.js:138
f.$digest @ msteams-web-ng1-services.min.js:1
$apply @ angular.min.js:141
(anonymous) @ angular.min.js:92
x @ angular.min.js:96
w.onload @ angular.min.js:97
load (async)
(anonymous) @ angular.min.js:97
r @ angular.min.js:93
g @ angular.min.js:90
f @ angular.min.js:126
(anonymous) @ angular.min.js:126
$eval @ angular.min.js:141
$digest @ angular.min.js:138
f.$digest @ msteams-web-ng1-services.min.js:1
(anonymous) @ angular.min.js:141
e @ angular.min.js:40
(anonymous) @ angular.min.js:43
setTimeout (async)
Zf.k.defer @ angular.min.js:43
$evalAsync @ angular.min.js:141
(anonymous) @ angular.min.js:125
g @ angular.min.js:126
then @ angular.min.js:127
t.markConversationAsRead @ msteams-web-ng1.min.js:1
(anonymous) @ msteams-web-ng1.min.js:1
$emit @ angular.min.js:143
n.$emit @ eventingService.min.js:1
a.invokeAppInUseEventIfNeeded @ appStateService.min.js:1
a.setPageVisible @ appStateService.min.js:1
(anonymous) @ appStateService.min.js:1
$emit @ angular.min.js:143
n.$emit @ eventingService.min.js:1
(anonymous) @ desktopEventsService.min.js:1
listenerWrapper @ C:\Users\cbardon\AppData\Local\Microsoft\Teams\current\resources\app.asar\lib\renderer\ipcRenderer.js:335
emit @ events.js:182
angular.min.js:113 TypeError: Cannot read property 'validDomains' of undefined

不过,从自适应卡的响应来看,我看不出两者之间有什么显着差异。

1 个答案:

答案 0 :(得分:0)

因此,我在机器人程序中没有做任何更改,但这开始起作用。第一篇文章中的代码是相同的(带有机器人ID)。唯一不同的是Teams客户端更新,因此也许应用程序中已修复某些问题?

您具有Microsoft Teams版本1.2.00.34111(64位)-E。上次更新时间为19/12/9。