2

We implemented a simple Azure bot using a QnA Maker knowledge base and we enabled the Teams channel.

In the webChat, the markdown formatting is rendered just fine. However in Teams the markdown formatting is not always working as expected:

  • If there is not any prompt in the answer, the formatting is perfect
  • If there is a prompt in the answer, the Markdown formatting is not rendered as expected

I attach the link of a screenshot illustrating the issue: Screenshot Illustrating the issue

Did you already experience this issue? Any idea about how we could fix this?

Thanks in advance for your help!

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24

2 Answers2

2

There isn't a way to format normal text messages in Teams. If you want to apply formatting, you need to rather look at sending one of the supported types of Cards, such as Adaptive Card, which supports Markdown. More can be seen here, in particular about newline.

If you're only really worried about newline characters, you could consider splitting it up in your bot, and sending multiple text messages. It's not clear what the "prompt text" button is from your example though - if you want more info on that, please supply more information.

Hope that helps

Hilton Giesenow
  • 9,809
  • 2
  • 10
  • 24
  • Thank you for your explanations. I simply created the QnA Maker knowledge base and then created the bot without doing any code from Azure. I have now access to the source code but I do not know how to change the cards used in Teams Channel... The "prompt" is the multi turn feature proposed by QnA maker. When a user asks a question, the answers can include a button redirecting to another response. We can see the button in my example. As long as there is no prompt in the answer, the formatting renders well in Teams - however if there is one the formatting does not work. Hope that clarifies – Valentin Mazhar Feb 21 '20 at 13:25
  • ah ok, I understand. There is indeed, as you've seen, a proper set of source code and a running application working in Azure, which is basically a starting point to work from. Do you have skills yourself/your team to make any code changes that might be needed? – Hilton Giesenow Feb 21 '20 at 14:37
  • I managed to find how to customize some default messages (hello, no answer, etc...), but unfortunately haven't yet managed to understand much more. I have really basic skills in terms of programming and am currently following some Azure tutorials to try to understand the architecture of the code - some resilience is going to be needed :) In this case the problem is quite specific, the formatting issue appears only in Teams channel, not in the webchat, and only if there is a prompt in the answer. I guess this should help me to locate the problem in code... – Valentin Mazhar Feb 21 '20 at 14:49
  • It's important also to know that, while in theory things should kind of match 100%, different environments can and do render some things differently - that's what you're seeing here between webchat & Teams. It's definitely worthwhile getting a bit up to speed on the basics of the code though, so it's good to hear you're digging in! – Hilton Giesenow Feb 21 '20 at 15:07
  • Yes I can see that... I have finally managed to modify the code to use adaptive cards. And you were right, the formatting renders perfectly with Markdown in MS Teams, thanks for spotting it out! I still have an issue though: I am adding SubmitActions to the adaptive cards using Action.Add method which renders well. However to use the "imBack" datatype for MS teams I am meant to add a JSON object to the Data field of the submit action ({ "msteams": { "type": "imBack", "value": "Text to reply in chat" } } }) but I don't manage to that in C#. It seems like I can only add a normal string... – Valentin Mazhar Feb 22 '20 at 14:00
  • great, glad to hear! This is getting a lot "comments" block, so let's do the following: the original answer helped, so please "mark as answer" so it can help others in the same situation, and let's discuss the "SubmitAction" as a separate question, so it's also more clear. – Hilton Giesenow Feb 22 '20 at 16:15
  • Anyone notice that Adaptive Card markdown was rendering last week, but it's not rendering this week? – Joe Mayo Mar 27 '20 at 21:09
  • I checked this yesterday and it was fine, but I wasn't looking extensively – Hilton Giesenow Mar 28 '20 at 16:45
1

I am able to use HTML for formatting. It seems to work better for me than anything else. Occasionally QnaMaker will mess up the formatting, and I have to correct it again, but generally it works.