-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Audit Log - Release Date Added to Docs * Outbound Webhooks Docs V1 - Webhooks Docs -- Creatig a Webhook -- Example Payload -- Testing a Webhook -- Deleting a Webhook * Update webhooks.md * chore: fixed example payload section --------- Co-authored-by: Jason Salaber <[email protected]>
- Loading branch information
1 parent
6813258
commit 1e47420
Showing
4 changed files
with
166 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
label: 'Webhooks' | ||
position: 9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,145 @@ | ||
--- | ||
title: Webhooks | ||
sidebar_position: 1 | ||
--- | ||
|
||
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: | ||
|
||
1. Navigate to the Integrations page. | ||
2. Navigate to the "Webhooks" section and click `+ New Webhook`. The "Create a Webhook" modal appears. | ||
3. Give the Webhook a human-readable name. | ||
4. (Optional) Give the Webhook a description. | ||
5. Enter a Payload URL. | ||
6. Click `Create Webhook`. From there, you will be taken to the Webhook details page. | ||
7. Select if you'd like events sent for all Features in your project or a single Feature. | ||
8. Select which events will be sent through the Webhook. | ||
9. Click `Save`. | ||
|
||
### Example Payload | ||
|
||
Below is the type definition for the payload that gets sent to the Webhook url: | ||
|
||
```typescript | ||
/** | ||
* 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: | ||
```json | ||
{ | ||
"events": ["modifiedFeature", "addedVariable"], | ||
"key": "feature-key", | ||
"date": "2024-01-16T18:30:42.796Z", | ||
"user": { | ||
"name": "Jason", | ||
"email": "[email protected]" | ||
}, | ||
"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: | ||
1. Navigate to the Integrations page. | ||
2. Navigate to the "Webhooks" section. | ||
3. Click the expand arrows next to the Add integration button. | ||
4. Navigate to the Test section of the Webhook details page. | ||
5. Click `Test Connection` to verify the Webhook Url is accessible. The API response will be displayed below. | ||
### Deleting a Webhook | ||
To delete a Webhook: | ||
1. Navigate to the Integrations page. | ||
2. Navigate to the "Webhooks" section. | ||
3. Click on the Webhook that you wish to delete. | ||
4. Navigate to the Settings section of the Webhook details page. | ||
5. Click `Delete Webhook`. A confirmation modal will appear. | ||
6. Click `Delete`. | ||
## Inbound Webhooks (Coming Soon) | ||
This Feature will allow the user to create Webhook urls for certain actions, for e.g. turning on/off a Production Environment. | ||
If you would like this Feature, contact [email protected]! |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1e47420
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Successfully deployed to the following URLs:
devcycle-docs – ./
devcycle-docs-devcyclehq.vercel.app
devcycle-docs-git-main-devcyclehq.vercel.app
devcycle-docs.vercel.app
docs.devcycle.com