webhook-platform 1.1.0__tar.gz → 2.0.0__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 (20) hide show
  1. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/PKG-INFO +102 -18
  2. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/README.md +100 -16
  3. {webhook_platform-1.1.0/webhook_platform → webhook_platform-2.0.0/hookflow}/__init__.py +29 -4
  4. {webhook_platform-1.1.0/webhook_platform → webhook_platform-2.0.0/hookflow}/client.py +184 -14
  5. {webhook_platform-1.1.0/webhook_platform → webhook_platform-2.0.0/hookflow}/errors.py +7 -7
  6. webhook_platform-2.0.0/hookflow/types.py +598 -0
  7. {webhook_platform-1.1.0/webhook_platform → webhook_platform-2.0.0/hookflow}/webhooks.py +9 -9
  8. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/pyproject.toml +2 -2
  9. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/tests/test_client.py +17 -17
  10. webhook_platform-2.0.0/tests/test_incoming.py +347 -0
  11. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/tests/test_webhooks.py +13 -13
  12. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/webhook_platform.egg-info/PKG-INFO +102 -18
  13. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/webhook_platform.egg-info/SOURCES.txt +6 -5
  14. webhook_platform-2.0.0/webhook_platform.egg-info/top_level.txt +3 -0
  15. webhook_platform-1.1.0/webhook_platform/types.py +0 -287
  16. webhook_platform-1.1.0/webhook_platform.egg-info/top_level.txt +0 -3
  17. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/setup.cfg +0 -0
  18. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/tests/__init__.py +0 -0
  19. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/webhook_platform.egg-info/dependency_links.txt +0 -0
  20. {webhook_platform-1.1.0 → webhook_platform-2.0.0}/webhook_platform.egg-info/requires.txt +0 -0
@@ -1,7 +1,7 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: webhook-platform
3
- Version: 1.1.0
4
- Summary: Official Python SDK for Webhook Platform
3
+ Version: 2.0.0
4
+ Summary: Official Python SDK for Hookflow — reliable webhook infrastructure
5
5
  Author-email: Vadym Kykalo <vadymkykalo@gmail.com>
6
6
  License: MIT
7
7
  Project-URL: Homepage, https://github.com/vadymkykalo/webhook-platform
@@ -29,7 +29,7 @@ Requires-Dist: types-requests>=2.28.0; extra == "dev"
29
29
 
30
30
  # webhook-platform
31
31
 
