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": "s1",
14 "query": "best crm software",
15 "position": 1,
16 "title": "Best CRM Software",
17 "url": "https://competitor.example/crm",
18 "snippet": "Compare CRM platforms"
19 },
20 {
21 "id": "s2",
22 "query": "best crm software",
23 "position": 4,
24 "title": "Our CRM Guide",
25 "url": "https://ourbrand.example/crm-guide",
26 "snippet": "CRM buyer guide"
27 }
28 ],
29 "previousItems": [
30 {
31 "id": "s2",
32 "query": "best crm software",
33 "position": 7,
34 "title": "Our CRM Guide",
35 "url": "https://ourbrand.example/crm-guide",
36 "snippet": "CRM buyer guide"
37 }
38 ]
39};
40
41
42const run = await client.actor("quanmatrix/google-serp-competitive-share-intelligence").call(input);
43
44
45console.log('Results from dataset');
46console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
47const { items } = await client.dataset(run.defaultDatasetId).listItems();
48items.forEach((item) => {
49 console.dir(item);
50});
51
52