botframework - 使用任务模块显示 Web 框架有困难 - Microsoft Bot Framework
问题描述
我遵循了微软文档。
从中,我了解到“我可以运行我自己的自定义 HTML/JavaScript 代码”并使用任务模块将其显示在团队中。
我已完成所有建议我的卡每次调用任务模块时显示为空白的事情。
我正在使用 BotBuilder-Sample Node JS SDK
teamTaskModuleBot.js 文件包含
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
const {
TeamsActivityHandler,
MessageFactory,
CardFactory,
} = require("botbuilder");
class TeamsTaskModuleBot extends TeamsActivityHandler
{
constructor ()
{
super();
// See https://aka.ms/about-bot-activity-message to learn more about the message and other activity types.
this.onMessage(async (context,next) =>
{
const card = this.getHeroCardMenu();
const message = MessageFactory.attachment(card);
await context.sendActivity(message);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
this.onMembersAdded(async (context,next) =>
{
const card = this.getHeroCardMenu();
const message = MessageFactory.attachment(card);
await context.sendActivity(message);
// By calling next() you ensure that the next BotHandler is run.
await next();
});
}
getHeroCardMenu ()
{
return CardFactory.heroCard(
"Task Module Invocation from Hero Card",
null, // No images
[
{
type: "invoke",
title: "Open",
value: {type: "task/fetch"},
},
]
);
}
handleTeamsTaskModuleFetch (context,taskModuleRequest)
{
// taskModuleRequest.data can be checked to determine different paths.
return {
task: {
type: "continue",
value: {
url: "https://botiframe.netlify.app/index.html",
height: "medium",
width: "medium",
title: "Task Module Bot",
fallbackUrl: "https://botiframe.netlify.app/index.html"
},
},
};
}
}
module.exports.TeamsTaskModuleBot = TeamsTaskModuleBot;
我的 manifest.json 文件
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.5/MicrosoftTeams.schema.json",
"manifestVersion": "1.5",
"version": "1.0.0",
"id": "208a91ef-baa9-460d-bf8d-7c7bc2f475e0",
"packageName": "com.dipolediamond.taskmodule",
"developer": {
"name": "dipoleDiamond Ltd",
"websiteUrl": "https://www.dipolediamond.com",
"privacyUrl": "https://www.dipolediamond.com/blog",
"termsOfUseUrl": "https://www.dipolediamond.com/contact"
},
"icons": {
"color": "icon-color.png",
"outline": "icon-outline.png"
},
"name": {
"short": "Task Module Bot",
"full": "Simple Task Module Bot"
},
"description": {
"short": "Test Task Module Sample Bot",
"full": "Simple Task Module Sample Bot"
},
"accentColor": "#FFFFFF",
"bots": [
{
"botId": "208a91ef-baa9-460d-xxxx-xxxxxxx",
"scopes": ["personal", "team", "groupchat"],
"supportsFiles": false,
"isNotificationOnly": false
}
],
"permissions": ["identity", "messageTeamMembers"],
"composeExtensions": [
{
"botId": "208a91ef-baa9-460d-xxxx-xxxx",
"canUpdateConfiguration": true,
"commands": [],
"messageHandlers": [
{
"type": "link",
"value": {
"domains":"www.botiframe.netlify.app"
]
}
}
]
}
],
"validDomains": ["www.botiframe.netlify.app"]
}
解决方案
在显示您的 Web 内容之前,Teams 会对结束地址进行一些基本验证。正如您所做的那样,这需要使用validDomains
和domains
部分注册域。但是,当我访问该站点时,我收到了一个证书错误,因此 Teams 很可能因此而阻止了你的站点。您是否能够解决该问题(自定义域或证书匹配域(证书适用于 *.netlify.com,但您的网站在 netlify.app 上运行)?首先尝试一下。
推荐阅读
- sql - SQL 有没有办法在“WITH”语句中使用变量?
- r - 从文本中删除字符串并放入单独的列中
- sql - 如何使用 DB2 函数查找字符串中每个字符的 ASCII?
- mysql - 在 MariaDB v. 10.1.xx 中将 VARCHAR 数据转换为 DATE
- c - 如何避免 sdl2 中的可见刷新
- python - 如何检查元素是否包含超过 3 个字符
- ruby-on-rails - 如何在构建 gem 原生扩展失败后安装 Nokogiri
- react-native - 从 api restful 填充 flatlist
- python - python selenium send_key() 不工作
- directory - 无论如何要重置 Julia 中的当前工作目录吗?