Fern Definition

Webhooks in the Fern Definition

In Fern, you can specify webhooks in your API definition. The webhooks will be included in both the generated SDKs and the API documentation.

Webhook definition

Each webhook defines:

  1. Method: The HTTP Method that the webhook will use (either GET or POST)
  2. Headers: The headers that the webhook will send
  3. Payload: The schema of the webhook payload
webhooks.yml
1webhooks:
2 paymentNotification:
3 display-name: Payment Notification
4 docs: Receive a notification when a payment changes status
5 method: POST
6 headers:
7 X-Signature-Primary:
8 type: string
9 docs: An HMAC signature of the payload
10 payload: PaymentNotificationPayload
11
12types:
13 PaymentNotificationPayload:
14 discriminant: notificationType
15 union:
16 queued: QueuedPaymentNotification
17 processing: ProcessingPaymentNotification
18 completed: CompletedPaymentNotification