Webhooks¶
The Webhooks resource covers listing, creating, updating, deleting, inspecting delivery events, and retrying failed events.
Initialization¶
List Webhooks¶
Method¶
Example¶
result = client.webhooks.all(page=1, limit=10)
print(result.page, result.total_count, result.has_more)
for webhook in result.webhooks:
print(webhook.id, webhook.url, webhook.is_enabled)
Notes¶
- The returned collection is
webhooks, notdata PaginatedWebhooksexposespage,limit,has_more, andtotal_count
Official Reference¶
Iterate Webhooks¶
Create Webhook¶
Method¶
client.webhooks.create(
form_id: str,
url: str,
event_types: list[WebhookEventType] | list[str] | None = None,
signing_secret: str | None = None,
http_headers: list[WebhookHeader] | list[dict[str, str]] | None = None,
external_subscriber: str | None = None,
) -> WebhookCreated
Example¶
from tally.models import WebhookEventType
webhook = client.webhooks.create(
form_id="wXYz123",
url="https://your-app.com/webhooks/tally",
event_types=[WebhookEventType.FORM_RESPONSE],
signing_secret="super-secret",
http_headers=[{"name": "X-App", "value": "pytally-sdk"}],
)
print(webhook.id, webhook.url, webhook.is_enabled)
Notes¶
- If
event_typesis omitted, the SDK defaults to["FORM_RESPONSE"] - Header objects use
nameandvalue
Official Reference¶
Update Webhook¶
Method¶
client.webhooks.update(
webhook_id: str,
form_id: str,
url: str,
event_types: list[WebhookEventType] | list[str],
is_enabled: bool,
signing_secret: str | None = None,
http_headers: list[WebhookHeader] | list[dict[str, str]] | None = None,
) -> None
Example¶
client.webhooks.update(
webhook_id="wh_123",
form_id="wXYz123",
url="https://your-app.com/webhooks/tally",
event_types=["FORM_RESPONSE"],
is_enabled=True,
)
Notes¶
- This method updates the full webhook payload; required fields must be supplied
Official Reference¶
Delete Webhook¶
Method¶
Official Reference¶
Get Webhook Events¶
Method¶
Example¶
events = client.webhooks.get_events("wh_123", page=1)
print(events.total_number_of_events)
for event in events.events:
print(event.id, event.event_type.value, event.delivery_status.value)
Notes¶
- The returned collection is
events, notdata PaginatedWebhookEventsexposespage,limit,has_more, andtotal_number_of_events
Official Reference¶
Retry Webhook Event¶
Method¶
Example¶
Official Reference¶
Models¶
Webhook¶
Webhook
dataclass
¶
Represents a Tally webhook.
WebhookCreated¶
WebhookCreated
dataclass
¶
Represents the response when creating a webhook.
WebhookEvent¶
WebhookEvent
dataclass
¶
Represents a webhook delivery event.
PaginatedWebhooks¶
PaginatedWebhooks
dataclass
¶
Represents a paginated response of webhooks.
PaginatedWebhookEvents¶
PaginatedWebhookEvents
dataclass
¶
Represents a paginated response of webhook events.