Adding Some Colour to Microsoft Teams Notifications

Now that the basic link is in place between On-Premise TFS and Microsoft Teams it’s time to tinker.

The first thing that I wanted to do was add some visual feedback to the notifications, specifically notifications for builds.

This can be achieved by adding the “themeColor” property to our output (the Card Reference documentation suggests not to use this for status, but it works well enough )

I want two new statuses, failed build should be red whilst partial failures should be orange.

To do this I needed to update the output section for each endpoint as below:

Build Failure

var output = {};

output["title"] = "Build Failed";
output["text"] = detail;
output["themeColor"] = "ff0000";

Partial Build Failure

var output = {}; 

output["title"] = "Build Partial Failure";
output["text"] = detail;
output["themeColor"] = "ff9900";

This results in a nice visible orange and red bar at the top of each post:

build-failure-coluration

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s