How to return simple html response with MessagingExtensionActionResponse for a Teams Bot

左心房为你撑大大i 提交于 2020-05-14 03:49:00

问题


    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>" 
            }
        });

    }

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.


回答1:


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

  • 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

Doc Link



来源:https://stackoverflow.com/questions/61421840/how-to-return-simple-html-response-with-messagingextensionactionresponse-for-a-t

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!