Webhook
The Webhook Integration introduces a generic way to post messages from Unleash to third party services. Unleash allows you to define a webhook which listens for changes in Unleash and posts them to third party services.
The webhook will perform a single retry if the HTTP POST call fails (either a 50x or network error). Duplicate events may happen, and you should never assume events always comes in order.
Configuration
Events
You can choose to trigger updates for the following events (we might add more event types in the future):
- feature-created
- feature-metadata-updated
- feature-project-change
- feature-archived
- feature-revived
- feature-strategy-update
- feature-strategy-add
- feature-strategy-remove
- feature-stale-on
- feature-stale-off
- feature-completed
- feature-environment-enabled
- feature-environment-disabled
- feature-variants-updated
- feature-tagged
- feature-untagged
- change-request-created
- change-request-discarded
- change-added
- change-discarded
- change-request-approved
- change-request-approval-added
- change-request-cancelled
- change-request-sent-to-review
- change-request-applied
- change-request-scheduled
- change-request-scheduled-application-success
- change-request-scheduled-application-failure
- change-request-schedule-suspended
- feature-potentially-stale-on
- release-plan-progressions-paused
- release-plan-progressions-resumed
- feature-updated (deprecated in v4.3)
Parameters
The Webhook integration takes the following parameters:
The URL that Unleash sends an HTTP POST request to for each event. The URL must use http or https. If you use a Slack application, make sure it can post to the target channel. For URLs on a private network, see Private network URLs.
The value of the Content-Type header in the request.
The value of the Authorization header in the request. Unleash sends the value exactly as you enter it, so include the scheme yourself if your endpoint expects one, for example Bearer <token>. If you leave this empty, Unleash doesn’t send an Authorization header.
Additional headers to send with the request, as a JSON object whose keys and values are strings, for example {"X-Api-Key": "your-api-key"}. To override the Content-Type or Authorization parameter, add a header with exactly that name, including capitalization. If the value isn’t valid JSON, Unleash sends the request without the extra headers and records the integration event as having errors.
A Mustache template for the request body. If you leave this empty, Unleash sends the event in the Unleash event format. See Body template.
Unleash treats Webhook URL, Authorization, and Extra HTTP Headers as sensitive and masks their values after you save the integration.
Body template
You can format the request body with a Mustache template. The template has access to the following variables:
event: The event, in the Unleash event format shown below. For example,{{event.type}}or{{event.data.name}}.eventJson: The whole event, serialized as a JSON string. Use triple braces,{{{eventJson}}}, so that Mustache doesn’t escape it. The rendered value includes its own surrounding quotes, so don’t add quotes around it.eventMarkdown: A formatted Markdown description of the event. Inside a quoted JSON string, such as"{{eventMarkdown}}", Unleash escapes the description so that the body stays valid JSON.
Example:
If you don’t specify a template, Unleash sends the event in the Unleash event format:
Private network URLs
Unleash rejects a webhook URL whose hostname resolves to a private or reserved network address, such as a loopback address or an address in 10.0.0.0/8 or 192.168.0.0/16. Unleash also rejects a hostname that doesn’t resolve.
If you self-host Unleash and your webhook endpoint is on a private network, set one of the following environment variables on the Unleash server:
UNLEASH_ALLOW_LIST_INTEGRATION: A comma-separated list of hostnames to allow, for examplen8n.internal.example.com. Unleash matches the hostname exactly, ignoring case.UNLEASH_ALLOW_PRIVATE_URL_IN_INTEGRATION: Set totrueto allow every private network address.
Prefer the allowlist, which only opens the hosts that you name.
Custom SSL certificates
If your webhook endpoint uses a custom SSL certificate,
you will need to start Unleash with the NODE_EXTRA_CA_CERTS environment variable set.
It needs to point to your custom certificate file in pem format.
For more information, see the official Node.js documentation on setting extra certificate files.