1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "emails": [
12 {
13 "from": "ceo@acme-corp.com",
14 "subject": "Contract renewal — urgent decision needed",
15 "body": "Hi, we need your approval on the renewal terms by Friday. Can we hop on a call tomorrow? This is blocking the legal team."
16 },
17 {
18 "from": "deals@shopnow.com",
19 "subject": "48-hour FLASH SALE — 50% off everything!",
20 "body": "Limited time offer just for you. Click to unsubscribe."
21 },
22 {
23 "from": "sarah@gmail.com",
24 "subject": "Lunch next week?",
25 "body": "Hey! Are you free for lunch on Tuesday? Would love to catch up."
26 }
27 ],
28 "kullanici_isimleri": []
29};
30
31
32const run = await client.actor("enezli/mail-triage").call(input);
33
34
35console.log('Results from dataset');
36console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
37const { items } = await client.dataset(run.defaultDatasetId).listItems();
38items.forEach((item) => {
39 console.dir(item);
40});
41
42