You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Folds in the work from PR #27 (issue-2275-drop-subjects) plus three
cleanup-batch carry-overs from tango's `dogpile/api-cleanup-batch`:
- #2256: add `endpoint` kwarg to create_webhook_alert (multi-endpoint
accounts can now use the convenience wrapper)
- #2254: remove `ordering` kwarg from list_notices and list_protests
(server rejects every value)
- #2252: switch test_webhook_delivery to canonical `endpoint` body key
Closesmakegov/tango#2275 — part of makegov/tango#2267.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
> `list_webhook_subscriptions` / `get_webhook_subscription` and the
15
+
> `WebhookSubscription` + `WebhookSubjectTypeDefinition` dataclasses is a
16
+
> breaking change.
17
+
10
18
### Added
11
-
-`ordering` parameter on `list_forecasts`, `list_grants`, `list_subawards`, `list_gsa_elibrary_contracts`, `list_opportunities`, `list_notices`, and `list_protests`. Prefix with `-` for descending. Closes a parity gap with the API surface (these endpoints all accept `?ordering=` server-side).
19
+
-`ordering` parameter on `list_forecasts`, `list_grants`, `list_subawards`, `list_gsa_elibrary_contracts`, and `list_opportunities`. Prefix with `-` for descending. Closes a parity gap with the API surface (these endpoints all accept `?ordering=` server-side).
12
20
-`create_webhook_endpoint` accepts `name=` (keyword-only). Required by the Tango API since multi-endpoint support landed; omitting it now emits a `DeprecationWarning` and will become an error in a future major version.
13
-
-`create_webhook_subscription` accepts `endpoint=`, `subscription_type=`, `query_type=`, `filter_definition=`, `frequency=`, `cron_expression=`, `is_active=` (keyword-only). Lets callers target a specific endpoint and create filter subscriptions through the canonical API.
14
-
-`update_webhook_subscription` accepts `frequency=`, `cron_expression=`, `is_active=` for filter-subscription updates.
15
21
-`update_webhook_endpoint` accepts `name=` for renaming an endpoint.
16
-
- Webhook alerts (filter subscriptions): `list_webhook_alerts`, `get_webhook_alert`, `create_webhook_alert`, `update_webhook_alert`, `delete_webhook_alert` — the convenience layer over `/api/webhooks/alerts/`. New `WebhookAlert` dataclass exported from the top-level package.
22
+
- Webhook alerts (filter subscriptions): `list_webhook_alerts`, `get_webhook_alert`, `create_webhook_alert`, `update_webhook_alert`, `delete_webhook_alert` — the canonical write surface over `/api/webhooks/alerts/`. New `WebhookAlert` dataclass exported from the top-level package.
17
23
-`resolve(name, target_type, ...)` — POST `/api/resolve/` to rank entity / organization candidates from a free-text name. Returns `ResolveResult` with `ResolveCandidate` entries (both exported).
18
24
-`validate(identifier_type, value)` — POST `/api/validate/` to validate the format of a PIID, solicitation number, or UEI. Returns `ValidateResult` (exported).
- Misc: `search_opportunity_attachments(q, top_k, include_extracted_text)` for `/api/opportunities/attachment-search/`; `get_version()` for `/api/version/`; `list_api_keys()` for `/api/api-keys/`.
24
30
31
+
### Changed
32
+
-`create_webhook_alert` accepts `endpoint=` (keyword-only). Required for accounts with multiple webhook endpoints; auto-resolves for single-endpoint accounts. Closes the multi-endpoint smoke-test gap (tango#2256).
33
+
-`test_webhook_delivery` now sends the canonical `endpoint` body key instead of the deprecated `endpoint_id` alias (tango#2252). The Python kwarg name stays `endpoint_id=` for backwards compatibility; the wire payload is what changed.
34
+
35
+
### Removed
36
+
-**Subject-based webhook subscription surface** (tango#2275). Migrate to `create_webhook_alert(...)` and the alerts API.
- Dataclasses: `WebhookSubscription`, `WebhookSubjectTypeDefinition`. Both are no longer exported from the top-level `tango` package — importing them raises `ImportError`.
39
+
- Fields: `default_subject_type` removed from `WebhookEventType`; `subject_types` and `subject_type_definitions` removed from `WebhookEventTypesResponse`. The server's `/api/webhooks/event-types/` response no longer carries these.
40
+
- CLI: the entire `tango webhooks subscriptions` Click subgroup (`list` / `get` / `create` / `delete`). Use the SDK's `client.create_webhook_alert(...)` etc. directly — there is no CLI subgroup for alerts.
41
+
-`ordering` kwarg from `list_notices` and `list_protests`. The notices and protests viewsets reject every `?ordering=` value at runtime (tango#2254); the kwarg silently sent unsupported values. Other five list methods retain `ordering`.
42
+
25
43
### Fixed
26
44
-`TangoClient._post()` and `_patch()` now accept both `json_data=` (positional) and `json=` (keyword) for backward compatibility. Internal callers and docs examples that use `json=` no longer fail with `TypeError`.
The Alerts API is a filter-subscription convenience layer on top of subscriptions.
1557
+
The Alerts API is the canonical (and only) write surface for webhook subscriptions. Every alert maps to one of the five `alerts.*.match` event types and delivers when its saved-search filters match new or modified records.
Webhook APIs let **Large / Enterprise** users manage subscription filters for outbound Tango webhooks.
1628
+
Webhook APIs let **Large / Enterprise** users manage delivery endpoints and discover the supported event-type catalog. Filter subscriptions (alerts) live in the [Webhook Alerts](#webhook-alerts) section above.
1618
1629
1619
1630
> **For testing, signing, and a CLI tool**, see [`docs/WEBHOOKS.md`](WEBHOOKS.md). This section covers SDK method signatures only.
1620
1631
1621
1632
### list_webhook_event_types()
1622
1633
1623
-
Discover supported `event_type` values and subject types.
Copy file name to clipboardExpand all lines: docs/WEBHOOKS.md
+54-39Lines changed: 54 additions & 39 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,6 +1,6 @@
1
1
# Webhooks Guide
2
2
3
-
This guide covers everything `tango-python` provides for **building, testing, and operating webhook integrations against the Tango API**: signing helpers, a local receiver, a command-line tool, and management commands for the underlying endpoints and subscriptions.
3
+
This guide covers everything `tango-python` provides for **building, testing, and operating webhook integrations against the Tango API**: signing helpers, a local receiver, a command-line tool, and management commands for the underlying endpoints and alerts.
4
4
5
5
If you only need the SDK method signatures, see [`API_REFERENCE.md` § Webhooks](API_REFERENCE.md#webhooks). For the API-level contract (signing scheme, event taxonomy, retry behavior), see the [Tango Webhooks Partner Guide](https://docs.makegov.com/webhooks-user-guide/).
6
6
@@ -18,7 +18,6 @@ If you only need the SDK method signatures, see [`API_REFERENCE.md` § Webhooks]
|**Delivery**| A single signed POST Tango makes when a matching event fires | (the request itself) |
64
63
65
64
A typical setup:
66
65
67
66
1.**Create an endpoint** (`POST /api/webhooks/endpoints/`) with the public URL of your handler. Tango returns a `secret` — save it; it's used to sign every delivery.
68
-
2.**Create one or more subscriptions** (`POST /api/webhooks/subscriptions/`) describing the events your handler cares about (e.g. `entities.updated` for specific UEIs).
67
+
2.**Create one or more alerts** (`POST /api/webhooks/alerts/`) describing the saved-search matches you want delivered (e.g. opportunities matching `naics=541511`). Each alert maps to one of five `alerts.*.match` event types.
69
68
3.**Tango POSTs** to your endpoint when matching events fire. The body is JSON; the header `X-Tango-Signature: sha256=<hex>` is the HMAC-SHA256 of the raw body bytes keyed by your endpoint's secret.
70
69
4.**Your handler verifies the signature**, parses the body, and acts on it.
71
70
@@ -80,15 +79,17 @@ Assumes you have a `TANGO_API_KEY` and want to receive entity-update webhooks fo
80
79
```bash
81
80
export TANGO_API_KEY=...
82
81
tango webhooks list-event-types
83
-
# entities.updated An entity record was updated
84
-
# awards.created A new award was published
85
-
# ...
82
+
# alerts.opportunity.match New/updated opportunity matched a saved alert
83
+
# alerts.contract.match New/updated contract matched a saved alert
84
+
# alerts.entity.match Entity matched a saved alert
85
+
# alerts.grant.match Grant matched a saved alert
86
+
# alerts.forecast.match Forecast matched a saved alert
Prints the canonical JSON shape Tango will deliver. No POST, no signature — just the body.
@@ -107,26 +108,32 @@ In another shell, drive it with the canonical sample, signed locally:
107
108
```bash
108
109
tango webhooks simulate \
109
110
--secret $TANGO_WEBHOOK_SECRET \
110
-
--event-type entities.updated \
111
+
--event-type alerts.entity.match \
111
112
--to http://127.0.0.1:8011/tango/webhooks
112
113
```
113
114
114
-
The listener should print a `verified` delivery with the entities-updated body. You now have a feedback loop: edit your handler, re-run `simulate`, see the result.
115
+
The listener should print a `verified` delivery with the alerts.entity.match body. You now have a feedback loop: edit your handler, re-run `simulate`, see the result.
115
116
116
117
### 4. Wire up the real Tango → your handler path
117
118
118
-
When you're ready for end-to-end testing against Tango itself, expose your local listener via a tunnel (`ngrok http 8011`, `cloudflared tunnel`, etc.) and register that public URL with Tango:
119
+
When you're ready for end-to-end testing against Tango itself, expose your local listener via a tunnel (`ngrok http 8011`, `cloudflared tunnel`, etc.) and register that public URL with Tango, then create an alert via the SDK:
`create` returns the generated `secret` once — save it. `delete` prompts for confirmation; `--yes` skips. `--inactive` registers the endpoint disabled (no deliveries until you re-enable it).
241
248
242
-
### `tango webhooks subscriptions`
249
+
### Managing alerts
243
250
244
-
Manage **what Tango delivers**.
251
+
Alerts (filter subscriptions) are the canonical way to control what Tango delivers. There is no CLI subgroup for them — use the SDK directly:
245
252
246
-
```bash
247
-
tango webhooks subscriptions list [--page N] [--page-size N]
`create` builds a single-record subscription (one event type, one subject type, one or more subject IDs). For multi-record subscriptions, call `client.create_webhook_subscription(...)` directly with a hand-crafted `payload` dict.
269
+
For multi-endpoint accounts, pass `endpoint=<uuid>` to `create_webhook_alert` to pin which endpoint the alert delivers to.
0 commit comments