如何为Teams Bot使用MessagingExtensionActionResponse返回简单的html响应 [英] How to return simple html response with MessagingExtensionActionResponse for a Teams Bot

查看:106
本文介绍了如何为Teams Bot使用MessagingExtensionActionResponse返回简单的html响应的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

    protected override Task<MessagingExtensionActionResponse> OnTeamsMessagingExtensionSubmitActionAsync(
        ITurnContext<IInvokeActivity> turnContext, MessagingExtensionAction action, CancellationToken cancellationToken)
    {


        return Task.FromResult(new MessagingExtensionActionResponse
        {

            ComposeExtension = new MessagingExtensionResult
            {

                 Type = "message",                     
                 Text ="<div><pre>Hello</pre></div>" 
            }
        });

    }

我不希望英雄卡占用空间,就像上面的示例一样,只是简单的普通HTML响应,但是我不知道该怎么做.上面的示例不起作用.

I dont want a hero card that takes up space, just simple plain HTML response like the example above, but i dont know how to do it. The above example dont work.

推荐答案

当前OnTeamsMessagingExtensionSubmitActionAsync方法不支持html响应.它具有以下响应选项.

Currently OnTeamsMessagingExtensionSubmitActionAsync method does not support html response .It has the following options for responding.

  • 无响应-您可以选择使用Submit操作来触发 在外部系统中进行处理,并且不提供任何反馈给 用户.这对于长时间运行的流程很有用,您可能 选择以其他方式提供反馈(例如,通过 主动消息.
  • 另一个任务模块-您可以使用 作为多步骤交互的一部分的附加任务模块.
  • 卡响应-您可以使用卡进行响应,然后用户可以进行交互 与和/或插入消息中.
  • 来自机器人的自适应卡-将自适应卡直接插入对话中.
  • 请求用户进行身份验证
  • 请求用户提供其他配置
  • No response - You can choose to use the submit action to trigger a process in an external system, and not provide any feedback to the user. This can be useful for long-running processes, and you may choose to provide feedback in another manner (for example, with a proactive message.
  • Another task module - You can respond with an additional task module as part of a multi-step interaction.
  • Card response - You can respond with a card that the user can then interact with and/or insert into a message.
  • Adaptive Card from bot - Insert an Adaptive Card directly into the conversation.
  • Request the user authenticate
  • Request the user provide additional configuration

查看全文

登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