autotouch-cli 0.2.13__tar.gz → 0.2.18__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/PKG-INFO +36 -1
  2. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/PKG-INFO +36 -1
  3. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/SOURCES.txt +1 -0
  4. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/docs/research-table/reference/autotouch-cli-pypi.md +35 -0
  5. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/pyproject.toml +1 -1
  6. autotouch_cli-0.2.18/scripts/migrations/20260303_add_webhook_subscription_collections.py +124 -0
  7. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/smart_table_cli.py +340 -0
  8. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/dependency_links.txt +0 -0
  9. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/entry_points.txt +0 -0
  10. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/requires.txt +0 -0
  11. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/autotouch_cli.egg-info/top_level.txt +0 -0
  12. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/__init__.py +0 -0
  13. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/add_column_unique_index.py +0 -0
  14. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/attach_csv_import_leads_to_research_table.py +0 -0
  15. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/bundle_sequences_backend.py +0 -0
  16. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/check_agent_traces.py +0 -0
  17. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/check_column_mode.py +0 -0
  18. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/exit_terminal_leads_from_sequences.py +0 -0
  19. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/fetch_lead.py +0 -0
  20. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/fix_lead_titles_from_csv.py +0 -0
  21. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250106_add_column_position.py +0 -0
  22. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250108_fix_legacy_column_fields.py +0 -0
  23. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250109_add_user_fields_to_tables.py +0 -0
  24. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250117_add_call_logs_webhook_indexes.py +0 -0
  25. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250117_rename_call_logs_collection.py +0 -0
  26. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250119_create_leads_unique_email_index.py +0 -0
  27. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250123_add_filter_indexes.py +0 -0
  28. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250123_add_llm_responses_collection.py +0 -0
  29. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250128_migrate_user_ids_to_objectid.py +0 -0
  30. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250208_backfill_task_research_values.py +0 -0
  31. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250604_add_origin_indexes.py +0 -0
  32. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250608_cleanup_agent_metadata.py +0 -0
  33. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250608_rename_agent_metadata_to_metadata.py +0 -0
  34. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250922_add_activity_indexes.py +0 -0
  35. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250926_migrate_single_to_arrays.py +0 -0
  36. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250928_add_missing_timestamp_fields.py +0 -0
  37. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250929_add_task_join_indexes.py +0 -0
  38. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250929_add_task_join_indexes_safe.py +0 -0
  39. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20250929_create_shared_phone_cache.py +0 -0
  40. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20251007_add_rows_position_id_index.py +0 -0
  41. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20251109_add_ttl_for_llm_and_preview_traces.py +0 -0
  42. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20260113_normalize_table_filter_operators.py +0 -0
  43. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20260113_set_user_permissions_user_admin.py +0 -0
  44. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/20260204_sync_lead_owner_from_tasks.py +0 -0
  45. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/migrate_org_user_credits.py +0 -0
  46. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/set_default_lead_status.py +0 -0
  47. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/migrations/update_lead_owner_from_tasks.py +0 -0
  48. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/reassign_sequence_owner.py +0 -0
  49. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/run_sidecar_orchestrator_demo.py +0 -0
  50. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/test_crm_company_policy.py +0 -0
  51. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/test_sequences_instantly_e2e.py +0 -0
  52. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/test_sequences_personal_e2e.py +0 -0
  53. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/test_task_error_logger.py +0 -0
  54. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/scripts/verify_azurite_voicemail.py +0 -0
  55. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/setup.cfg +0 -0
  56. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_custom.py +0 -0
  57. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_integration.py +0 -0
  58. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_multi_titles.py +0 -0
  59. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_pipeline.py +0 -0
  60. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_simple.py +0 -0
  61. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_contactout_v2_bulk.py +0 -0
  62. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_lead_required_fields.py +0 -0
  63. {autotouch_cli-0.2.13 → autotouch_cli-0.2.18}/tests/test_phone_provider_pipeline.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autotouch-cli
3
- Version: 0.2.13
3
+ Version: 0.2.18
4
4
  Summary: Autotouch Smart Table CLI
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -140,6 +140,8 @@ Recipe-first flow (recommended):
140
140
 
141
141
  ```bash
142
142
  autotouch columns recipe --type add_to_crm --output human
143
+ autotouch columns recipe --type sync_to_table --output human
144
+ autotouch columns recipe --type add_to_sequence --output human
143
145
  ```
144
146
 
145
147
  Then create from the generated payload:
@@ -155,6 +157,12 @@ Notes:
155
157
  - `add_to_crm` is optional and non-billable.
156
158
  - Email/phone enrichment does not require creating/running `add_to_crm`.
157
159
  - For `add_to_crm`, required mapping keys are `linkedinUrl` and `companyDomain`.
