1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "asOf": "2026-10-01T11:00:00Z",
12 "maxProcessingDelayMinutes": 5,
13 "coverage": [
14 {
15 "scope": {
16 "provider": "stripe",
17 "account": "acct_example_001",
18 "subscription": "orders-subscription",
19 "consumer": "order-worker"
20 },
21 "delivery": {
22 "from": "2026-10-01T09:00:00Z",
23 "to": "2026-10-01T11:00:00Z",
24 "complete": true
25 },
26 "processing": {
27 "from": "2026-10-01T09:00:00Z",
28 "to": "2026-10-01T11:00:00Z",
29 "complete": true
30 }
31 },
32 {
33 "scope": {
34 "provider": "github",
35 "account": "example-repo",
36 "subscription": "deployment-subscription",
37 "consumer": "deploy-worker"
38 },
39 "delivery": {
40 "from": "2026-10-01T09:00:00Z",
41 "to": "2026-10-01T11:00:00Z",
42 "complete": true
43 },
44 "processing": {
45 "from": "2026-10-01T09:00:00Z",
46 "to": "2026-10-01T11:00:00Z",
47 "complete": false
48 }
49 }
50 ],
51 "deliveries": [
52 {
53 "attemptId": "del_retry_01",
54 "scope": {
55 "provider": "stripe",
56 "account": "acct_example_001",
57 "subscription": "orders-subscription",
58 "consumer": "order-worker"
59 },
60 "eventKey": "evt_recovered",
61 "timestamp": "2026-10-01T09:10:00Z",
62 "outcome": "failed",
63 "httpStatus": 503
64 },
65 {
66 "attemptId": "del_retry_02",
67 "scope": {
68 "provider": "stripe",
69 "account": "acct_example_001",
70 "subscription": "orders-subscription",
71 "consumer": "order-worker"
72 },
73 "eventKey": "evt_recovered",
74 "timestamp": "2026-10-01T09:11:00Z",
75 "outcome": "acknowledged",
76 "httpStatus": 200
77 },
78 {
79 "attemptId": "del_gap",
80 "scope": {
81 "provider": "stripe",
82 "account": "acct_example_001",
83 "subscription": "orders-subscription",
84 "consumer": "order-worker"
85 },
86 "eventKey": "evt_ack_gap",
87 "timestamp": "2026-10-01T09:30:00Z",
88 "outcome": "acknowledged",
89 "httpStatus": 200
90 },
91 {
92 "attemptId": "del_repeat",
93 "scope": {
94 "provider": "stripe",
95 "account": "acct_example_001",
96 "subscription": "orders-subscription",
97 "consumer": "order-worker"
98 },
99 "eventKey": "evt_two_successes",
100 "timestamp": "2026-10-01T09:40:00Z",
101 "outcome": "acknowledged",
102 "httpStatus": 200
103 },
104 {
105 "attemptId": "del_pending",
106 "scope": {
107 "provider": "stripe",
108 "account": "acct_example_001",
109 "subscription": "orders-subscription",
110 "consumer": "order-worker"
111 },
112 "eventKey": "evt_pending",
113 "timestamp": "2026-10-01T10:59:00Z",
114 "outcome": "acknowledged",
115 "httpStatus": 200
116 },
117 {
118 "attemptId": "del_partial",
119 "scope": {
120 "provider": "github",
121 "account": "example-repo",
122 "subscription": "deployment-subscription",
123 "consumer": "deploy-worker"
124 },
125 "eventKey": "evt_partial",
126 "timestamp": "2026-10-01T09:50:00Z",
127 "outcome": "acknowledged",
128 "httpStatus": 200
129 },
130 {
131 "attemptId": "del_future",
132 "scope": {
133 "provider": "stripe",
134 "account": "acct_example_001",
135 "subscription": "orders-subscription",
136 "consumer": "order-worker"
137 },
138 "eventKey": "evt_future",
139 "timestamp": "2026-10-01T10:00:00Z",
140 "outcome": "acknowledged",
141 "httpStatus": 200
142 },
143 {
144 "attemptId": "del_retry_02",
145 "scope": {
146 "provider": "stripe",
147 "account": "acct_example_001",
148 "subscription": "orders-subscription",
149 "consumer": "order-worker"
150 },
151 "eventKey": "evt_recovered",
152 "timestamp": "2026-10-01T09:11:00Z",
153 "outcome": "acknowledged",
154 "httpStatus": 200
155 }
156 ],
157 "processing": [
158 {
159 "recordId": "proc_failed",
160 "scope": {
161 "provider": "stripe",
162 "account": "acct_example_001",
163 "subscription": "orders-subscription",
164 "consumer": "order-worker"
165 },
166 "eventKey": "evt_recovered",
167 "timestamp": "2026-10-01T09:11:30Z",
168 "state": "failed",
169 "receivedAt": "2026-10-01T09:11:00Z"
170 },
171 {
172 "recordId": "proc_recovered",
173 "scope": {
174 "provider": "stripe",
175 "account": "acct_example_001",
176 "subscription": "orders-subscription",
177 "consumer": "order-worker"
178 },
179 "eventKey": "evt_recovered",
180 "timestamp": "2026-10-01T09:12:00Z",
181 "state": "succeeded",
182 "receivedAt": "2026-10-01T09:11:00Z"
183 },
184 {
185 "recordId": "proc_repeat_01",
186 "scope": {
187 "provider": "stripe",
188 "account": "acct_example_001",
189 "subscription": "orders-subscription",
190 "consumer": "order-worker"
191 },
192 "eventKey": "evt_two_successes",
193 "timestamp": "2026-10-01T09:41:00Z",
194 "state": "succeeded",
195 "receivedAt": "2026-10-01T09:40:00Z"
196 },
197 {
198 "recordId": "proc_repeat_02",
199 "scope": {
200 "provider": "stripe",
201 "account": "acct_example_001",
202 "subscription": "orders-subscription",
203 "consumer": "order-worker"
204 },
205 "eventKey": "evt_two_successes",
206 "timestamp": "2026-10-01T09:42:00Z",
207 "state": "succeeded",
208 "receivedAt": "2026-10-01T09:40:00Z"
209 },
210 {
211 "recordId": "proc_pending",
212 "scope": {
213 "provider": "stripe",
214 "account": "acct_example_001",
215 "subscription": "orders-subscription",
216 "consumer": "order-worker"
217 },
218 "eventKey": "evt_pending",
219 "timestamp": "2026-10-01T11:00:00Z",
220 "state": "pending",
221 "receivedAt": "2026-10-01T10:59:00Z"
222 },
223 {
224 "recordId": "proc_orphan",
225 "scope": {
226 "provider": "stripe",
227 "account": "acct_example_001",
228 "subscription": "orders-subscription",
229 "consumer": "order-worker"
230 },
231 "eventKey": "evt_orphan",
232 "timestamp": "2026-10-01T10:11:00Z",
233 "state": "succeeded",
234 "receivedAt": "2026-10-01T10:10:00Z"
235 },
236 {
237 "recordId": "proc_future",
238 "scope": {
239 "provider": "stripe",
240 "account": "acct_example_001",
241 "subscription": "orders-subscription",
242 "consumer": "order-worker"
243 },
244 "eventKey": "evt_future",
245 "timestamp": "2026-10-01T11:05:00Z",
246 "state": "succeeded",
247 "receivedAt": "2026-10-01T10:00:00Z"
248 }
249 ]
250};
251
252
253const run = await client.actor("h_murdock/webhook-processing-reconciliation").call(input);
254
255
256console.log('Results from dataset');
257console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
258const { items } = await client.dataset(run.defaultDatasetId).listItems();
259items.forEach((item) => {
260 console.dir(item);
261});
262
263