Hierarchy

  • APIResource
    • Webhooks

Constructors

Methods

Constructors

  • Parameters

    Returns Webhooks

Methods

  • Validates that the given payload was sent by OpenAI and parses the payload.

    Parameters

    • payload: string
    • headers: HeadersLike
    • Optionalsecret: null | string
    • Optionaltolerance: number

    Returns Promise<UnwrapWebhookEvent>

  • Validates whether or not the webhook payload was sent by OpenAI.

    An error will be raised if the webhook payload was not sent by OpenAI.

    Parameters

    • payload: string

      The webhook payload

    • headers: HeadersLike

      The webhook headers

    • Optionalsecret: null | string

      The webhook secret (optional, will use client secret if not provided)

    • Optionaltolerance: number

      Maximum age of the webhook in seconds (default: 300 = 5 minutes)

    Returns Promise<void>