1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "sampleData": true,
12 "market": "US",
13 "currency": "USD",
14 "windowDays": 7,
15 "maxProducts": 100,
16 "currentSnapshot": {
17 "shopId": "demo-shop",
18 "sourceId": "seller-export",
19 "coverage": "shop videos",
20 "contentDefinition": "unique linked video IDs",
21 "complete": true,
22 "observedAt": "2026-11-08T00:00:00Z"
23 },
24 "previousSnapshot": {
25 "shopId": "demo-shop",
26 "sourceId": "seller-export",
27 "coverage": "shop videos",
28 "contentDefinition": "unique linked video IDs",
29 "complete": true,
30 "observedAt": "2026-11-01T00:00:00Z"
31 },
32 "productsFile": {
33 "rows": [
34 {
35 "shopId": "demo-shop",
36 "market": "US",
37 "currency": "USD",
38 "productId": "DEMO-1",
39 "observedAt": "2026-11-08T00:00:00Z",
40 "productName": "Synthetic tea tin",
41 "price": 12
42 },
43 {
44 "shopId": "demo-shop",
45 "market": "US",
46 "currency": "USD",
47 "productId": "DEMO-2",
48 "observedAt": "2026-11-08T00:00:00Z",
49 "productName": "Synthetic cup",
50 "price": 9
51 }
52 ]
53 },
54 "contentFile": {
55 "rows": [
56 {
57 "shopId": "demo-shop",
58 "market": "US",
59 "currency": "USD",
60 "productId": "DEMO-1",
61 "observedAt": "2026-11-01T00:00:00Z",
62 "contentId": "v1",
63 "creatorId": "c1"
64 },
65 {
66 "shopId": "demo-shop",
67 "market": "US",
68 "currency": "USD",
69 "productId": "DEMO-1",
70 "observedAt": "2026-11-08T00:00:00Z",
71 "contentId": "v1",
72 "creatorId": "c1"
73 },
74 {
75 "shopId": "demo-shop",
76 "market": "US",
77 "currency": "USD",
78 "productId": "DEMO-1",
79 "observedAt": "2026-11-08T00:00:00Z",
80 "contentId": "v2",
81 "creatorId": "c1"
82 },
83 {
84 "shopId": "demo-shop",
85 "market": "US",
86 "currency": "USD",
87 "productId": "DEMO-1",
88 "observedAt": "2026-11-08T00:00:00Z",
89 "contentId": "v3",
90 "creatorId": "c2"
91 }
92 ]
93 },
94 "optionalSalesFile": {
95 "rows": [
96 {
97 "shopId": "demo-shop",
98 "market": "US",
99 "currency": "USD",
100 "productId": "DEMO-1",
101 "observedAt": "2026-11-08T00:00:00Z",
102 "basis": "cumulative",
103 "metric": "units",
104 "definition": "Seller-reported lifetime units",
105 "value": 58
106 }
107 ]
108 },
109 "optionalCommissionFile": {
110 "rows": [
111 {
112 "shopId": "demo-shop",
113 "market": "US",
114 "currency": "USD",
115 "productId": "DEMO-1",
116 "observedAt": "2026-11-01T00:00:00Z",
117 "ratePercent": 5,
118 "eligibility": "Approved campaign A creators",
119 "offerId": "A"
120 },
121 {
122 "shopId": "demo-shop",
123 "market": "US",
124 "currency": "USD",
125 "productId": "DEMO-1",
126 "observedAt": "2026-11-08T00:00:00Z",
127 "ratePercent": 8,
128 "eligibility": "Approved campaign A creators",
129 "offerId": "A"
130 }
131 ]
132 }
133};
134
135
136const run = await client.actor("afkdigital/tiktok-shop-product-momentum-intelligence").call(input);
137
138
139console.log('Results from dataset');
140console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
141const { items } = await client.dataset(run.defaultDatasetId).listItems();
142items.forEach((item) => {
143 console.dir(item);
144});
145
146