Skip to content

Conversation

@infinityplusone
Copy link
Contributor

Changes

Adds comprehensive Webhooks v2 client support to the tango-node SDK.

Added

  • Event type discovery: listWebhookEventTypes() to discover supported event types and subject types
  • Subscription management: Full CRUD operations for webhook subscriptions
    • listWebhookSubscriptions() - List subscriptions with tier-capped pagination (page + page_size)
    • getWebhookSubscription() - Get a single subscription by ID
    • createWebhookSubscription() - Create a new subscription
    • updateWebhookSubscription() - Update subscription name and/or payload
    • deleteWebhookSubscription() - Delete a subscription
  • Endpoint management: Full CRUD operations for webhook endpoints
    • listWebhookEndpoints() - List endpoints with standard pagination
    • getWebhookEndpoint() - Get a single endpoint by ID
    • createWebhookEndpoint() - Create a new endpoint (one per user)
    • updateWebhookEndpoint() - Update endpoint callback URL and/or active status
    • deleteWebhookEndpoint() - Delete an endpoint
  • Testing utilities:
    • testWebhookDelivery() - Send a test webhook to verify endpoint connectivity
    • getWebhookSamplePayload() - Fetch sample payloads for development/testing
  • Type definitions: Complete TypeScript interfaces for all webhook models (WebhookSubscription, WebhookEndpoint, WebhookEventType, etc.)

Changed

  • HTTP client: Extended to support PATCH, PUT, and DELETE methods (previously only GET and POST)

Why

This implements the full Webhooks v2 API surface area from the Tango server, enabling SDK users to:

  • Discover available event types and subject types
  • Manage webhook subscriptions with proper tier-based access controls
  • Manage webhook endpoints (though typically provisioned by MakeGov in production)
  • Test webhook delivery and inspect sample payloads during development

Testing

  • Comprehensive test suite covering all webhook endpoints
  • Tests verify correct HTTP methods, request bodies, query parameters, and response parsing
  • All tests pass with mocked HTTP responses

Notes

  • Pagination: Subscriptions use page + page_size (tier-capped), while endpoints use page + limit
  • Tier gating: "Catch-all" subscriptions (empty subject_ids) require Enterprise tier
  • Deliveries/redelivery: The server API does not currently expose public endpoints for listing deliveries or redelivery operations
  • Signature verification: Documentation includes Python code snippet for verifying webhook signatures (HMAC-SHA256)

Related

Resolves makegov/tango#1275

… management, and test delivery. Update HTTP client to support PATCH, PUT, and DELETE methods. Enhance documentation and tests for new features.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants