1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "records": [
12 {
13 "recordId": "valid-all-field",
14 "url": "https://ready.example/contact",
15 "email": "person@ready.example",
16 "address": "900 cedar street chicago il 60601"
17 },
18 {
19 "recordId": "partial-normalized",
20 "url": " partial.example/about/?utm_source=newsletter#team ",
21 "email": "person@partial.example"
22 },
23 {
24 "recordId": "no-actionable",
25 "url": " ",
26 "email": null,
27 "address": ""
28 },
29 {
30 "recordId": "invalid-only",
31 "url": "ftp://invalid.example",
32 "email": "missing-at-sign",
33 "address": "###"
34 },
35 {
36 "recordId": "mixed-valid-invalid",
37 "url": "https://mixed.example/contact",
38 "email": "missing-at-sign"
39 },
40 {
41 "recordId": "duplicate-url-a",
42 "url": "https://duplicate.example/contact",
43 "email": "alpha@duplicate.example"
44 },
45 {
46 "recordId": "duplicate-url-b",
47 "url": "https://duplicate.example/contact",
48 "email": "beta@duplicate.example"
49 },
50 {
51 "recordId": "domain-mismatch",
52 "url": "https://mismatch.example/contact",
53 "email": "owner@other.example"
54 },
55 {
56 "recordId": "email-review",
57 "email": "support@mailinator.com"
58 },
59 {
60 "recordId": "same-address-a",
61 "url": "https://north.example",
62 "email": "owner@north.example",
63 "address": "123 Main Street Suite 100, Austin, Texas 78701"
64 },
65 {
66 "recordId": "same-address-b",
67 "url": "https://south.example",
68 "email": "owner@south.example",
69 "address": "123 Main Street Suite 200, Austin, Texas 78701"
70 },
71 {
72 "recordId": "address-warning",
73 "address": "warehouse behind blue door"
74 }
75 ],
76 "fieldGroups": [
77 "url",
78 "email",
79 "address"
80 ],
81 "reviewStrictness": "standard",
82 "dedupeKeyMode": "keys_and_candidates"
83};
84
85
86const run = await client.actor("critd/contact-cleanup").call(input);
87
88
89console.log('Results from dataset');
90console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
91const { items } = await client.dataset(run.defaultDatasetId).listItems();
92items.forEach((item) => {
93 console.dir(item);
94});
95
96