首页 > 解决方案 > 任务模块显示具有 validDomain 的空白团队

问题描述

所以我在我的机器人框架上发送了一张带有提交动作的自适应卡片,提交动作调用了动作。当 TaskModuleContinueResponse 设置为 card 时,任务模块工作正常,但是当我将我的 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 上没有看到对我的页面的任何请求。这里有什么遗漏吗

标签: c#asp.net-corebotframeworkmicrosoft-teams

解决方案


我已经尝试过使用您的代码,它可以正常工作。

在此处输入图像描述

https://b0837b7151f7.ngrok.io/details当您调用 using并尝试通过生成新的 ngrok Url 来呈现页面时,请在浏览器中检查您的反应页面是否在浏览器中正确呈现。

还可以通过在任务模块工作示例中添加您的反应页面 url 来检查。

如果问题仍然存在,请尝试删除现有应用并在团队应用工作室中再次上传您的清单。


推荐阅读