Claude Platform Docs

Unwrap

beta.webhooks.unwrap(payload, headers:, key: @client.webhook_key) -> BetaWebhookEvent
Function

Verifies the webhook signature from the webhook-id, webhook-timestamp and webhook-signature headers using your webhook signing key, then parses the payload into an event. Fails if the signature is missing or invalid.

Parameters
payload: String

The body of the incoming webhook request, exactly as received: the signature is computed over these bytes.

headers: Hash<String, String>

The HTTP headers of the incoming webhook request. Verification reads webhook-id, webhook-timestamp and webhook-signature.

key: optional String

The webhook signing key. Defaults to the client's webhook_key option.

Returns
class BetaWebhookEvent { type: :event, id, created_at, data }
type: :event

Object type. Always event for webhook payloads.

id: String

Unique event identifier for idempotency.

created_at: Time

RFC 3339 timestamp when the event occurred.

formatdate-time
One of the following:
Unwrap
require "anthropic"

anthropic = Anthropic::Client.new(api_key: "my-anthropic-api-key")

# `payload` is the raw body of the incoming webhook request and `headers` are its HTTP headers.
event = anthropic.beta.webhooks.unwrap(payload, headers: headers)

puts(event)