32
- Official Python SDK for [Webhook Platform](https://github.com/vadymkykalo/webhook-platform).
32
+ Official Python SDK for [Hookflow](https://github.com/vadymkykalo/webhook-platform).
33
33
 
34
34
  ## Installation
35
35
 
@@ -40,9 +40,9 @@ pip install webhook-platform
40
40
  ## Quick Start
41
41
 
42
42
  ```python
43
- from webhook_platform import WebhookPlatform, Event
43
+ from hookflow import Hookflow, Event
44
44
 
45
- client = WebhookPlatform(
45
+ client = Hookflow(
46
46
  api_key="wh_live_your_api_key",
47
47
  base_url="http://localhost:8080", # optional
48
48
  )
@@ -68,7 +68,7 @@ print(f"Deliveries created: {event.deliveries_created}")
68
68
  ### Events
69
69
 
70
70
  ```python
71
- from webhook_platform import Event
71
+ from hookflow import Event
72
72
 
73
73
  # Send event with idempotency key
74
74
  event = client.events.send(
@@ -80,7 +80,7 @@ event = client.events.send(
80
80
  ### Endpoints
81
81
 
82
82
  ```python
83
- from webhook_platform import EndpointCreateParams, EndpointUpdateParams
83
+ from hookflow import EndpointCreateParams, EndpointUpdateParams
84
84
 
85
85
  # Create endpoint
86
86
  endpoint = client.endpoints.create(
@@ -117,7 +117,7 @@ print(f"Test {'passed' if result.success else 'failed'}: {result.latency_ms}ms")
117
117
  ### Subscriptions
118
118
 
119
119
  ```python
120
- from webhook_platform import SubscriptionCreateParams
120
+ from hookflow import SubscriptionCreateParams
121
121
 
122
122
  # Subscribe endpoint to an event type
123
123
  subscription = client.subscriptions.create(
@@ -146,7 +146,7 @@ client.subscriptions.delete(project_id, subscription_id)
146
146
  ### Deliveries
147
147
 
148
148
  ```python
149
- from webhook_platform import DeliveryListParams, DeliveryStatus
149
+ from hookflow import DeliveryListParams, DeliveryStatus
150
150
 
151
151
  # List deliveries with filters
152
152
  deliveries = client.deliveries.list(
@@ -165,12 +165,96 @@ for attempt in attempts:
165
165
  client.deliveries.replay(delivery_id)
166
166
  ```
167
167
 
168
+ ## Incoming Webhooks
169
+
170
+ Receive, validate, and forward webhooks from third-party providers (Stripe, GitHub, Twilio, etc.).
171
+
172
+ ### Incoming Sources
173
+
174
+ ```python
175
+ from hookflow import IncomingSourceCreateParams, IncomingSourceUpdateParams
176
+
177
+ # Create an incoming source with HMAC verification
178
+ source = client.incoming_sources.create(
179
+ project_id,
180
+ IncomingSourceCreateParams(
181
+ name="Stripe Webhooks",
182
+ slug="stripe",
183
+ provider_type="STRIPE",
184
+ verification_mode="HMAC_GENERIC",
185
+ hmac_secret="whsec_...",
186
+ hmac_header_name="Stripe-Signature",
187
+ ),
188
+ )
189
+
190
+ print(f"Ingress URL: {source.ingress_url}")
191
+
192
+ # List sources
193
+ sources = client.incoming_sources.list(project_id)
194
+
195
+ # Update source
196
+ client.incoming_sources.update(
197
+ project_id,
198
+ source_id,
199
+ IncomingSourceUpdateParams(name="Stripe Production", rate_limit_per_second=100),
200
+ )
201
+
202
+ # Delete source
203
+ client.incoming_sources.delete(project_id, source_id)
204
+ ```
205
+
206
+ ### Incoming Destinations
207
+
208
+ ```python
209
+ from hookflow import IncomingDestinationCreateParams
210
+
211
+ # Add a forwarding destination
212
+ dest = client.incoming_sources.create_destination(
213
+ project_id,
214
+ source_id,
215
+ IncomingDestinationCreateParams(
216
+ url="https://your-api.com/webhooks/stripe",
217
+ enabled=True,
218
+ max_attempts=5,
219
+ timeout_seconds=30,
220
+ ),
221
+ )
222
+
223
+ # List destinations
224
+ dests = client.incoming_sources.list_destinations(project_id, source_id)
225
+
226
+ # Delete destination
227
+ client.incoming_sources.delete_destination(project_id, source_id, dest_id)
228
+ ```
229
+
230
+ ### Incoming Events
231
+
232
+ ```python
233
+ from hookflow import IncomingEventListParams
234
+
235
+ # List incoming events (with optional source filter)
236
+ events = client.incoming_events.list(
237
+ project_id,
238
+ IncomingEventListParams(source_id=source.id, page=0, size=20),
239
+ )
240
+
241
+ # Get event details
242
+ event = client.incoming_events.get(project_id, event_id)
243
+
244
+ # Get forward attempts
245
+ attempts = client.incoming_events.get_attempts(project_id, event_id)
246
+
247
+ # Replay event to all destinations
248
+ result = client.incoming_events.replay(project_id, event_id)
249
+ print(f"Replayed to {result.destinations_count} destinations")
250
+ ```
251
+
168
252
  ## Webhook Signature Verification
169
253
 
170
254
  Verify incoming webhooks in your endpoint:
171
255
 
172
256
  ```python
173
- from webhook_platform import verify_signature, construct_event, WebhookPlatformError
257
+ from hookflow import verify_signature, construct_event, HookflowError
174
258
 
175
259
  # Flask example
176
260
  from flask import Flask, request
@@ -198,7 +282,7 @@ def handle_webhook():
198
282
 
199
283
  return "OK", 200
200
284
 
201
- except WebhookPlatformError as e:
285
+ except HookflowError as e:
202
286
  print(f"Webhook verification failed: {e.message}")
203
287
  return "Invalid signature", 400
204
288
  ```
@@ -207,7 +291,7 @@ def handle_webhook():
207
291
 
208
292
  ```python
209
293
  from fastapi import FastAPI, Request, HTTPException
210
- from webhook_platform import construct_event, WebhookPlatformError
294
+ from hookflow import construct_event, HookflowError
211
295
 
212
296
  app = FastAPI()
213
297
 
@@ -226,15 +310,15 @@ async def handle_webhook(request: Request):
226
310
  # Process event...
227
311
  return {"status": "ok"}
228
312
 
229
- except WebhookPlatformError as e:
313
+ except HookflowError as e:
230
314
  raise HTTPException(status_code=400, detail=e.message)
231
315
  ```
232
316
 
233
317
  ## Error Handling
234
318
 
235
319
  ```python
236
- from webhook_platform import (
237
- WebhookPlatformError,
320
+ from hookflow import (
321
+ HookflowError,
238
322
  RateLimitError,
239
323
  AuthenticationError,
240
324
  ValidationError,
@@ -250,14 +334,14 @@ except AuthenticationError:
250
334
  print("Invalid API key")
251
335
  except ValidationError as e:
252
336
  print(f"Validation failed: {e.field_errors}")
253
- except WebhookPlatformError as e:
337
+ except HookflowError as e:
254
338
  print(f"Error {e.status}: {e.message}")
255
339
  ```
256
340
 
257
341
  ## Configuration
258
342
 
259
343
  ```python
260
- client = WebhookPlatform(
344
+ client = Hookflow(
261
345
  api_key="wh_live_xxx", # Required: Your API key
262
346
  base_url="https://api.example.com", # Optional: API base URL
263
347
  timeout=30, # Optional: Request timeout in seconds (default: 30)
@@ -269,7 +353,7 @@ client = WebhookPlatform(
269
353
  This SDK includes full type hints for better IDE support:
270
354
 
271
355
  ```python
272
- from webhook_platform import (
356
+ from hookflow import (
273
357
  Event,
274
358
  EventResponse,
275
359
  Endpoint,
@@ -1,6 +1,6 @@
1
1
  # webhook-platform
2
2
 
3
- Official Python SDK for [Webhook Platform](https://github.com/vadymkykalo/webhook-platform).
3
+ Official Python SDK for [Hookflow](https://github.com/vadymkykalo/webhook-platform).
4
4
 
5
5
  ## Installation
6
6
 
@@ -11,9 +11,9 @@ pip install webhook-platform
11
11
  ## Quick Start
12
12
 
13
13
  ```python
14
- from webhook_platform import WebhookPlatform, Event
14
+ from hookflow import Hookflow, Event
15
15
 
16
- client = WebhookPlatform(
16
+ client = Hookflow(
17
17
  api_key="wh_live_your_api_key",
18
18
  base_url="http://localhost:8080", # optional
19
19
  )
@@ -39,7 +39,7 @@ print(f"Deliveries created: {event.deliveries_created}")
39
39
  ### Events
40
40
 
41
41
  ```python
42
- from webhook_platform import Event
42
+ from hookflow import Event
43
43
 
44
44
  # Send event with idempotency key
45
45
  event = client.events.send(
@@ -51,7 +51,7 @@ event = client.events.send(
51
51
  ### Endpoints
52
52
 
53
53
  ```python
54
- from webhook_platform import EndpointCreateParams, EndpointUpdateParams
54
+ from hookflow import EndpointCreateParams, EndpointUpdateParams
55
55
 
56
56
  # Create endpoint
57
57
  endpoint = client.endpoints.create(
@@ -88,7 +88,7 @@ print(f"Test {'passed' if result.success else 'failed'}: {result.latency_ms}ms")
88
88
  ### Subscriptions
89
89
 
90
90
  ```python
91
- from webhook_platform import SubscriptionCreateParams
91
+ from hookflow import SubscriptionCreateParams
92
92
 
93
93
  # Subscribe endpoint to an event type
94
94
  subscription = client.subscriptions.create(
@@ -117,7 +117,7 @@ client.subscriptions.delete(project_id, subscription_id)
117
117
  ### Deliveries
118
118
 
119
119
  ```python
120
- from webhook_platform import DeliveryListParams, DeliveryStatus
120
+ from hookflow import DeliveryListParams, DeliveryStatus
121
121
 
122
122
  # List deliveries with filters
123
123
  deliveries = client.deliveries.list(
@@ -136,12 +136,96 @@ for attempt in attempts:
136
136
  client.deliveries.replay(delivery_id)
137
137
  ```
138
138
 
139
+ ## Incoming Webhooks
140
+
141
+ Receive, validate, and forward webhooks from third-party providers (Stripe, GitHub, Twilio, etc.).
142
+
143
+ ### Incoming Sources
144
+
145
+ ```python
146
+ from hookflow import IncomingSourceCreateParams, IncomingSourceUpdateParams
147
+
148
+ # Create an incoming source with HMAC verification
149
+ source = client.incoming_sources.create(
150
+ project_id,
151
+ IncomingSourceCreateParams(
152
+ name="Stripe Webhooks",
153
+ slug="stripe",
154
+ provider_type="STRIPE",
155
+ verification_mode="HMAC_GENERIC",
156
+ hmac_secret="whsec_...",
157
+ hmac_header_name="Stripe-Signature",
158
+ ),
159
+ )
160
+
161
+ print(f"Ingress URL: {source.ingress_url}")
162
+
163
+ # List sources
164
+ sources = client.incoming_sources.list(project_id)
165
+
166
+ # Update source
167
+ client.incoming_sources.update(
168
+ project_id,
169
+ source_id,
170
+ IncomingSourceUpdateParams(name="Stripe Production", rate_limit_per_second=100),
171
+ )
172
+
173
+ # Delete source
174
+ client.incoming_sources.delete(project_id, source_id)
175
+ ```
176
+
177
+ ### Incoming Destinations
178
+
179
+ ```python
180
+ from hookflow import IncomingDestinationCreateParams
181
+
182
+ # Add a forwarding destination
183
+ dest = client.incoming_sources.create_destination(
184
+ project_id,
185
+ source_id,
186
+ IncomingDestinationCreateParams(
187
+ url="https://your-api.com/webhooks/stripe",
188
+ enabled=True,
189
+ max_attempts=5,
190
+ timeout_seconds=30,
191
+ ),
192
+ )
193
+
194
+ # List destinations
195
+ dests = client.incoming_sources.list_destinations(project_id, source_id)
196
+
197
+ # Delete destination
198
+ client.incoming_sources.delete_destination(project_id, source_id, dest_id)
199
+ ```
200
+
201
+ ### Incoming Events
202
+
203
+ ```python
204
+ from hookflow import IncomingEventListParams
205
+
206
+ # List incoming events (with optional source filter)
207
+ events = client.incoming_events.list(
208
+ project_id,
209
+ IncomingEventListParams(source_id=source.id, page=0, size=20),
210
+ )
211
+
212
+ # Get event details
213
+ event = client.incoming_events.get(project_id, event_id)
214
+
215
+ # Get forward attempts
216
+ attempts = client.incoming_events.get_attempts(project_id, event_id)
217
+
218
+ # Replay event to all destinations
219
+ result = client.incoming_events.replay(project_id, event_id)
220
+ print(f"Replayed to {result.destinations_count} destinations")
221
+ ```
222
+
139
223
  ## Webhook Signature Verification
140
224
 
141
225
  Verify incoming webhooks in your endpoint:
142
226
 
143
227
  ```python
144
- from webhook_platform import verify_signature, construct_event, WebhookPlatformError
228
+ from hookflow import verify_signature, construct_event, HookflowError
145
229
 
146
230
  # Flask example
147
231
  from flask import Flask, request
@@ -169,7 +253,7 @@ def handle_webhook():
169
253
 
170
254
  return "OK", 200
171
255
 
172
- except WebhookPlatformError as e:
256
+ except HookflowError as e:
173
257
  print(f"Webhook verification failed: {e.message}")
174
258
  return "Invalid signature", 400
175
259
  ```
@@ -178,7 +262,7 @@ def handle_webhook():
178
262
 
179
263
  ```python
180
264
  from fastapi import FastAPI, Request, HTTPException
181
- from webhook_platform import construct_event, WebhookPlatformError
265
+ from hookflow import construct_event, HookflowError
182
266
 
183
267
  app = FastAPI()
184
268
 
@@ -197,15 +281,15 @@ async def handle_webhook(request: Request):
197
281
  # Process event...
198
282
  return {"status": "ok"}
199
283
 
200
- except WebhookPlatformError as e:
284
+ except HookflowError as e:
201
285
  raise HTTPException(status_code=400, detail=e.message)
202
286
  ```
203
287
 
204
288
  ## Error Handling
205
289
 
206
290
  ```python
207
- from webhook_platform import (
208
- WebhookPlatformError,
291
+ from hookflow import (
292
+ HookflowError,
209
293
  RateLimitError,
210
294
  AuthenticationError,
211
295
  ValidationError,
@@ -221,14 +305,14 @@ except AuthenticationError:
221
305
  print("Invalid API key")
222
306
  except ValidationError as e:
223
307
  print(f"Validation failed: {e.field_errors}")
224
- except WebhookPlatformError as e:
308
+ except HookflowError as e:
225
309
  print(f"Error {e.status}: {e.message}")
226
310
  ```
227
311
 
228
312
  ## Configuration
229
313
 
230
314
  ```python
231
- client = WebhookPlatform(
315
+ client = Hookflow(
232
316
  api_key="wh_live_xxx", # Required: Your API key
233
317
  base_url="https://api.example.com", # Optional: API base URL
234
318
  timeout=30, # Optional: Request timeout in seconds (default: 30)
@@ -240,7 +324,7 @@ client = WebhookPlatform(
240
324
  This SDK includes full type hints for better IDE support:
241
325
 
242
326
  ```python
243
- from webhook_platform import (
327
+ from hookflow import (
244
328
  Event,
245
329
  EventResponse,
246
330
  Endpoint,
@@ -1,8 +1,8 @@
1
- """Official Python SDK for Webhook Platform."""
1
+ """Official Python SDK for Hookflow."""
2
2
 
3
- from .client import WebhookPlatform
3
+ from .client import Hookflow
4
4
  from .errors import (
5
- WebhookPlatformError,
5
+ HookflowError,
6
6
  AuthenticationError,
7
7
  RateLimitError,
8
8
  ValidationError,
@@ -25,10 +25,26 @@ from .types import (
25
25
  EndpointTestResult,
26
26
  RateLimitInfo,
27
27
  WebhookEvent,
28
+ IncomingSource,
29
+ IncomingSourceCreateParams,
30
+ IncomingSourceUpdateParams,
31
+ IncomingDestination,
32
+ IncomingDestinationCreateParams,
33
+ IncomingEvent,
34
+ IncomingEventListParams,
35
+ IncomingForwardAttempt,
36
+ ReplayEventResponse,
28
37
  )
29
38
 
30
- __version__ = "1.1.0"
39
+ __version__ = "2.0.0"
40
+
41
+ # Backward-compatible aliases
42
+ WebhookPlatform = Hookflow
43
+ WebhookPlatformError = HookflowError
44
+
31
45
  __all__ = [
46
+ "Hookflow",
47
+ "HookflowError",
32
48
  "WebhookPlatform",
33
49
  "WebhookPlatformError",
34
50
  "AuthenticationError",
@@ -53,4 +69,13 @@ __all__ = [
53
69
  "EndpointTestResult",
54
70
  "RateLimitInfo",
55
71
  "WebhookEvent",
72
+ "IncomingSource",
73
+ "IncomingSourceCreateParams",
74
+ "IncomingSourceUpdateParams",
75
+ "IncomingDestination",
76
+ "IncomingDestinationCreateParams",
77
+ "IncomingEvent",
78
+ "IncomingEventListParams",
79
+ "IncomingForwardAttempt",
80
+ "ReplayEventResponse",
56
81
  ]