1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "reviews": [
12 {
13 "title": "Great service",
14 "text": "Fast delivery and very helpful support. I love it, highly recommend!",
15 "rating": 5,
16 "author": "Anna"
17 },
18 {
19 "title": "Never again",
20 "text": "Terrible experience, parcel arrived damaged and nobody answered my refund request.",
21 "rating": 1,
22 "author": "Tom"
23 },
24 {
25 "title": "Okay",
26 "text": "Product is fine, the price is not cheap but it works.",
27 "rating": 3
28 }
29 ],
30 "neutralThreshold": 0.1,
31 "maxItems": 3
32};
33
34
35const run = await client.actor("bonpleincapital/review-sentiment-scorer").call(input);
36
37
38console.log('Results from dataset');
39console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
40const { items } = await client.dataset(run.defaultDatasetId).listItems();
41items.forEach((item) => {
42 console.dir(item);
43});
44
45