160
+ - `sync_to_table` supports both:
161
+ - single destination: `destinationTableId` + `columnMappings`
162
+ - router mode: `routes[]` (first matching route wins)
163
+ - `add_to_sequence` requires:
164
+ - `sequenceId`
165
+ - `sourceLeadColumn` pointing to a lead-id producing column (`add_to_crm` or `lead_finder` output)
158
166
 
159
167
  ## Recommended ICP buyer discovery pattern
160
168
 
@@ -187,6 +195,33 @@ Important:
187
195
  - These workflow routes support `actorUserId` query parameter.
188
196
  - External sequence validation rules (manual vs automated vs AI draft constraints) are documented in the workflow reference above.
189
197
 
198
+ ## Outbound webhook subscriptions
199
+
200
+ Use webhook subscriptions to receive customer-facing event notifications.
201
+
202
+ ```bash
203
+ autotouch webhooks subscriptions list
204
+
205
+ autotouch webhooks subscriptions create \
206
+ --url https://example.com/webhooks/smart-table \
207
+ --events bulk_job.* lead.status_changed sequence_enrollment.created task.created
208
+
209
+ autotouch webhooks subscriptions test \
210
+ --subscription-id <SUBSCRIPTION_ID> \
211
+ --event-type lead.created \
212
+ --data-json '{"ping":"ok"}'
213
+ autotouch webhooks deliveries list --subscription-id <SUBSCRIPTION_ID>
214
+ autotouch webhooks deliveries attempts --delivery-id <DELIVERY_ID>
215
+ ```
216
+
217
+ Developer key scopes:
218
+ - `webhooks:read`
219
+ - `webhooks:write`
220
+
221
+ Retention note:
222
+ - Webhook event cache and delivery-attempt logs default to 7 days
223
+ (`WEBHOOK_EVENTS_TTL_DAYS`, `WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS`).
224
+
190
225
  ## Create basic/manual fields (text, number, date, etc.)
191
226
 
192
227
  Use `kind=manual` for non-enrichment columns.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: autotouch-cli
3
- Version: 0.2.13
3
+ Version: 0.2.18
4
4
  Summary: Autotouch Smart Table CLI
5
5
  Requires-Python: >=3.9
6
6
  Description-Content-Type: text/markdown
@@ -140,6 +140,8 @@ Recipe-first flow (recommended):
140
140
 
141
141
  ```bash
142
142
  autotouch columns recipe --type add_to_crm --output human
143
+ autotouch columns recipe --type sync_to_table --output human
144
+ autotouch columns recipe --type add_to_sequence --output human
143
145
  ```
144
146
 
145
147
  Then create from the generated payload:
@@ -155,6 +157,12 @@ Notes:
155
157
  - `add_to_crm` is optional and non-billable.
156
158
  - Email/phone enrichment does not require creating/running `add_to_crm`.
157
159
  - For `add_to_crm`, required mapping keys are `linkedinUrl` and `companyDomain`.
160
+ - `sync_to_table` supports both:
161
+ - single destination: `destinationTableId` + `columnMappings`
162
+ - router mode: `routes[]` (first matching route wins)
163
+ - `add_to_sequence` requires:
164
+ - `sequenceId`
165
+ - `sourceLeadColumn` pointing to a lead-id producing column (`add_to_crm` or `lead_finder` output)
158
166
 
159
167
  ## Recommended ICP buyer discovery pattern
160
168
 
@@ -187,6 +195,33 @@ Important:
187
195
  - These workflow routes support `actorUserId` query parameter.
188
196
  - External sequence validation rules (manual vs automated vs AI draft constraints) are documented in the workflow reference above.
189
197
 
198
+ ## Outbound webhook subscriptions
199
+
200
+ Use webhook subscriptions to receive customer-facing event notifications.
201
+
202
+ ```bash
203
+ autotouch webhooks subscriptions list
204
+
205
+ autotouch webhooks subscriptions create \
206
+ --url https://example.com/webhooks/smart-table \
207
+ --events bulk_job.* lead.status_changed sequence_enrollment.created task.created
208
+
209
+ autotouch webhooks subscriptions test \
210
+ --subscription-id <SUBSCRIPTION_ID> \
211
+ --event-type lead.created \
212
+ --data-json '{"ping":"ok"}'
213
+ autotouch webhooks deliveries list --subscription-id <SUBSCRIPTION_ID>
214
+ autotouch webhooks deliveries attempts --delivery-id <DELIVERY_ID>
215
+ ```
216
+
217
+ Developer key scopes:
218
+ - `webhooks:read`
219
+ - `webhooks:write`
220
+
221
+ Retention note:
222
+ - Webhook event cache and delivery-attempt logs default to 7 days
223
+ (`WEBHOOK_EVENTS_TTL_DAYS`, `WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS`).
224
+
190
225
  ## Create basic/manual fields (text, number, date, etc.)
