Skip to content

WebHook Templates : Anatomy of a Template

netwolfuk edited this page Nov 10, 2017 · 14 revisions

WebHook Template Anatomy

A WebHook Template consists of some attributes about a template and a set of build event templates which are mapped to teamcity build events.

WebHook Template Attributes

Name Type Example Value Description
id string slack.com-compact A unique id for this template. Used to link webhooks to templates
enabled bool true Disabling a template prevents it from being available for webhooks (to be implmented)
rank int 100 Determines a templates place in the list when creating a webhook (smallest at the top)
format string jsonTemplate Format of template content. Only jsonTemplate is supported

Build Event Templates

A template can contain multiple build event templates. A build event template contains the webhook payload and a list build events to which it relates. Eg, If the same payload is to be sent for both buildStarted and changesLoaded, then the build event template would contain references to both build events. A build event can only belong to one build event template at a time.

There is a special type of build event called the "default build event template". This optional template is the one used if no other template has a build event attached to it. If no default build event template is defined, then the webhook template will only support build events for which there is build event template attached.

WebHook Build Event Template Attributes

Name Type Example Value Description
id int 1 Used internally to identify build event templates
template string { "buildState" : "${buildState}" } The payload content
branch-template string { "buildState" : "${buildState}", "branchName" : "${branchName}" } The payload content for builds which run from a VCS with with Feature Branch support enabled
use-template-for-branch-template bool false Use the template for all builds, and ignore branch-template.
Clone this wiki locally