No results for ""
EXPAND ALL
  • Home
  • API docs

GIVE DOCS FEEDBACK

Webhooks

Read time: 3 minutes
Last edited: Feb 23, 2024

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.

You can also use the REST API: Webhooks

Creating a webhook

To create a webhook:

  1. Navigate to the Integrations page.
  2. Navigate to the "Webhooks" section and click Add integration. The "Create a webhook" panel appears.
  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.

You can also use the REST API: Create a webhook

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. 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:

[
{
"effect": "allow",
"actions": ["*"],
"resources": ["proj/*:env/production:flag/*"]
}
]

You can also use the REST API: Update webhook

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 Pipedream or Insomnia.

Deleting webhooks

You can delete a webhook when you no longer need it.

To delete a webhook:

  1. Navigate to the Integrations page.
  2. Navigate to the "Webhooks" section.
  3. Click the expand arrows next to the Add integration button.
The "Add integration" button with the expand arrow called out.
The "Add integration" button with the expand arrow called out.
  1. Click the pencil edit icon next to the webhook you want to delete. The "Edit webhook" panel appears.
  2. Click Delete webhook. A confirmation dialog appears.
  3. Click Delete.

You can also use the REST API: Delete webhook