1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "snapshotId": "routing-review-2026-10-03",
12 "fields": [
13 "territory",
14 "segment"
15 ],
16 "baseline": {
17 "version": "baseline-v1",
18 "fallbackOwnerId": "queue-general",
19 "rules": [
20 {
21 "ruleId": "general-first",
22 "priority": 0,
23 "ownerId": "queue-general",
24 "unconditional": true,
25 "predicates": {}
26 },
27 {
28 "ruleId": "us-specific",
29 "priority": 10,
30 "ownerId": "queue-us",
31 "unconditional": false,
32 "predicates": {
33 "territory": [
34 "US"
35 ]
36 }
37 }
38 ]
39 },
40 "candidate": {
41 "version": "candidate-v2",
42 "fallbackOwnerId": "queue-general",
43 "rules": [
44 {
45 "ruleId": "us-enterprise",
46 "priority": 0,
47 "ownerId": "queue-us-enterprise",
48 "unconditional": false,
49 "predicates": {
50 "territory": [
51 "US"
52 ],
53 "segment": [
54 "enterprise"
55 ]
56 }
57 },
58 {
59 "ruleId": "eu",
60 "priority": 10,
61 "ownerId": "queue-eu",
62 "unconditional": false,
63 "predicates": {
64 "territory": [
65 "EU"
66 ]
67 }
68 },
69 {
70 "ruleId": "general-last",
71 "priority": 100,
72 "ownerId": "queue-general",
73 "unconditional": true,
74 "predicates": {}
75 }
76 ]
77 },
78 "fixtures": [
79 {
80 "rowId": "001",
81 "attributes": {
82 "territory": "US",
83 "segment": "enterprise"
84 },
85 "expectedCandidateOwner": "queue-us-enterprise"
86 },
87 {
88 "rowId": "002",
89 "attributes": {
90 "territory": "EU",
91 "segment": "small"
92 },
93 "expectedCandidateOwner": "queue-general"
94 },
95 {
96 "rowId": "003",
97 "attributes": {
98 "territory": "JP",
99 "segment": "small"
100 }
101 },
102 {
103 "rowId": "004",
104 "attributes": {
105 "segment": "enterprise"
106 },
107 "expectedCandidateOwner": "queue-general"
108 },
109 {
110 "rowId": "005",
111 "attributes": {
112 "territory": "",
113 "segment": "small"
114 }
115 }
116 ],
117 "fixturesCsv": "",
118 "fixtureColumns": {
119 "rowId": "rowId",
120 "expectedCandidateOwner": "expectedCandidateOwner",
121 "attributes": {
122 "territory": "territory",
123 "segment": "segment"
124 }
125 }
126};
127
128
129const run = await client.actor("h_murdock/lead-routing-change-fixtures").call(input);
130
131
132console.log('Results from dataset');
133console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
134const { items } = await client.dataset(run.defaultDatasetId).listItems();
135items.forEach((item) => {
136 console.dir(item);
137});
138
139