• Home
  • Integrations
  • SDKs
  • Guides
  • API docs
No results for ""
EXPAND ALL

EDIT ON GITHUB

Webhooks

Read time: 2 minutes
Last edited: Sep 24, 2021

Overview

This topic explains how to create and use webhooks in LaunchDarkly.

LaunchDarkly's webhooks allow you to build your own integrations that subscribe to changes in LaunchDarkly. When something changes, like when a feature flag is updated, or when an account member is invited to LaunchDarkly, LaunchDarkly sends an HTTP POST payload to the webhook's configured URL.

Use webhooks to update external issue trackers, update support tickets, notify customers of new feature rollouts, and more.

Creating a webhook

To create a webhook:

  1. Navigate to the Integrations page.
  2. Click on the Webhooks Integration button.
  3. (Optional) Give the webhook a human-readable Name.
  4. Enter an absolute URL.
  5. If you want the webhook to be signed, check the Sign this webhook checkbox. To learn more, read Signing webhooks.
  6. Add a policy if you want to select and filter the events sent to the webhook. To learn more, read Adding a policy filter.
  7. After reading the Terms and Conditions, check the I have read and agree to the Integration Terms and Conditions checkbox.
  8. Click Save Settings:

The webhook configuration screen.
The webhook configuration screen.

Signing webhooks

When creating a webhook, you can define an optional secret. If defined, the webhook POST request will include an X-LD-Signature header, whose value will contain an HMAC SHA256 hex digest of the webhook payload, using the secret as the key.

Compute the signature of the payload using the same shared secret in your code to verify that the webhook was triggered by LaunchDarkly.

Here is an image of the webhook configuration screen:

The webhook configuration screen, configured with a secret.
The webhook configuration screen, configured with a secret.

You can use the auto-generated secret, or supply your own when creating or editing a webhook.

Adding a policy filter

LaunchDarkly sends all flag change events in the production environment to a webhook by default. To customize the events LaunchDarkly sends to a webhook, use the policy editor in the webhook creation panel. To learn more about creating a policy, read Example policies and templates.

For example, to receive an event only when a change is made to one of your production feature flags, add the following policy to your webhook:

1{
2 "effect": "allow",
3 "resources": [
4 "proj/*:env/production:flag/*"
5 ],
6 "actions": [
7 "*"
8 ]
9}

Here is an image of the webhook configuration screen, configured with a policy:

The webhook configuration screen, configured with a policy.
The webhook configuration screen, configured with a policy.

Payload format

The webhook payload format is identical to the entry format for the audit log. Read our REST API Documentation for an example payload.

Webhook delivery order

Note that webhooks may not be delivered in chronological order. We recommend using the payload's "date" field as a timestamp to reorder webhooks as they are received.

Retries

If LaunchDarkly receives a non-2xx response to a webhook POST, it attempts to retry the delivery once. Webhook delivery is not guaranteed, and integrations built on webhooks should be tolerant of delivery failures.

Disabling webhooks

You can temporarily disable a webhook by hitting the On/Off switch on the Integrations page.

Testing webhooks

If you need to generate a test URL, we recommend using RequestBin or Mockbin.