Skip to main content

Module webhook

Module webhook 

Source
Expand description

The webhook side of push delivery: which headers carry the notification token, how a receiver reads it, and how a webhook URL is named in logs.

§Why two token headers

The specification does not name the header. §4.3.3’s request example shows only Authorization and Content-Type, and a2a.proto describes TaskPushNotificationConfig.token as “a token unique for this task or session” without saying how it travels. The two reference SDKs chose differently:

  • a2a-sdk (Python) 1.1.5, server/tasks/base_push_notification_sender.py: headers = {'X-A2A-Notification-Token': push_info.token}
  • a2a-go v2.5.0, a2asrv/push/sender.go: var tokenHeader = http.CanonicalHeaderKey("A2A-Notification-Token")

A webhook written against one never sees the other’s token, so HttpPushSender sends both — the same value twice, which costs one header line and cannot confuse a receiver that reads either — and notification_token accepts both.

The client crate’s webhook module (WebhookReceiver) reads the token with a copy of notification_token: neither crate depends on the other. Change one, change both.

Constants§

DELIVERY_ID_HEADER
The A2A-Delivery-Id header: one id for one event sent to one webhook, the same on every attempt of it.
NOTIFICATION_TOKEN_HEADER
The X-A2A-Notification-Token spelling, which a2a-sdk (Python) sends and reads.
NOTIFICATION_TOKEN_HEADER_UNPREFIXED
The A2A-Notification-Token spelling, which a2a-go sends and reads.

Functions§

delivery_id
Reads the delivery id from a webhook request’s headers (DELIVERY_ID_HEADER).
notification_token
Reads the push notification token from a webhook request’s headers, under either spelling.