1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "limit": 1000,
12 "checkersInput": {
13 "RESOURCE_STATS_CHECKER": {},
14 "DEDUPLICATION_CHECKER": {
15 "uniqueKey": "email"
16 },
17 "SCHEMA_VALIDATOR_CHECKER": {
18 "options": [
19 {
20 "resourceList": [
21 "id",
22 "id"
23 ],
24 "resourceRegex": "",
25 "minItemCount": 100,
26 "maxItemCount": 5000,
27 "validationSchema": "{ address: String, open: Boolean }"
28 }
29 ]
30 }
31 },
32 "reportersInput": {
33 "EMAIL_REPORTER": {
34 "sendMailInput": {
35 "to": "info@apify.com",
36 "subject": "My monitoring task report"
37 }
38 },
39 "SLACK_REPORTER": {
40 "slackInput": {
41 "token": "Your token",
42 "message": "Hey, look what I have done!",
43 "channel": "#monitoring"
44 }
45 },
46 "DASHBOARD_REPORTER": {
47 "notifyOnUpdate": true
48 }
49 }
50};
51
52
53const run = await client.actor("apify/monitoring-runner").call(input);
54
55
56console.log('Results from dataset');
57console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
58const { items } = await client.dataset(run.defaultDatasetId).listItems();
59items.forEach((item) => {
60 console.dir(item);
61});
62
63