You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For more information on how to configure your webhook reference in `docs.yml`, see [Generate your webhook reference](/docs/api-references/generate-webhook-reference).
Copy file name to clipboardExpand all lines: fern/products/api-def/openapi-pages/webhooks.mdx
+23-12Lines changed: 23 additions & 12 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -8,15 +8,10 @@ Fern supports two methods for defining webhooks in your OpenAPI specification:
8
8
1. Using OpenAPI 3.1's native webhook support (recommended)
9
9
2. Using Fern's `x-fern-webhook` extension
10
10
11
-
## OpenAPI 3.1 Webhooks
11
+
## OpenAPI 3.1 webhooks
12
12
13
13
For OpenAPI 3.1 specifications, use the `webhooks` top-level field to define your webhook operations. Each webhook requires an `operationId` to be properly processed by Fern.
14
14
15
-
To create dedicated pages in your API reference documentation for each webhook
16
-
event, include `tags` and complete `example` data in your schema. Then, [add a
For more information on how to configure your webhook reference in `docs.yml`, see [Generate your webhook reference](/docs/api-references/generate-webhook-reference).
Copy file name to clipboardExpand all lines: fern/products/docs/pages/api-references/generate-webhook-ref.mdx
+31-10Lines changed: 31 additions & 10 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,9 +1,9 @@
1
1
---
2
-
title: Generate your Webhook Reference
3
-
description: Use Fern Docs to generate your Webhook Reference documentation from your API definition, using your choice of either OpenAPI or Fern Definition.
2
+
title: Generate your webhook reference
3
+
description: Use Fern Docs to generate your webhook reference documentation from your API definition, using your choice of either OpenAPI or Fern Definition.
4
4
---
5
5
6
-
Similar to API References, Fern Docs can automatically generate your Webhook Reference documentation from your API definition.
6
+
Similar to API References, Fern Docs can automatically generate your webhook reference documentation from your API definition.
7
7
8
8
Fern supports webhooks through:
9
9
-**OpenAPI 3.1+**: Use the native `webhooks` field with an `operationId` (recommended)
@@ -14,7 +14,9 @@ For more information on how to define webhooks, see:
14
14
-[Webhooks in OpenAPI](../../openapi-definition/endpoints/webhooks)
15
15
-[Webhooks in Fern Definition](../../fern-definition/webhooks)
16
16
17
-
Example:
17
+
## Configure your webhook reference
18
+
19
+
Add a page title (`api`) and reference the name of the directory where your where your webhook definition is located (`api-name`).
18
20
19
21
```yml docs.yml {11-12}
20
22
navigation:
@@ -31,9 +33,9 @@ navigation:
31
33
api-name: webhooks-v1
32
34
```
33
35
34
-
For a real-world example of webhook documentation generated from an API definition, check out [Webflow's Webhooks](https://developers.webflow.com/data/reference/webhooks/events/form-submission).
36
+
For a real-world example of webhook documentation generated from an API definition, check out [Webflow's webhooks](https://developers.webflow.com/data/reference/webhooks/events/form-submission).
35
37
36
-
### Directory Structure
38
+
### Directory structure
37
39
Your webhooks should be defined in a dedicated folder within your Fern project:
38
40
39
41
<Tabs>
@@ -73,7 +75,7 @@ You can read more about how to define webhooks in your Fern Definition [here](/l
73
75
</Tab>
74
76
</Tabs>
75
77
76
-
### Include more than one Webhook Reference
78
+
### Include more than one webhook reference
77
79
To include multiple webhook definitions in your documentation, use the `webhook-name` property:
78
80
79
81
```yaml title="docs.yml"
@@ -99,15 +101,34 @@ fern/
99
101
└── generators.yml
100
102
```
101
103
102
-
### Create individual documentation pages for each webhook event (OpenAPI)
104
+
### Create individual documentation pages for each webhook event
103
105
104
-
To display each webhook event as an individual page with rich examples, you need to define `tags` and `example`[in your webhook specification](/api-definitions/openapi/endpoints/webhooks) (or [overrides file](/api-definitions/overview/overrides)).
106
+
To display each webhook event as an individual page with rich examples:
105
107
106
-
Then, reference individual webhook pages using the `subpackage_{tag}.{webhook-event-name}` format, where:
108
+
<Tabs>
109
+
<Tabtitle="OpenAPI">
110
+
Reference individual webhook pages using the `subpackage_{tag}.{webhook-event-name}` format, where:
107
111
-`{tag}` is the first tag (lowercase) from your webhook definition
108
112
-`{webhook-event-name}` is the `operationId` from your webhook definition
109
113
110
114
```yaml title="docs.yml"
111
115
navigation:
112
116
- subpackage_plants.newPlantWebhook
113
117
```
118
+
119
+
<Note>
120
+
For OpenAPI, you must have the `tags` and `example` properties defined [in your webhook specification](/api-definitions/openapi/endpoints/webhooks).
121
+
</Note>
122
+
123
+
</Tab>
124
+
<Tab title="Fern Definition">
125
+
Reference the individual webhook event using the `subpackage_{name}.{webhook-event-name}` format, where:
126
+
- `{name}`is the name of your API as defined in the `api.yml` file for your webhook definition.
127
+
- `{webhook-event-name}`is the identifier from your webhook definition
0 commit comments