1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "yourBusiness": {
12 "name": "My Business",
13 "placeId": "ChIJ...",
14 "website": "https://mybusiness.com"
15 },
16 "competitors": [
17 {
18 "name": "Competitor 1",
19 "placeId": "ChIJ...",
20 "website": "https://competitor1.com"
21 },
22 {
23 "name": "Competitor 2",
24 "searchQuery": "Competitor Business Dallas TX"
25 }
26 ],
27 "targetKeywords": [
28 "plumber",
29 "plumbing services",
30 "emergency plumber"
31 ],
32 "targetLocation": "Dallas, TX"
33};
34
35
36const run = await client.actor("alizarin_refrigerator-owner/ai-competitor-monitor").call(input);
37
38
39console.log('Results from dataset');
40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
41const { items } = await client.dataset(run.defaultDatasetId).listItems();
42items.forEach((item) => {
43 console.dir(item);
44});
45
46