1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "texts": [
12 "Hi, I've been trying to connect my Stripe account for 3 days and the integration keeps failing. I'm losing sales. Please help ASAP.",
13 "Just wanted to say the new dashboard looks great. No issues here!",
14 "How much does the Team plan cost if we add 12 seats?"
15 ],
16 "questions": [
17 {
18 "key": "department",
19 "type": "choice",
20 "instructions": "Which team should handle this message?",
21 "criteria": {
22 "billing": "Payment or subscription issues",
23 "technical": "Bugs or integration problems",
24 "sales": "Pricing or account questions"
25 }
26 },
27 {
28 "key": "frustration",
29 "type": "score",
30 "instructions": "How frustrated the customer appears",
31 "criteria": [
32 "Calm, just stating facts",
33 "Frustrated but civil",
34 "Very angry, strong language"
35 ]
36 },
37 {
38 "key": "is_urgent",
39 "type": "noul",
40 "instructions": "The message conveys urgency or time-sensitivity"
41 }
42 ]
43};
44
45
46const run = await client.actor("seemuapps/bulk-text-classifier").call(input);
47
48
49console.log('Results from dataset');
50console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
51const { items } = await client.dataset(run.defaultDatasetId).listItems();
52items.forEach((item) => {
53 console.dir(item);
54});
55
56