1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "creatives": [
12 {
13 "id": "ugc-v1",
14 "platform": "tiktok",
15 "objective": "conversion",
16 "product": "Loop earplugs",
17 "audience": "light sleepers",
18 "script": "Okay so I haven't slept through the night in two years because my partner snores. I tried Loop earplugs for a week, not sponsored. Night one I woke up at 7am, no alarm. They cut about 25 decibels but I can still hear my kid. Only thing, the small tips fit me better than the medium. If you're a light sleeper, grab them with the link in my bio and use code SLEEP10.",
19 "onScreenText": [
20 "2 years of no sleep",
21 "Loop earplugs, day 7",
22 "code SLEEP10"
23 ],
24 "caption": "Honestly wish I'd found these sooner. Code SLEEP10 in bio #loopearplugs #lightsleeper #sleep",
25 "durationSec": 24,
26 "hookSec": 1.2
27 }
28 ]
29};
30
31
32const run = await client.actor("exepal/ad-creative-score").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