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": "topic1",
14 "title": "billing complaints",
15 "mentions": 4800,
16 "negativePct": 72,
17 "velocityPct": 95,
18 "engagement": 34000,
19 "sourceCount": 420
20 },
21 {
22 "id": "topic2",
23 "title": "new feature discussion",
24 "mentions": 1500,
25 "negativePct": 18,
26 "velocityPct": 22,
27 "engagement": 9800,
28 "sourceCount": 160
29 }
30 ],
31 "previousItems": [
32 {
33 "id": "topic1",
34 "title": "billing complaints",
35 "mentions": 2200,
36 "negativePct": 54,
37 "velocityPct": 41,
38 "engagement": 12000,
39 "sourceCount": 210
40 }
41 ]
42};
43
44
45const run = await client.actor("quanmatrix/x-brand-narrative-crisis-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