Using webhooks

Intro

Use webhooks to be notified about events that happen on a config, such as: config edited, config structure changed, config published.

Dropconfig can send webhook events that notify your application any time an event happens on your configs.

The most common use-case for hooks is invalidating the cached version of a dropconfig, if you do cache it - when publication is complete.

When the event occurs, Dropconfig creates an event-object. This event-object contains all the relevant information about what just happened, including the type of event and the data associated with that event. DropConfig then sends the event-object, via an HTTP POST request, to any endpoint URLs that you have defined in your config’s Webhooks settings. You can have DropConfig send a single event to many webhook endpoints.

Creating a webhook

Navigate to the config you want to add a hook for and click “Settings” then “Webhooks” then “CREATE NEW WEBHOOK”

Hooks Page

Field descriptions

Payload URL

The url, which DropConfig will make an HTTP POST request to with event-object when an event happens.

Secret

An optional “secret” you can set, which DropConfig will include into the HTTP POST request as x-secret-token HTTP-header. Use this to validate that payload is coming from us.

Hook events

You can either choose to receive a webhook on all events or only select some events.

Active

When check the hook will be run.

Events

publication-started

DropConfig creates this event when user publishes a version of a config.

Publishing of an updated dropconfig may take a few minutes, when we propagate the change through the globe. This event marks the beginning of this process. If you fetch the dropconfig via its access URL at the moment of this event, you may receive an old version - depending on your location.

{
  "type": "publication-started",
  "data": {
    "publication": {
      "id": "9e2f3039-d083-4377-8856-46cf4c122e4e"
    },
    "document": {
      "name": "my_feature_flags",
      "id": "864c08a8-935d-4892-b7f2-25a63c3b05bf"
    },
    "documentVersion": {
      "id": "ac3a6305-eb15-4161-928d-1e5634b6ea9d"
    },
    "accessId": "5076b9d1-6036-4fea-bce7-9316ab9b3ce8"
  }
}

publication-complete

DropConfig creates this event when publishing process is complete and an update has propagated through the globe.

After your webhook receives this event, you are guaranteed to receive the new version of your config if you fetch it.

The typical use-case for this event is invalidating local cache of a config, or of any data/logic you derive from it.

Normally, this event happens a few minutes after publication-started event.

Sample HTTP POST body containing the event-object:

{
  "type": "publication-complete",
  "data": {
    "document": {
      "name": "my_feature_flags",
      "id": "864c08a8-935d-4892-b7f2-25a63c3b05bf"
    },
    "publication": {
      "id": "9e2f3039-d083-4377-8856-46cf4c122e4e"
    },
    "documentVersion": {
      "id": "ac3a6305-eb15-4161-928d-1e5634b6ea9d"
    }
  }
}

document-saved

DropConfig creates this event when user creates a new version of a config, even if it’s not published yet.

Sample HTTP POST body containing the event-object:

{
  "type": "document-saved",
  "data": {
    "document": {
      "id": "864c08a8-935d-4892-b7f2-25a63c3b05bf"
    },
    "prevVersion": {
      "id": "ac3a6305-eb15-4161-928d-1e5634b6ea9d"
    },
    "user": {
      "id": "ef37f2d8-6906-4f12-8491-cae216bce640"
    }
  }
}

document-schema-changed

DropConfig creates this event when user creates a new version of a config and this new version has different structure/schema compared to a previous version. This event is created even if new version is not published.

Sample HTTP POST body containing the event-object:

{
  "type": "document-schema-changed",
  "data": {
    "document": {
      "id": "864c08a8-935d-4892-b7f2-25a63c3b05bf"
    },
    "prevVersion": {
      "id": "ac3a6305-eb15-4161-928d-1e5634b6ea9d"
    },
    "user": {
      "id": "ef37f2d8-6906-4f12-8491-cae216bce640"
    }
  }
}