191
226
 
192
227
  Use `kind=manual` for non-enrichment columns.
@@ -47,6 +47,7 @@ scripts/migrations/20251109_add_ttl_for_llm_and_preview_traces.py
47
47
  scripts/migrations/20260113_normalize_table_filter_operators.py
48
48
  scripts/migrations/20260113_set_user_permissions_user_admin.py
49
49
  scripts/migrations/20260204_sync_lead_owner_from_tasks.py
50
+ scripts/migrations/20260303_add_webhook_subscription_collections.py
50
51
  scripts/migrations/migrate_org_user_credits.py
51
52
  scripts/migrations/set_default_lead_status.py
52
53
  scripts/migrations/update_lead_owner_from_tasks.py
@@ -131,6 +131,8 @@ Recipe-first flow (recommended):
131
131
 
132
132
  ```bash
133
133
  autotouch columns recipe --type add_to_crm --output human
134
+ autotouch columns recipe --type sync_to_table --output human
135
+ autotouch columns recipe --type add_to_sequence --output human
134
136
  ```
135
137
 
136
138
  Then create from the generated payload:
@@ -146,6 +148,12 @@ Notes:
146
148
  - `add_to_crm` is optional and non-billable.
147
149
  - Email/phone enrichment does not require creating/running `add_to_crm`.
148
150
  - For `add_to_crm`, required mapping keys are `linkedinUrl` and `companyDomain`.
151
+ - `sync_to_table` supports both:
152
+ - single destination: `destinationTableId` + `columnMappings`
153
+ - router mode: `routes[]` (first matching route wins)
154
+ - `add_to_sequence` requires:
155
+ - `sequenceId`
156
+ - `sourceLeadColumn` pointing to a lead-id producing column (`add_to_crm` or `lead_finder` output)
149
157
 
150
158
  ## Recommended ICP buyer discovery pattern
151
159
 
@@ -178,6 +186,33 @@ Important:
178
186
  - These workflow routes support `actorUserId` query parameter.
179
187
  - External sequence validation rules (manual vs automated vs AI draft constraints) are documented in the workflow reference above.
180
188
 
189
+ ## Outbound webhook subscriptions
190
+
191
+ Use webhook subscriptions to receive customer-facing event notifications.
192
+
193
+ ```bash
194
+ autotouch webhooks subscriptions list
195
+
196
+ autotouch webhooks subscriptions create \
197
+ --url https://example.com/webhooks/smart-table \
198
+ --events bulk_job.* lead.status_changed sequence_enrollment.created task.created
199
+
200
+ autotouch webhooks subscriptions test \
201
+ --subscription-id <SUBSCRIPTION_ID> \
202
+ --event-type lead.created \
203
+ --data-json '{"ping":"ok"}'
204
+ autotouch webhooks deliveries list --subscription-id <SUBSCRIPTION_ID>
205
+ autotouch webhooks deliveries attempts --delivery-id <DELIVERY_ID>
206
+ ```
207
+
208
+ Developer key scopes:
209
+ - `webhooks:read`
210
+ - `webhooks:write`
211
+
212
+ Retention note:
213
+ - Webhook event cache and delivery-attempt logs default to 7 days
214
+ (`WEBHOOK_EVENTS_TTL_DAYS`, `WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS`).
215
+
181
216
  ## Create basic/manual fields (text, number, date, etc.)
182
217
 
183
218
  Use `kind=manual` for non-enrichment columns.
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "autotouch-cli"
7
- version = "0.2.13"
7
+ version = "0.2.18"
8
8
  description = "Autotouch Smart Table CLI"
9
9
  readme = "docs/research-table/reference/autotouch-cli-pypi.md"
10
10
  requires-python = ">=3.9"
