1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "reviews": [
12 {
13 "locationId": "store-north",
14 "reviewId": "r001",
15 "rating": 1,
16 "reviewTimestamp": "2026-03-01T09:00:00Z",
17 "responseTimestamp": "2026-03-02T09:00:00Z"
18 },
19 {
20 "locationId": "store-north",
21 "reviewId": "r002",
22 "rating": 2,
23 "reviewTimestamp": "2026-03-01T10:00:00Z",
24 "responseTimestamp": "2026-03-04T10:00:00Z"
25 },
26 {
27 "locationId": "store-north",
28 "reviewId": "r003",
29 "rating": 1,
30 "reviewTimestamp": "2026-03-05T12:00:00Z"
31 },
32 {
33 "locationId": "store-north",
34 "reviewId": "r004",
35 "rating": 5,
36 "reviewTimestamp": "2026-03-06T12:00:00Z"
37 },
38 {
39 "locationId": "store-south",
40 "reviewId": "r101",
41 "rating": 2,
42 "reviewTimestamp": "2026-03-02T08:00:00Z",
43 "responseTimestamp": "2026-03-02T20:00:00Z"
44 },
45 {
46 "locationId": "store-south",
47 "reviewId": "r102",
48 "rating": 1,
49 "reviewTimestamp": "2026-03-09T08:00:00Z"
50 },
51 {
52 "locationId": "store-south",
53 "reviewId": "r103",
54 "rating": 1,
55 "reviewTimestamp": "2026-03-03T08:00:00Z"
56 }
57 ],
58 "asOf": "2026-03-10T00:00:00Z",
59 "locationSlaHours": {
60 "store-south": 24
61 },
62 "minSampleSize": 3
63};
64
65
66const run = await client.actor("practical_ai_lab_jp/pal-maps-service-recovery-sla-audit").call(input);
67
68
69console.log('Results from dataset');
70console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
71const { items } = await client.dataset(run.defaultDatasetId).listItems();
72items.forEach((item) => {
73 console.dir(item);
74});
75
76