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": "creative-1",
14 "brand": "Example Brand",
15 "body": "Turn your ad creatives into measurable insights.",
16 "cta": "Learn More",
17 "assetUrl": "https://images.unsplash.com/photo-1556742049-0cfed4f6a45d",
18 "assetType": "image"
19 }
20 ],
21 "csvInput": `id,brand,body,cta,assetUrl,assetType
22creative-1,Example Brand,Turn your ad creatives into measurable insights.,Learn More,https://images.unsplash.com/photo-1556742049-0cfed4f6a45d,image`,
23 "ads": [
24 {
25 "libraryID": "example-ad-1",
26 "brand": "Example Brand",
27 "body": "Turn your ad creatives into measurable insights.",
28 "ctaText": "Learn More",
29 "format": "image",
30 "images": [
31 {
32 "url": "https://images.unsplash.com/photo-1556742049-0cfed4f6a45d"
33 }
34 ],
35 "active": true,
36 "runTimeDays": 21,
37 "multipleVersions": false,
38 "similarAdCount": 1,
39 "totalPlatforms": 1
40 }
41 ],
42 "maxAds": 100,
43 "maxConcurrency": 2,
44 "maxVideoFrames": 8,
45 "videoFrameIntervalSeconds": 2
46};
47
48
49const run = await client.actor("whoareyouanas/creative-intelligence").call(input);
50
51
52console.log('Results from dataset');
53console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
54const { items } = await client.dataset(run.defaultDatasetId).listItems();
55items.forEach((item) => {
56 console.dir(item);
57});
58
59