1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "currentItems": [
12 {
13 "id": "post1",
14 "title": "Product launch",
15 "views": 280000,
16 "likes": 14500,
17 "comments": 930,
18 "shares": 2400,
19 "growthPct": 38
20 },
21 {
22 "id": "post2",
23 "title": "Hiring update",
24 "views": 62000,
25 "likes": 1800,
26 "comments": 120,
27 "shares": 180,
28 "growthPct": 5
29 }
30 ],
31 "previousItems": [
32 {
33 "id": "post1",
34 "title": "Product launch teaser",
35 "views": 180000,
36 "likes": 8200,
37 "comments": 510,
38 "shares": 1100,
39 "growthPct": 21
40 }
41 ]
42};
43
44
45const run = await client.actor("quanmatrix/facebook-brand-content-momentum-intelligence").call(input);
46
47
48console.log('Results from dataset');
49console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
50const { items } = await client.dataset(run.defaultDatasetId).listItems();
51items.forEach((item) => {
52 console.dir(item);
53});
54
55