Configuring webhooks in CloudBees Feature Management

2 minute readExtensibility

Webhooks in CloudBees Feature Management are real-time notifications that are triggered when an event happens in the system. Webhooks can be configured to listen to events within a specific environment or all environments.

The event listener triggers a custom HTTP callback. The callback pushes an HTTP POST payload to the user-defined URL.

Sample payload
{
  "channel": {
    "name": "test",
    "url": "https://example.net/api/webhook"
  },
  "flag": "E2E Test Flag 1613570517455",
  "user": {
    "email": "example@email.com",
    "name": "Samuel Exampleton"
  },
  "applicationName": "My Example App",
  "environmentName": "Production",
  "action": "changed flag visibility",
  "message": "Flag 'E2E Test Flag 1613570517455' visibility set to hidden"
}
Example using interfaces for the payload
export interface IWebhookPayload {
  channel: {
    name: string
    url: string
  }
  flag: string
  user: {
    email: string
    name: string
  } | {
    externalUserUrl: string
    externalUserName: string
  }
  applicationName: string
  environmentName: string
  targetGroup: string
  action: string
  message: string
}

Creating a webhook

To create a webhook:

  1. Sign in to CloudBees Feature Management as an administrator.

  2. Navigate to App Settings in the left-hand column.

  3. On the Integrations tab in the Webhooks section, select Create.

  4. Configure each field in the New webhook dialog as follows:

    • Webhook name: Enter a name for the webhook.

    • Webhook events: Select the type of events to report on; All changes per application or Changes in specific environments.

    • Environments: Specify one or more environments from the Environments dropdown. Note: This field is only required if Changes in specific environments is selected in Webhook events.

    • Payload example: Optionally, you can copy the payload by selecting Copy.

    • URL: Enter the URL that the webook will POST to, then select Test.

    The test verifies whether the URL is valid. If the test is successful, a green banner will display the message, API returned 200 response successfully.
  5. Select Create.

    You will be returned to the Integrations tab.

    If you have created more than one webhook, you will see it listed on the Integrations tab.
  6. Turn on the toggle in the Webhooks section to enable the webhook.

    The webhook will not work unless you enable it.
    Figure 1. Enabling a webhook

Modifying a webhook

To modify a webhook:

  1. Sign in to CloudBees Feature Management as an administrator.

  2. Navigate to App Settings in the left-hand column.

  3. On the Integrations tab, select the webhook. It will appear in the Webhooks section.

  4. Update each field as needed.

  5. Select Update.

Deleting a webhook

Deleting a webhook may result in errors for an application that still uses it. Be sure that no applications are using a webhook before you delete it. Deleting a webhook cannot be undone.

To delete a webhook:

  1. Sign in to CloudBees Feature Management as an administrator.

  2. Navigate to App Settings in the left-hand column.

  3. On the Integrations tab, locate the webhook in the Webhooks section.

  4. Select the delete trashcan icon.

  5. Note the warning text. If you agree, select Yes, I understand the risks associated with this action.

  6. Select Yes, Delete.