@@ -0,0 +1,124 @@
1
+ """
2
+ Create outbound webhook subscription/outbox collections and indexes.
3
+ Also ensures 7-day default TTL retention for webhook event cache and attempt logs
4
+ (configurable via WEBHOOK_EVENTS_TTL_DAYS / WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS).
5
+
6
+ Usage:
7
+ python3 scripts/migrations/20260303_add_webhook_subscription_collections.py \
8
+ --uri "<mongodb uri>" --db autotouch
9
+ """
10
+
11
+ from __future__ import annotations
12
+
13
+ import argparse
14
+ import os
15
+ from pymongo import MongoClient
16
+
17
+
18
+ WEBHOOK_EVENTS_TTL_DAYS = max(1, min(365, int(os.getenv("WEBHOOK_EVENTS_TTL_DAYS", "7") or 7)))
19
+ WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS = max(
20
+ 1, min(365, int(os.getenv("WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS", "7") or 7))
21
+ )
22
+ WEBHOOK_EVENTS_TTL_SECONDS = WEBHOOK_EVENTS_TTL_DAYS * 24 * 60 * 60
23
+ WEBHOOK_DELIVERY_ATTEMPTS_TTL_SECONDS = WEBHOOK_DELIVERY_ATTEMPTS_TTL_DAYS * 24 * 60 * 60
24
+
25
+
26
+ def ensure_indexes(db) -> None:
27
+ db.webhook_subscriptions.create_index(
28
+ [("organization_id", 1), ("enabled", 1), ("updated_at", -1)],
29
+ name="webhook_subscriptions_org_enabled_updated",
30
+ background=True,
31
+ )
32
+ db.webhook_subscriptions.create_index(
33
+ [("organization_id", 1), ("events", 1)],
34
+ name="webhook_subscriptions_org_events",
35
+ background=True,
36
+ )
37
+
38
+ db.webhook_events.create_index(
39
+ [("event_id", 1)],
40
+ name="webhook_events_event_id_unique",
41
+ unique=True,
42
+ background=True,
43
+ )
44
+ db.webhook_events.create_index(
45
+ [("organization_id", 1), ("occurred_at", -1)],
46
+ name="webhook_events_org_occurred",
47
+ background=True,
48
+ )
49
+ db.webhook_events.create_index(
50
+ [("type", 1), ("occurred_at", -1)],
51
+ name="webhook_events_type_occurred",
52
+ background=True,
53
+ )
54
+ db.webhook_events.create_index(
55
+ [("created_at", 1)],
56
+ name="webhook_events_created_ttl",
57
+ expireAfterSeconds=WEBHOOK_EVENTS_TTL_SECONDS,
58
+ background=True,
59
+ )
60
+
61
+ db.webhook_deliveries.create_index(
62
+ [("delivery_id", 1)],
63
+ name="webhook_deliveries_delivery_id_unique",
64
+ unique=True,
65
+ background=True,
66
+ )
67
+ db.webhook_deliveries.create_index(
68
+ [("organization_id", 1), ("status", 1), ("created_at", -1)],
69
+ name="webhook_deliveries_org_status_created",
70
+ background=True,
71
+ )
72
+ db.webhook_deliveries.create_index(
73
+ [("subscription_id", 1), ("created_at", -1)],
74
+ name="webhook_deliveries_subscription_created",
75
+ background=True,
76
+ )
77
+ db.webhook_deliveries.create_index(
78
+ [("next_attempt_at", 1), ("status", 1)],
79
+ name="webhook_deliveries_next_attempt_status",
80
+ background=True,
81
+ )
82
+
83
+ db.webhook_delivery_attempts.create_index(
84
+ [("delivery_id", 1), ("attempt_number", 1)],
85
+ name="webhook_delivery_attempts_delivery_attempt_unique",
86
+ unique=True,
87
+ background=True,
88
+ )
89
+ db.webhook_delivery_attempts.create_index(
90
+ [("delivery_id", 1), ("created_at", -1)],
91
+ name="webhook_delivery_attempts_delivery_created",
92
+ background=True,
93
+ )
94
+ db.webhook_delivery_attempts.create_index(
95
+ [("created_at", 1)],
96
+ name="webhook_delivery_attempts_created_ttl",
97
+ expireAfterSeconds=WEBHOOK_DELIVERY_ATTEMPTS_TTL_SECONDS,
98
+ background=True,
99
+ )
100
+
101
+
102
+ def main() -> None:
103
+ parser = argparse.ArgumentParser(description="Ensure webhook subscription/outbox indexes")
104
+ parser.add_argument("--uri", required=True, help="MongoDB URI")
105
+ parser.add_argument("--db", default="autotouch", help="Database name")
106
+ parser.add_argument(
107
+ "--tls-insecure",
108
+ action="store_true",
109
+ help="Allow invalid TLS certificates (for local trust-store issues)",
110
+ )
111
+ args = parser.parse_args()
112
+
113
+ client_kwargs = {}
114
+ if args.tls_insecure:
115
+ client_kwargs["tlsAllowInvalidCertificates"] = True
116
+
117
+ client = MongoClient(args.uri, **client_kwargs)
118
+ db = client[args.db]
119
+ ensure_indexes(db)
120
+ print("Webhook subscription indexes ensured")
121
+
122
+
123
+ if __name__ == "__main__":
124
+ main()
@@ -77,6 +77,8 @@ COLUMN_RECIPE_TYPES = [
77
77
  "lead_finder",
78
78
  "llm_enrichment",
79
79
  "add_to_crm",
80
+ "sync_to_table",
81
+ "add_to_sequence",
80
82
  ]
