Custom Webhooks Payload Templates

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

JFrog Custom Webhooks use a similar payload templating to Golang text templates, but are limited in that they only support two actions. In payloads, you can:

  • Display dynamic scalar values by rendering a textual representation for the variables: For example, {{ variable_name }}.

  • Use json or yaml functions on an object to convert them into JSON or YAML format, to prepare the object for transmission or storage. For example, {{ json object_name }}.

Two root objects are supported: data and secrets.

Root Object

Description

Example

data

An object containing the payload specific to the event, as defined in Event Types.

"{{ .data.build_name }}"

In a “build promoted” event, this will contain the build name.

secrets

An object containing all the secrets you have defined for this webhook.

"{{ .secrets.my_secret }}"

This will render the secret name my_secret.

Example

To create a custom webhook to automate Kubernetes deployments as part of this workflow, you can use this payload template:

{
    "event_type" : "hot-deploy",
    "client_payload" :  {
        "tag" : "{{ .data.tag }}"
    }
}