Custom Webhooks

JFrog Platform Administration Documentation

Content Type
Administration / Platform
ft:sourceType
Paligo

Note

Custom webhooks were introduced in Artifactory 7.50.3.

  1. Navigate to Administration Module | General | Webhooks, if you use the classic navigation.

    Select Platform Management| Webhooks.

  2. Click New Webhook.

    webhooks_main.png
  3. Click the Custom toggle.

    CustomWebhook.png
  4. Enter the name and description of the webhook.

  5. Enter the URL that the webhook invokes.

    For example: https://api.github.com/repos/myrepo/actions/workflows/artifact_deployed.yml/dispatches

  6. Select the HTTP method that the webhook should use.

    You can choose from POST, PUT, GET, PATCH, and DELETE. The default selection is POST.

    Prior to Artifactory version 7.80.0, custom webhooks could be used only the POST method like predefined webhooks.

  7. Select a proxy server from the list of configured proxy servers in the Use Proxy dropdown if you want to send the webhook through a proxy.

    Applicable only for a self-hosted JFrog Platform installation

  8. Select whether to show the results of the successful execution of the webhooks in the Troubleshooting tab.

    Note

    JFrog Cloud: Applicable only if Webhooks troubleshooting is available in your JFrog Cloud instance.

    JFrog Self-hosted: Applicable only if you configured Webhooks Troubleshooting.

  9. Select the events that should trigger the webhook.

    Events drop-down lists the events in Artifactory, Xray, and Distribution that function as the event trigger for the Webhook.

    You can select multiple events from the list.

    You can apply certain events to repositories, builds, and Release Bundles.

    You can apply events such as Artifact was deployed, moved, and added on every repository in Artifactory or on a list of specific repositories, based on a specific list or by using include/exclude patterns.

    Note

    If you select any local and/or remote repository, the webhook is applied on all existing repositories and any repositories you create in the future.

    image2020-6-21_14-1-31.png

    You can apply events such as build was deployed, promoted, and deleted on every new build that is uploaded to Artifactory or on a list of specific builds, based on a specific list or by using include/exclude patterns.

    image2020-6-21_14-2-32.png

    You can apply Release Bundle and Distribution events on every new Release Bundle or on a list of specific Release Bundles, based on a specific list or by using include/exclude patterns.

    Exclude:Include Patterns in Webhooks Build Page.png
  10. Add secrets to the webhook if required.

    Defines a set of sensitive values (such as, tokens and passwords) that can be injected in the headers and/or payload. The values of the secrets are encrypted.

    Invoke the value In the header/payload using the {{.secrets.token}} format, where token is the name provided for the secret value.

    Click Add Secret to add more than one secret.

    Note

    It is possible to update the value of a secret (when a password changes, or a token expires) using the Update Webhook Subscription by Key REST API:Update Webhook Subscription by Key

    PUT /event/api/v1/subscriptions/<sub-key>/secrets/<secret-name>

    Authorization: Bearer <admin token>

    Content-Type: text/plain

    <secret-value>

  11. Add HTTP headers you wish to use to invoke the webhook.

    Click Add Header to add more than one header.

  12. Enter the custom payload that you want to send to the target service.

    In the payload, you can invoke values using dotted-syntax.

    Example

    {
        "ref": "main",
        "inputs": {
            "artifact_path": "{{.data.repo_key}}/{{.data.path}}"
        }
    }

    To know what values can be injected in the payload (as well as in HTTP headers), see Event Types.

  13. Click Test to test the configuration.

    Sends a fake HTTP request to the target URL and verify that the webhook is working fine.

  14. Click Create to save the webhook configuration.

    Note

    By default, private networks are not allowed to be used as Webhook targets for security reasons. If you would like to allow use of a private network, change the URL strict policy configuration in the system.yaml file: urlStrictPolicy: true. See Artifactory System YAML.Artifactory System YAML