Poul K. Sørensen
Poul K. Sørensen

Reputation: 17540

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

    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.

Upvotes: 0

Views: 559

Answers (2)

YManaf
YManaf

Reputation: 61

Short and sweet response: MS Bot does not support HTML, use MarkDown instead => https://learn.microsoft.com/en-us/azure/cognitive-services/qnamaker/reference-markdown-format. However, not all the HTML element are available, below an example with hyperlink.

turnContext.SendActivity("[LINK TITLE](URL)");

Upvotes: 1

Subhasish
Subhasish

Reputation: 509

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

Upvotes: 2

Related Questions