Danial Aftab
Danial Aftab

Reputation: 139

How can you style skype for business html messages while using the bot framework?

I've made a bot using the bot framework by microsoft, i know we can send html messages but css doesn't work. Html messages look really dull and i want to apply some sort of styling to style tables/links. Is this possible?

Upvotes: 0

Views: 1162

Answers (2)

Megan
Megan

Reputation: 1150

I know this question has been addressed, but I noticed you mentioned you're using HTML tables.

I was able to successfully style tables in my bot by using inline CSS like this for example:

<table style="border-collapse: collapse; border: 1px solid black; text-align: center;">

<tr>
<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>
</tr>

<tr bgcolor="#84fd8c">
<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

<td style="border: 1px solid black; text-align: center; padding: 8px;">
<b>Column</b>
</td>

</tr>

</table>

I made a style using this technique in JSFiddle and then used a string builder to construct the table with the styling I wanted in my bot code. Here is an example of how this type of table looks in Microsoft Teams: enter image description here

Upvotes: 2

Clint
Clint

Reputation: 6220

Microsoft have some documentation on how to achieve this:

Rich Messages

It allows you to use the following:

  1. Markdown
  2. Attachments
  3. Cards

And more! All fairly standard interactions and message formats across a bunch of channels (e.g. slack etc).

I really would recommend a quick search through MSFT's documentation on the bot framework next time, as then article wasn't terribly difficult to find.

Upvotes: 1

Related Questions