Microsoft Teams Notificaitons CSS Styling

Viewed 216

Is there a way to style Teams Notifications?

Posting to a WebHook the following works:

                string _html = @"<table width='100%'>
                              <tr>
                                <th>Service</th>
                                <th>2 hours</th>
                                <th>4 hours</th>
                                <th>8 hours</th>
                                <th>24 hours</th>
                                <th>48 hours</th>
                              </tr>
                              <tr style='background-color: #1a1a1a;'>
                                <td>2343</td>
                                <td>132</td>
                                <td>43</td>
                                <td>12</td>
                                <td>132</td>
                                <td>532</td>
                              </tr>
                              </table>";
            
            var values = new Dictionary<string, string>{
                {"themeColor", "ffd11a"},
                { "title", "My Title" },
                { "textFormat", "markdown" },
                { "text",  _html }
            };

            var json = JsonSerializer.Serialize(values);
            var stringContent = new StringContent(json);
            var response = await client.PostAsync(webhookUrl, stringContent);

however when I try to add <style> tag it no longer works, and it seems that only 'inline' styles work. Is there a way to add CSS to Teams Notifications Webook?

0 Answers
Related