1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "accountId": "000123",
12 "queries": [
13 {
14 "id": "q001",
15 "query": "blue running shoes",
16 "campaignId": "01",
17 "adGroupId": "001"
18 },
19 {
20 "id": "q002",
21 "query": "running shoes",
22 "campaignId": "01",
23 "adGroupId": "001"
24 },
25 {
26 "id": "q003",
27 "query": "shoes running",
28 "campaignId": "02",
29 "adGroupId": "002"
30 },
31 {
32 "id": "q004",
33 "query": "sidewalk CAFÉ",
34 "campaignId": "02",
35 "adGroupId": "002"
36 },
37 {
38 "id": "q005",
39 "query": "sidewalk cafe",
40 "campaignId": "02",
41 "adGroupId": "002"
42 },
43 {
44 "id": "q006",
45 "query": "free training",
46 "campaignId": "03",
47 "adGroupId": "003"
48 },
49 {
50 "id": "q007",
51 "query": "ski boots",
52 "campaignId": "01",
53 "adGroupId": "001"
54 },
55 {
56 "id": "q008",
57 "query": "shose",
58 "campaignId": "01",
59 "adGroupId": "001"
60 },
61 {
62 "id": "q009",
63 "query": "socks & shoes",
64 "campaignId": "01",
65 "adGroupId": "001"
66 },
67 {
68 "id": "q010",
69 "query": "very very cheap",
70 "campaignId": "01",
71 "adGroupId": "001"
72 }
73 ],
74 "negatives": [
75 {
76 "id": "n001",
77 "text": "running shoes",
78 "matchType": "broad",
79 "scope": "account"
80 },
81 {
82 "id": "n002",
83 "text": "running shoes",
84 "matchType": "phrase",
85 "scope": "campaign",
86 "campaignId": "01"
87 },
88 {
89 "id": "n003",
90 "text": "running shoes",
91 "matchType": "exact",
92 "scope": "adGroup",
93 "campaignId": "01",
94 "adGroupId": "001"
95 },
96 {
97 "id": "n004",
98 "text": "sidewalk café",
99 "matchType": "phrase",
100 "scope": "campaign",
101 "campaignId": "02"
102 },
103 {
104 "id": "n005",
105 "text": "free",
106 "matchType": "broad",
107 "scope": "sharedList",
108 "listId": "L01"
109 },
110 {
111 "id": "n006",
112 "text": "boots",
113 "matchType": "broad",
114 "scope": "campaign",
115 "campaignId": "99"
116 },
117 {
118 "id": "n007",
119 "text": "shoes*",
120 "matchType": "broad",
121 "scope": "campaign",
122 "campaignId": "01"
123 },
124 {
125 "id": "n008",
126 "text": "shoes",
127 "matchType": "broad",
128 "scope": "unknown"
129 },
130 {
131 "id": "n009",
132 "text": "socks & shoes",
133 "matchType": "exact",
134 "scope": "account"
135 },
136 {
137 "id": "n010",
138 "text": "very very",
139 "matchType": "phrase",
140 "scope": "campaign",
141 "campaignId": "01"
142 }
143 ],
144 "sharedListAttachments": [
145 {
146 "listId": "L01",
147 "campaignId": "03"
148 }
149 ]
150};
151
152
153const run = await client.actor("h_murdock/negative-keyword-preflight").call(input);
154
155
156console.log('Results from dataset');
157console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
158const { items } = await client.dataset(run.defaultDatasetId).listItems();
159items.forEach((item) => {
160 console.dir(item);
161});
162
163