3

I have a Microsoft Teams webhook which will alert me when a TeamCity build has failed. I am wondering how I would be able to get the URL of the current TeamCity build so I can pass this information to my webhook.

Jon
  • 8,205
  • 25
  • 87
  • 146

1 Answers1

6

Only using parameters at hand, you could build the uri back to the build log: %teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%

If you're using a MessageCard, this would make the potentialAction field of the payload to something like:

"potentialAction": [
    {
        "@type": "OpenUri",
        "name": "View in TeamCity",
        "targets": [
            {
                "os": "default",
                "uri": "%teamcity.serverUrl%/viewLog.html?buildId=%teamcity.build.id%"
            }
        ]
    }
]

Anything fancier would require a call to the TeamCity REST API

Fluffy
  • 857
  • 1
  • 9
  • 20