Webhooks
This topic explains how to create and use Webhooks in DevCycle.
Webhooks allow you to build your own integrations that subscribe to Feature changes in DevCycle. Use Webhooks to update external ticket trackers, notify teammates of new features, targeting changes, and more.
Outbound Webhooks
Creating a Webhook
To create a Webhook:
- Navigate to the Integrations page.
- Navigate to the "Webhooks" section and click
+ New Webhook
. The "Create a Webhook" modal appears. - Give the Webhook a human-readable name.
- (Optional) Give the Webhook a description.
- Enter a Payload URL.
- Click
Create Webhook
. From there, you will be taken to the Webhook details page. - Select if you'd like events sent for all Features in your project or a single Feature.
- Select which events will be sent through the Webhook.
- Click
Save
.
Example Payload
Below is the type definition for the payload that gets sent to the Webhook url:
/**
* The 'newContents' and 'previousContents' type is a subset of the resource
* that was changed
*/
export type AuditLogChange = {
type: string
newContents: Record<string, unknown> | null
previousContents: Record<string, unknown> | null
_environments?: string[]
metadata?: Record<string, unknown>
}
type User = {
name?: string
email: string
}
type WebhookPayload = {
/**
* An array of types that were triggered, the 'changes' property
* should have all these events in this array
*/
events: string[]
/**
* The key of the Feature
*/
key?: string
/**
* The key of the project
*/
projectId: string
/**
* The version of the payload so we can have different versions
* in the future
*/
version: string
/**
* The changes that were made
*/
changes: AuditLogChange[]
/**
* The date this Webhook triggered the URL on
*/
date: Date
/**
* The user that triggered the change
*/
user: User
}
For example, a user edits a Feature’s key and adds a new variable, the data posted to the user’s Webhook URL would be:
{
"events": ["modifiedFeature", "addedVariable"],
"key": "feature-key",
"date": "2024-01-16T18:30:42.796Z",
"user": {
"name": "Jason",
"email": "jason@email.com"
},
"version": "1"
"changes": [
{
"type": "modifiedFeature",
"newContents": {
"key": "new-feature-key"
},
"previousContents": {
"key": "feature-key"
}
},
{
"type": "addedVariable",
"newContents": {
... // new variable object
},
"previousContents": null
},
]
}
Testing a Webhook
To test a Webhook:
- Navigate to the Integrations page.
- Navigate to the "Webhooks" section.
- Click the expand arrows next to the Add integration button.
- Navigate to the Test section of the Webhook details page.
- Click
Test Connection
to verify the Webhook Url is accessible. The API response will be displayed below.
Deleting a Webhook
To delete a Webhook:
- Navigate to the Integrations page.
- Navigate to the "Webhooks" section.
- Click on the Webhook that you wish to delete.
- Navigate to the Settings section of the Webhook details page.
- Click
Delete Webhook
. A confirmation modal will appear. - Click
Delete
.
Inbound Webhooks (Coming Soon)
This feature will allow the user to create Webhook urls for certain actions, like turning on/off a Feature in production. If you would like this feature, contact product@devcycle.com!