Reputation: 101
I am using Bot framework to build bot.
I am using the following line to send the response to user:-
dc.Context.SendActivityAsync(activity);
In teams the response from bot to user in black text.
Do we have a feature to send text to user in different Color(like red, blue...).
Please help.
Thanks.
Upvotes: 1
Views: 1793
Reputation: 1066
In Ms Teams markdown text messages support colors using XML
Example markdown message content:
This is **bold** text and this is _italic_ and a [link](http://link.com)
<span style="color:blue">colors in text: **blue** text</span>.
<span style="color:red">colors in text: **red** text</span>.
<span style="color:#c200ff">hexa **violet** (#c200ff) color in text</span>.
Looks like this in MsTeams
Adaptive cards have very limited markdown support. So that's why it is very important that the markdown content is sent in the Activity's text field and the text format must be set to "markdown"
[Activity
Text = ${content}
TextFormat=markdown
]
Headings using the markdown format "#" "##" and "###" work in msteams too!
I hope this info saves someone a huge headache :)
Upvotes: 0
Reputation: 10844
Following some of the conversation in the comments above, here's a more complete answer:
There's no way to set the color or style of the text in a normal "text" message - to do that, you need to use an Adaptive Card. Adaptive Cards don't have "real" colours in the normal sense (like you don't choose "red" or "blue" or hex code or anything like that), but they support use cases like "good" or "warning", and the environment in question (i.e. Teams in this case) will render that appropriately, based on the user's theme (so it will have an appropriate way to display "warning" in light theme, dark theme and high contrast theme).
You can see more about this here. Aside from that, Adaptive Cards also support some limited markdown format for things like bold and italics - see here.
As a final option, you can use the backgroundimage property of the card to represent certain features. For instance, in a "success" scenario you might want to have a background image that represents that.
Hope that helps.
Upvotes: 3