81
83
 
82
84
  COLUMN_CREATE_RECIPES: Dict[str, Dict[str, Any]] = {
@@ -181,6 +183,36 @@ COLUMN_CREATE_RECIPES: Dict[str, Dict[str, Any]] = {
181
183
  ],
182
184
  },
183
185
  },
186
+ "sync_to_table": {
187
+ "key": "sync_to_table",
188
+ "label": "Sync to Table",
189
+ "kind": "enrichment",
190
+ "dataType": "json",
191
+ "origin": "manual",
192
+ "autoRun": "onSourceUpdate",
193
+ "config": {
194
+ "provider": "sync_to_table",
195
+ "destinationTableId": "<DESTINATION_TABLE_ID>",
196
+ "columnMappings": [
197
+ {"sourceKey": "company", "destKey": "company"},
198
+ {"sourceKey": "domain", "destKey": "company_domain"},
199
+ {"sourceKey": "work_email", "destKey": "work_email"},
200
+ ],
201
+ },
202
+ },
203
+ "add_to_sequence": {
204
+ "key": "add_to_sequence",
205
+ "label": "Add to Sequence",
206
+ "kind": "enrichment",
207
+ "dataType": "json",
208
+ "origin": "manual",
209
+ "autoRun": "onSourceUpdate",
210
+ "config": {
211
+ "provider": "add_to_sequence",
212
+ "sequenceId": "<SEQUENCE_ID>",
213
+ "sourceLeadColumn": "add_to_leads",
214
+ },
215
+ },
184
216
  }
185
217
 
186
218
  COLUMN_RECIPE_NOTES: Dict[str, List[str]] = {
@@ -201,6 +233,14 @@ COLUMN_RECIPE_NOTES: Dict[str, List[str]] = {
201
233
  "LinkedIn URL + company domain mappings are required for eligibility.",
202
234
  "Add to CRM is optional and non-billable.",
203
235
  ],
236
+ "sync_to_table": [
237
+ "Use destinationTableId + columnMappings for single-destination sync.",
238
+ "Router mode is supported via config.routes[] (first matching route wins).",
239
+ ],
240
+ "add_to_sequence": [
241
+ "sourceLeadColumn should reference a column that stores lead IDs (for example add_to_crm or lead_finder output).",
242
+ "Set sequenceId to the target workflow sequence ID.",
243
+ ],
204
244
  }
205
245
 
