Mattias Karlsson

@devlead

🛠AppVeyor -> Microsoft Teams📣

Getting your AppVeyor build status notifications to a Microsoft Teams channel

Currently AppVeyor doesn’t out of the box support notifications to Microsoft Teams and Teams doesn’t have an connector ready that supports the default AppVeyor webhook payload.

But AppVeyor do support a generic custom webhook, which lets you using templates customize the webhook body payload to basically fit any http service, without the need for a in-the-middle proxy/transforming service.

In this post guide you through the process of setting up a custom webhook to enable AppVeyor to communicate with Microsoft Teams.

First you need to on the Teams channel you want to get notifications for add an generic incoming webhook

Team-> Channel-> Connectors -> Incoming Webhook

You do this by clicking on the “…” after the channel, connectors, choosing a name, optionally a custom icon and then hitting “Create”. Once created you’ll have an unique incoming webhook for the chosen channel.

Then it’s off to AppVeyor where you under a project’s settings notification section choose “Add notification”

Custom Webhook
  • Pick the “Webhook” option
  • Method “POST”
  • Enter your Teams webhook url
  • Check “Add custom request body”
  • Use “application/json” as custom request body Content-Type header
  • Enter a mustache template to transform the default payload to a Teams Message Card
  • Check which statuses you want notifications for

Then it’s just a matter of hitting save and you’re done. You can go as crazy as you want with the message templates, this is the one I use, feel free to steal it:

This will generate an message looking roughly like this:

Microsoft Teams AppVeyor build status notification

If you’re configuring AppVeyor using a yml file, it’s certainly possible to add your Teams notification there, here’s an example appveyor.yml file:

To summarize, it’s just a few steps to enable status notifications and with a little effort you can tailor their appearance to include the information you need!

PS.
If you have allot of projects you can automate the process using something like PowerShell, which I’ve blogged about in previous posts

.DS

More by Mattias Karlsson

Topics of interest

More Related Stories