1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "receiverUrl": "https://postman-echo.com/post",
10 "signatureScheme": "hmac_sha256",
11 "signatureHeader": "X-Signature-256",
12 "signatureTemplate": "sha256={signature}",
13 "signedPayloadTemplate": "{body}",
14 "timestampHeader": "X-Timestamp",
15 "cases": [
16 {
17 "name": "good-delivery",
18 "mode": "valid",
19 "payload": {
20 "event": "ping",
21 "id": "{nonce}",
22 "sentAt": "{timestamp}",
23 },
24 "expectedStatusMin": 200,
25 "expectedStatusMax": 299,
26 },
27 {
28 "name": "no-signature-header",
29 "mode": "missing",
30 "payload": {
31 "event": "ping",
32 "id": "{nonce}",
33 "sentAt": "{timestamp}",
34 },
35 "expectedStatusMin": 401,
36 "expectedStatusMax": 403,
37 },
38 {
39 "name": "wrong-secret",
40 "mode": "wrong-secret",
41 "payload": {
42 "event": "ping",
43 "id": "{nonce}",
44 "sentAt": "{timestamp}",
45 },
46 "expectedStatusMin": 401,
47 "expectedStatusMax": 403,
48 },
49 ],
50 "tamperReplayProbes": False,
51 "probeExpectedStatusMin": 400,
52 "probeExpectedStatusMax": 499,
53 "timeoutSeconds": 10,
54 "maxRequests": 200,
55 "requestsPerSecond": 5,
56 "maxResponseBytes": 65536,
57 "oversizedBodyBytes": 100000,
58 "replayAgeSeconds": 900,
59 "contentType": "application/json",
60 "userAgent": "WebhookContractVerifier/0.1 (+https://apify.com)",
61}
62
63
64run = client.actor("kingii98/webhook-receiver-contract-and-signature-rotation-verifier").call(run_input=run_input)
65
66
67print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
68for item in client.dataset(run.default_dataset_id).iterate_items():
69 print(item)
70
71