所以我在我的机器人框架上发送了一张带有提交操作的自适应卡片,该提交操作已调用操作。当 TaskModuleContinueResponse 设置为卡片时,任务模块工作正常,但是当我将我的 NRGROK URL 用于 TaskModuleContinueResponse 时,它只会显示为空白。我已经在有效域中添加了我的 NGROK URL,当我看到 NGROK 检查时,我没有看到我的页面被调用。 这是我的清单
{
"$schema": "https://developer.microsoft.com/en-us/json-schemas/teams/v1.9/MicrosoftTeams.schema.json",
"manifestVersion": "1.9",
"version": "1.0.0",
"id": "1c07cd26-a088-4db8-8928-ace382fa219f",
"packageName": "Some.microsoft.teams.companycommunicator.authors",
"developer": {
"name": "Some",
"websiteUrl": "https://somewebsite.com",
"privacyUrl": "https://somewebsite.com",
"termsOfUseUrl": "https://somewebsite.com"
},
"icons": {
"color": "color.png",
"outline": "outline.png"
},
"name": {
"short": "Announce (Authors)",
"full": "Company Announce (Authors)"
},
"description": {
"short": "Broadcast messages to multiple teams and people in one go",
"full": "Broadcasts messages to multiple teams and individuals through channel posts and chat messages"
},
"accentColor": "#64A2CC",
"configurableTabs": [
{
"configurationUrl": "https://b0837b7151f7.ngrok.io/configtab",
"canUpdateConfiguration": true,
"scopes": [
"team"
],
"context": [
"channelTab"
]
}
],
"bots": [
{
"botId": "eae687a6-936c-4fd7-ade7-1f01b388ac16",
"scopes": [
"team"
],
"commandLists": [
{
"scopes": [
"team"
],
"commands": [
{
"title": "Test",
"description": "Test bot trigger"
}
]
}
],
"supportsFiles": true,
"isNotificationOnly": false
}
],
"permissions": [
"identity",
"messageTeamMembers"
],
"validDomains": [
"b0837b7151f7.ngrok.io",
],
"webApplicationInfo": {
"id": "eae687a6-936c-4fd7-ade7-1f01b388ac16",
"resource": "api://b0837b7151f7.ngrok.io"
}
}
这是我使用 ASP Net core 的任务模块的代码
protected override async Task<TaskModuleResponse> OnTeamsTaskModuleFetchAsync(ITurnContext<IInvokeActivity> turnContext, TaskModuleRequest taskModuleRequest, CancellationToken cancellationToken)
{
var reply = MessageFactory.Text("OnTeamsTaskModuleFetchAsync TaskModuleRequest: " + JsonConvert.SerializeObject(taskModuleRequest));
await turnContext.SendActivityAsync(reply);
return new TaskModuleResponse
{
Task = new TaskModuleContinueResponse
{
Value = new Microsoft.Bot.Schema.Teams.TaskModuleTaskInfo()
{
//Card = CreateAdaptiveCardAttachment(),
Url = "https://b0837b7151f7.ngrok.io/details",
FallbackUrl = "https://b0837b7151f7.ngrok.io/details",
Height = 800,
Width = 1000,
Title = "Details",
},
},
};
}
对于我的页面来说只是简单的 hello world。
import React, { Component } from 'react'
import * as microsoftTeams from "@microsoft/teams-js";
export default class SeeDetail extends Component {
componentDidMount() {
microsoftTeams.initialize();
}
render() {
return (
<div>
<center>
<h1>Hello World</h1>
</center>
</div>
)
}
}
我不知道为什么它被阻止了或其他原因,因为我在 NGROK Inspect 上没有看到对我的页面的任何请求。这里有什么遗漏吗
答案 0 :(得分:1)
我已尝试使用您的代码,它可以正常工作。
当您使用 https://b0837b7151f7.ngrok.io/details
调用并尝试通过生成新的 ngrok Url 来呈现页面时,请在浏览器中检查您的 React 页面是否在浏览器中正确呈现。
还可以通过在 task module working sample 中添加您的 react 页面 url 来检查。
如果问题仍然存在,请尝试删除现有应用并在团队应用工作室中再次上传您的清单。
答案 1 :(得分:0)
我相信对于自适应卡片,您必须在此处的可操作消息仪表板中注册任何提交网址https://outlook.office.com/connectors/oam/publish