Webhooks

Zenmanage enables the use of webhooks to notify your application of various events, such as a flag target change or the creation of a new target rule.

Overview

Webhooks are user-defined HTTP callbacks triggered by specific events in Zenmanage. When the event occurs, the app makes an HTTP request to the URL configured for the webhook. Webhooks are commonly used to provide real-time data updates or to trigger automated processes.

Here are some key points about webhooks:

Event-driven: Webhooks are activated by events in Zenmanage, such as a flag target changing or a target rule being created. For a full list of supported webhooks, see below.

Real-time communication: They allow for near real-time data communication between Zenmanage and your applications.

HTTP requests: Webhooks typically use HTTP POST requests to send data to a specified URL. Zenmanage also supports GET, PUT, and PATCH. This data will be formatted as JSON.

Automation: They are useful for automating workflows and integrating different services to changes in feature flags. For example, a webhook can notify your application to clear or update the currently stored cache value for a flag.

Scalability: Webhooks can reduce the need for polling APIs, which can save on resources and reduce latency.

Events

Name Event Description
Flag Target Changed flag.target.changed Triggered when a flag target is updated to a new value.
Target Rule Created target.rule.created Triggered when a target rule is created on a feature flag.
Target Rule Changed target.rule.changed Triggered when a target rule is changed on a feature flag.
Target Rule Removed target.rule.removed Triggered when a target rule is removed from a feature flag.

Configuring a Webhook

Webhooks can be configured in the Zenmanage Admin Settings. To set up a webhook, follow these steps:

  1. Log into Zenmanage as an Admin and open the Admin Settings.
  2. From the project tab, choose the project and then environment to create the feature flag.
  3. From the environment screen and the webhooks tab, click the Create Webhook button.
  4. Provide a URL and the HTTP method to call. Then select the events that should trigger a webhook call.
  5. Click Create to complete the

If you choose to receive webhook triggers for all events, if Zenmanage adds more events you will automatically receive them. If you wish to only target certain events, check only the events you wish to receive. You can have as many webhooks triggered as you wish per environment.

The payload of the webhook will be JSON formatted. For POST, PUT, and PATCH, the payload will be in the body of the request. For GET, the payload will be in the json query string parameter.

Example Payload

Zenmanage sends a JSON payload to the webhook URL you specify. The payload contains information about the event that triggered the webhook. The payload structure is as follows:

{
  "type": "flag.target.updated",
  "timestamp": "2024-06-23T20:36:07+00:00",
  "attributes": {
      "project_key": "your-project",
      "environment_key": "staging",
      "flag_key": "enable-groundbreaking-feature",
      "new_target_value": "false",
      "transaction_id": "wht_4a2b4f3c8d1e5f6g"
  }
}