206
246
  RUN_SOP_GUIDE: Dict[str, Any] = {
@@ -2718,6 +2758,225 @@ def cmd_webhooks_ingest(args: argparse.Namespace) -> None:
2718
2758
  _print_json(data, compact=args.compact)
2719
2759
 
2720
2760
 
2761
+ def cmd_webhooks_subscriptions_list(args: argparse.Namespace) -> None:
2762
+ token = _resolve_token(args.token, required=True)
2763
+ params: Dict[str, Any] = {"limit": int(args.limit or 100)}
2764
+ if args.include_disabled:
2765
+ params["includeDisabled"] = True
2766
+ data = _request_api(
2767
+ "GET",
2768
+ "/api/webhook-subscriptions",
2769
+ base_url=args.base_url,
2770
+ token=token,
2771
+ use_x_api_key=args.use_x_api_key,
2772
+ params=params,
2773
+ timeout=args.timeout,
2774
+ verbose=args.verbose,
2775
+ )
2776
+ _print_json(data, compact=args.compact)
2777
+
2778
+
2779
+ def cmd_webhooks_subscriptions_create(args: argparse.Namespace) -> None:
2780
+ token = _resolve_token(args.token, required=True)
2781
+ payload = _load_json_input(
2782
+ inline_json=args.data_json,
2783
+ file_path=args.data_file,
2784
+ context="data",
2785
+ default=None,
2786
+ )
2787
+ if payload is None:
2788
+ payload = {
2789
+ "url": args.url,
2790
+ "events": args.events or [],
2791
+ "enabled": not bool(args.paused),
2792
+ "filters": _load_json_input(
2793
+ inline_json=args.filters_json,
2794
+ file_path=args.filters_file,
2795
+ context="filters",
2796
+ default={},
2797
+ )
2798
+ or {},
2799
+ "metadata": _load_json_input(
2800
+ inline_json=args.metadata_json,
2801
+ file_path=args.metadata_file,
2802
+ context="metadata",
2803
+ default={},
2804
+ )
2805
+ or {},
2806
+ }
2807
+ if args.retry_policy_json or args.retry_policy_file:
2808
+ payload["retryPolicy"] = _load_json_input(
2809
+ inline_json=args.retry_policy_json,
2810
+ file_path=args.retry_policy_file,
2811
+ context="retry-policy",
2812
+ default={},
2813
+ ) or {}
2814
+ data = _request_api(
2815
+ "POST",
2816
+ "/api/webhook-subscriptions",
2817
+ base_url=args.base_url,
2818
+ token=token,
2819
+ use_x_api_key=args.use_x_api_key,
2820
+ payload=payload,
2821
+ timeout=args.timeout,
2822
+ verbose=args.verbose,
2823
+ )
2824
+ _print_json(data, compact=args.compact)
2825
+
2826
+
2827
+ def cmd_webhooks_subscriptions_get(args: argparse.Namespace) -> None:
2828
+ token = _resolve_token(args.token, required=True)
2829
+ data = _request_api(
2830
+ "GET",
2831
+ f"/api/webhook-subscriptions/{args.subscription_id}",
2832
+ base_url=args.base_url,
2833
+ token=token,
2834
+ use_x_api_key=args.use_x_api_key,
2835
+ timeout=args.timeout,
2836
+ verbose=args.verbose,
2837
+ )
2838
+ _print_json(data, compact=args.compact)
2839
+
2840
+
2841
+ def cmd_webhooks_subscriptions_update(args: argparse.Namespace) -> None:
2842
+ token = _resolve_token(args.token, required=True)
2843
+ payload = _load_json_input(
2844
+ inline_json=args.data_json,
2845
+ file_path=args.data_file,
2846
+ context="data",
2847
+ default={},
2848
+ )
2849
+ data = _request_api(
2850
+ "PATCH",
2851
+ f"/api/webhook-subscriptions/{args.subscription_id}",
2852
+ base_url=args.base_url,
2853
+ token=token,
2854
+ use_x_api_key=args.use_x_api_key,
2855
+ payload=payload,
2856
+ timeout=args.timeout,
2857
+ verbose=args.verbose,
2858
+ )
2859
+ _print_json(data, compact=args.compact)
2860
+
2861
+
2862
+ def cmd_webhooks_subscriptions_delete(args: argparse.Namespace) -> None:
2863
+ token = _resolve_token(args.token, required=True)
2864
+ data = _request_api(
2865
+ "DELETE",
2866
+ f"/api/webhook-subscriptions/{args.subscription_id}",
2867
+ base_url=args.base_url,
2868
+ token=token,
2869
+ use_x_api_key=args.use_x_api_key,
2870
+ timeout=args.timeout,
2871
+ verbose=args.verbose,
2872
+ )
2873
+ _print_json(data, compact=args.compact)
2874
+
2875
+
2876
+ def cmd_webhooks_subscriptions_pause(args: argparse.Namespace) -> None:
2877
+ token = _resolve_token(args.token, required=True)
2878
+ data = _request_api(
2879
+ "POST",
2880
+ f"/api/webhook-subscriptions/{args.subscription_id}/pause",
2881
+ base_url=args.base_url,
2882
+ token=token,
2883
+ use_x_api_key=args.use_x_api_key,
2884
+ timeout=args.timeout,
2885
+ verbose=args.verbose,
2886
+ )
2887
+ _print_json(data, compact=args.compact)
2888
+
2889
+
2890
+ def cmd_webhooks_subscriptions_resume(args: argparse.Namespace) -> None:
2891
+ token = _resolve_token(args.token, required=True)
2892
+ data = _request_api(
2893
+ "POST",
2894
+ f"/api/webhook-subscriptions/{args.subscription_id}/resume",
2895
+ base_url=args.base_url,
2896
+ token=token,
2897
+ use_x_api_key=args.use_x_api_key,
2898
+ timeout=args.timeout,
2899
+ verbose=args.verbose,
2900
+ )
2901
+ _print_json(data, compact=args.compact)
2902
+
2903
+
2904
+ def cmd_webhooks_subscriptions_rotate_secret(args: argparse.Namespace) -> None:
2905
+ token = _resolve_token(args.token, required=True)
2906
+ data = _request_api(
2907
+ "POST",
2908
+ f"/api/webhook-subscriptions/{args.subscription_id}/rotate-secret",
2909
+ base_url=args.base_url,
2910
+ token=token,
2911
+ use_x_api_key=args.use_x_api_key,
2912
+ timeout=args.timeout,
2913
+ verbose=args.verbose,
2914
+ )
2915
+ _print_json(data, compact=args.compact)
2916
+
2917
+
2918
+ def cmd_webhooks_subscriptions_test(args: argparse.Namespace) -> None:
2919
+ token = _resolve_token(args.token, required=True)
2920
+ payload = _load_json_input(
2921
+ inline_json=args.data_json,
2922
+ file_path=args.data_file,
2923
+ context="data",
2924
+ default={},
2925
+ )
2926
+ request_payload: Dict[str, Any] = {"data": payload or {}}
2927
+ if getattr(args, "event_type", None):
2928
+ request_payload["eventType"] = str(args.event_type).strip()
2929
+ data = _request_api(
2930
+ "POST",
2931
+ f"/api/webhook-subscriptions/{args.subscription_id}/test",
2932
+ base_url=args.base_url,
2933
+ token=token,
2934
+ use_x_api_key=args.use_x_api_key,
2935
+ payload=request_payload,
2936
+ timeout=args.timeout,
2937
+ verbose=args.verbose,
2938
+ )
2939
+ _print_json(data, compact=args.compact)
2940
+
2941
+
2942
+ def cmd_webhooks_deliveries_list(args: argparse.Namespace) -> None:
2943
+ token = _resolve_token(args.token, required=True)
2944
+ params: Dict[str, Any] = {"limit": int(args.limit or 100)}
2945
+ if args.subscription_id:
2946
+ params["subscriptionId"] = args.subscription_id
2947
+ if args.status:
2948
+ params["status"] = args.status
2949
+ if args.event_type:
2950
+ params["eventType"] = args.event_type
2951
+ data = _request_api(
2952
+ "GET",
2953
+ "/api/webhook-subscriptions/deliveries",
2954
+ base_url=args.base_url,
2955
+ token=token,
2956
+ use_x_api_key=args.use_x_api_key,
2957
+ params=params,
2958
+ timeout=args.timeout,
2959
+ verbose=args.verbose,
2960
+ )
2961
+ _print_json(data, compact=args.compact)
2962
+
2963
+
2964
+ def cmd_webhooks_deliveries_attempts(args: argparse.Namespace) -> None:
2965
+ token = _resolve_token(args.token, required=True)
2966
+ params: Dict[str, Any] = {"limit": int(args.limit or 100)}
2967
+ data = _request_api(
2968
+ "GET",
2969
+ f"/api/webhook-subscriptions/deliveries/{args.delivery_id}/attempts",
2970
+ base_url=args.base_url,
2971
+ token=token,
2972
+ use_x_api_key=args.use_x_api_key,
2973
+ params=params,
2974
+ timeout=args.timeout,
2975
+ verbose=args.verbose,
2976
+ )
2977
+ _print_json(data, compact=args.compact)
2978
+
2979
+
2721
2980
  def _mongo_client(uri: Optional[str], db_name: Optional[str]):
2722
2981
  if MongoClient is None:
2723
2982
  print("ERROR: pymongo not installed. Install requirements and retry.", file=sys.stderr)
@@ -3109,6 +3368,87 @@ def build_parser() -> argparse.ArgumentParser:
3109
3368
  pwhi.add_argument("--verbose", action="store_true", help="Print request metadata to stderr")
3110
3369
  pwhi.set_defaults(func=cmd_webhooks_ingest)
3111
3370
 
3371
+ pwhs = wh_sub.add_parser("subscriptions", help="Manage outbound webhook subscriptions")
3372
+ whs_sub = pwhs.add_subparsers(dest="webhooks_subscriptions_cmd", required=True)
3373
+
3374
+ pwhsl = whs_sub.add_parser("list", help="List webhook subscriptions")
3375
+ pwhsl.add_argument("--include-disabled", action="store_true", help="Include paused/disabled subscriptions")
3376
+ pwhsl.add_argument("--limit", type=int, default=100, help="Max subscriptions to return (1-500)")
3377
+ _add_api_common_arguments(pwhsl)
3378
+ pwhsl.set_defaults(func=cmd_webhooks_subscriptions_list)
3379
+
3380
+ pwhsc = whs_sub.add_parser("create", help="Create a webhook subscription")
3381
+ pwhsc.add_argument("--url", help="Webhook endpoint URL")
3382
+ pwhsc.add_argument("--events", nargs="*", help="Event names or families (for example bulk_job.*)")
3383
+ pwhsc.add_argument("--paused", action="store_true", help="Create subscription as paused/disabled")
3384
+ pwhsc.add_argument("--filters-json", help="Optional filters JSON")
3385
+ pwhsc.add_argument("--filters-file", help="Optional filters JSON file")
3386
+ pwhsc.add_argument("--metadata-json", help="Optional metadata JSON")
3387
+ pwhsc.add_argument("--metadata-file", help="Optional metadata JSON file")
3388
+ pwhsc.add_argument("--retry-policy-json", help="Optional retryPolicy JSON")
3389
+ pwhsc.add_argument("--retry-policy-file", help="Optional retryPolicy JSON file")
3390
+ pwhsc.add_argument("--data-json", help="Full request payload JSON")
3391
+ pwhsc.add_argument("--data-file", help="Full request payload JSON file")
3392
+ _add_api_common_arguments(pwhsc)
3393
+ pwhsc.set_defaults(func=cmd_webhooks_subscriptions_create)
3394
+
3395
+ pwhsg = whs_sub.add_parser("get", help="Get a webhook subscription")
3396
+ pwhsg.add_argument("--subscription-id", required=True)
3397
+ _add_api_common_arguments(pwhsg)
3398
+ pwhsg.set_defaults(func=cmd_webhooks_subscriptions_get)
3399
+
3400
+ pwhsu = whs_sub.add_parser("update", help="Update a webhook subscription")
3401
+ pwhsu.add_argument("--subscription-id", required=True)
3402
+ pwhsu.add_argument("--data-json", help="Patch payload JSON")
3403
+ pwhsu.add_argument("--data-file", help="Patch payload JSON file")
3404
+ _add_api_common_arguments(pwhsu)
3405
+ pwhsu.set_defaults(func=cmd_webhooks_subscriptions_update)
3406
+
3407
+ pwhsd = whs_sub.add_parser("delete", help="Delete a webhook subscription")
3408
+ pwhsd.add_argument("--subscription-id", required=True)
3409
+ _add_api_common_arguments(pwhsd)
3410
+ pwhsd.set_defaults(func=cmd_webhooks_subscriptions_delete)
3411
+
3412
+ pwhsp = whs_sub.add_parser("pause", help="Pause a webhook subscription")
3413
+ pwhsp.add_argument("--subscription-id", required=True)
3414
+ _add_api_common_arguments(pwhsp)
3415
+ pwhsp.set_defaults(func=cmd_webhooks_subscriptions_pause)
3416
+
3417
+ pwhsr = whs_sub.add_parser("resume", help="Resume a paused webhook subscription")
3418
+ pwhsr.add_argument("--subscription-id", required=True)
3419
+ _add_api_common_arguments(pwhsr)
3420
+ pwhsr.set_defaults(func=cmd_webhooks_subscriptions_resume)
3421
+
3422
+ pwhsrs = whs_sub.add_parser("rotate-secret", help="Rotate webhook subscription signing secret")
3423
+ pwhsrs.add_argument("--subscription-id", required=True)
3424
+ _add_api_common_arguments(pwhsrs)
3425
+ pwhsrs.set_defaults(func=cmd_webhooks_subscriptions_rotate_secret)
3426
+
3427
+ pwhst = whs_sub.add_parser("test", help="Fire a test event for a subscription")
3428
+ pwhst.add_argument("--subscription-id", required=True)
3429
+ pwhst.add_argument("--event-type", help="Optional event type (for example lead.created)")
3430
+ pwhst.add_argument("--data-json", help="Optional test payload JSON")
3431
+ pwhst.add_argument("--data-file", help="Optional test payload JSON file")
3432
+ _add_api_common_arguments(pwhst)
3433
+ pwhst.set_defaults(func=cmd_webhooks_subscriptions_test)
3434
+
3435
+ pwhd = wh_sub.add_parser("deliveries", help="Inspect webhook delivery outcomes")
3436
+ whd_sub = pwhd.add_subparsers(dest="webhooks_deliveries_cmd", required=True)
3437
+
3438
+ pwhdl = whd_sub.add_parser("list", help="List webhook deliveries")
3439
+ pwhdl.add_argument("--subscription-id", help="Filter by subscription id")
3440
+ pwhdl.add_argument("--status", help="Filter by status (queued/retry_scheduled/succeeded/failed)")
3441
+ pwhdl.add_argument("--event-type", help="Filter by event type")
3442
+ pwhdl.add_argument("--limit", type=int, default=100, help="Max deliveries to return (1-500)")
3443
+ _add_api_common_arguments(pwhdl)
3444
+ pwhdl.set_defaults(func=cmd_webhooks_deliveries_list)
3445
+
3446
+ pwhda = whd_sub.add_parser("attempts", help="List delivery attempts for one delivery id")
3447
+ pwhda.add_argument("--delivery-id", required=True)
3448
+ pwhda.add_argument("--limit", type=int, default=100, help="Max attempts to return (1-500)")
3449
+ _add_api_common_arguments(pwhda)
3450
+ pwhda.set_defaults(func=cmd_webhooks_deliveries_attempts)
3451
+
3112
3452
  # Backward-compatible aliases
3113
3453
  # run
3114
3454
  palias_run = sub.add_parser("run", help="Alias for: columns run")
File without changes