自适应卡不适用于Microsoft Teams

时间:2019-12-13 06:23:02

标签: c# azure botframework microsoft-teams adaptive-cards

我有一个自适应卡,其中我使用日期选择器自适应卡从用户那里获取日期。我已经为我的Web客户端运行了代码,该代码运行得很好,现在,当我使用Microsoft Teams的Azure渠道集成代码时,该机器人可以正常运行,我也可以看到自适应卡,但是在填写日期后按Submit按钮在自适应卡上,我收到此错误

[11:39 AM] mts-bot
    Microsoft.Bot.Schema.ErrorResponseException: Operation returned an invalid status code 'BadRequest'
at Microsoft.Bot.Connector.Conversations.ReplyToActivityWithHttpMessagesAsync(String conversationId, String activityId, Activity activity, Dictionary2 customHeaders, CancellationToken cancellationToken) at Microsoft.Bot.Connector.ConversationsExtensions.ReplyToActivityAsync(IConversations operations, String conversationId, String activityId, Activity activity, CancellationToken cancellationToken) at Microsoft.Bot.Builder.BotFrameworkAdapter.SendActivitiesAsync(ITurnContext turnContext, Activity[] activities, CancellationToken cancellationToken) at Microsoft.Bot.Builder.TurnContext.<>c__DisplayClass22_0.<<SendActivitiesAsync>g__SendActivitiesThroughAdapter|1>d.MoveNext() --- End of stack trace from previous location where exception was thrown --- at Microsoft.Bot.Builder.TurnContext.SendActivityAsync(IActivity activity, CancellationToken cancellationToken) at Microsoft.BotBuilderSamples.DispatchBot.ProcessLeaveApplicationLUIS(ITurnContext1 turnContext, LuisResult luisResult, CancellationToken cancellationToken) in D:\nikhil\Alfi\mts-qna+luis\Bots\DispatchBot.cs:line 897

我一直在努力寻找解决此问题的方法,因此我遵循了上面所说的内容- Chat BoT Exception: OnTurnAsync exception-- Operation returned an invalid status code 'BadRequest'

有人告诉您这样做

var reply = new Activity();

var reply = turnContext.Activity.AsMessageActivity(); 

在onMessageActivityAsync方法中,但是我没有像这样发送回复,而是正在发送响应

await turnContext.SendActivityAsync(MessageFactory.Text("Hi how are you?"), cancellationToken);

真的希望能有一个快速的解决方案,我已经在Microsoft中提出了这个支持请求,票务编号为17896525,但是已经有两天没有从那里得到解决方案了。

1 个答案:

答案 0 :(得分:0)

要在团队中呈现自适应卡,我们需要更新json文件中按钮的数据部分。

用于网络聊天的

            "type": "Action.Submit",
            "data": "Your Button Data",
            "title": "feedback"
          }

对于MS团队:

            "type": "Action.Submit",
            "data": {
              "msteams": {
                "type": "imback",
                "value": "Poor"
              }
            },
            "title": "feedback"
          }```