Skip to main content

Global SDK Webhooks

note

Global SDK Webhooks are only available for self-hosted GrowthBook installations.

Global SDK Webhooks are just like SDK Webhooks, but configured via environment variables instead of the GrowthBook UI.

When any SDK Connection payloads changes in any organization, all of your Global SDK Webhooks will be triggered.

Setup

Define a WEBHOOKS environment variable as a JSON string of an array of global webhook objects.

The only required field for a global webhook is url. Here's a minimal example:

[{"url":"https://example.com"}]

There are additional fields you can specify:

  • signingKey (string) - Will be used to add a signature header that enables you to verify the webhook origin
  • method (string) - One of GET, PUT, POST, PURGE, or DELETE. Defaults to POST if omitted
  • headers (object) - Additional headers to add to the webhook request. Useful for adding auth headers for example. Default {}.
  • payloadFormat (string) - How to format the body (ignored when method = "GET"). One of standard, standard-no-payload, sdkPayload or none. Defaults to standard. Read more about the different formats in the SDK Webhooks Payload Format docs.

Deprecated:

  • sendPayload (boolean) - Whether or not to include the full SDK Payload in the body. true maps to payloadFormat = standard; false maps to payloadFormat = standard-no-payload.

Here's a full example using all of the fields:

[{"url":"https://example.com","signingKey":"abc123","method":"PUT","headers":{"X-Custom-Header":"foo"},"payloadFormat":"sdkPayload"}]

Verify Signatures

If you define a signingKey, you can use it to verify that webhooks are coming from GrowthBook.

See: SDK Webhooks - Verify Signatures

Using Webhook Payloads

Global SDK Webhooks always include a special header (webhook-sdk-key), which contains the clientKey of the SDK Connection that triggered the payload.

If you specify sendPayload: true, you will also receive an SDK payload in the body. See SDK Webhooks -> Sending Payload

Errors and Retries

Unlike normal SDK Webhooks, Global SDK Webhooks are NOT retried on error.

On failure, they will output container logs as well as save them to the Mongo sdkwebhooklogs collection.