resources.webhooks.webhook.filters.filter definition

Filters used to customize the triggers for a webhook event.

filters:
- path: string # Required as first property. json path to select data from event payload.
  value: string # Required. Expected value for the filter to match.

Definitions that reference this definition: resources.webhooks.webhook.filters

Properties

path string. Required as first property.
json path to select data from event payload.

value string. Required.
Expected value for the filter to match.

Examples

For subscribing to a webhook event, you need to define a webhook resource in your pipeline and point it to the Incoming webhook service connection. You can also define additional filters on the webhook resource based on the JSON payload data to further customize the triggers for each pipeline, and you can consume the payload data in the form of variables in your jobs.

resources:
  webhooks:
    - webhook: MyWebhookTrigger          ### Webhook alias
      connection: MyWebhookConnection    ### Incoming webhook service connection
      filters:
        - path: repositoryName      ### JSON path in the payload
          value: maven-releases     ### Expected value in the path provided
        - path: action
          value: CREATED
steps:
- task: PowerShell@2
  inputs:
    targetType: 'inline'
    ### JSON payload data is available in the form of ${{ parameters.<WebhookAlias>.<JSONPath>}}
    script: |
      Write-Host ${{ parameters.MyWebhookTrigger.repositoryName}}
      Write-Host ${{ parameters.MyWebhookTrigger.component.group}}

See also