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 "text": "Great quality for the price, feels sturdy and looks exactly like the photos. Shipping was fast too.",
14 "rating": 5
15 },
16 {
17 "text": "Runs a full size small. I usually wear medium and had to return for a large. Sizing chart is misleading.",
18 "rating": 2
19 },
20 {
21 "text": "Arrived with the box crushed and one part scratched. Product works but packaging needs improvement.",
22 "rating": 3
23 },
24 {
25 "text": "Stopped working after two weeks. Battery no longer holds a charge. Disappointed for the price.",
26 "rating": 1
27 },
28 {
29 "text": "Exactly as described, easy to set up, and customer service replaced a missing screw within a day.",
30 "rating": 5
31 }
32 ]
33};
34
35
36const run = await client.actor("enezli/amazon-review-intelligence").call(input);
37
38
39console.log('Results from dataset');
40console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
41const { items } = await client.dataset(run.defaultDatasetId).listItems();
42items.forEach((item) => {
43 console.dir(item);
44});
45
46