1import { ApifyClient } from 'apify-client';
2
3
4
5const client = new ApifyClient({
6 token: '<YOUR_API_TOKEN>',
7});
8
9
10const input = {
11 "jsonData": [
12 {
13 "adArchiveID": "100001",
14 "pageID": "111",
15 "pageName": "Example Skincare",
16 "isActive": true,
17 "startDate": 1782904000,
18 "endDate": 1795000000,
19 "collationCount": 5,
20 "publisherPlatform": [
21 "FACEBOOK",
22 "INSTAGRAM"
23 ],
24 "snapshot": {
25 "body": {
26 "text": "Clear skin in 14 days"
27 },
28 "title": "Glow Serum",
29 "linkUrl": "https://glowskin.com/serum",
30 "ctaText": "Shop now",
31 "displayFormat": "IMAGE",
32 "pageLikeCount": 52000
33 }
34 },
35 {
36 "adArchiveID": "100002",
37 "pageID": "111",
38 "pageName": "Example Skincare",
39 "isActive": true,
40 "startDate": 1791976000,
41 "endDate": 1795000000,
42 "collationCount": 1,
43 "publisherPlatform": [
44 "FACEBOOK",
45 "INSTAGRAM"
46 ],
47 "snapshot": {
48 "body": {
49 "text": "Clear skin in 14 days"
50 },
51 "title": "Serum + Cream bundle",
52 "linkUrl": "https://glowskin.com/serum",
53 "ctaText": "Shop now",
54 "displayFormat": "VIDEO",
55 "pageLikeCount": 52000
56 }
57 },
58 {
59 "adArchiveID": "100003",
60 "pageID": "111",
61 "pageName": "Example Skincare",
62 "isActive": true,
63 "startDate": 1794654400,
64 "endDate": 1795000000,
65 "collationCount": 1,
66 "publisherPlatform": [
67 "FACEBOOK",
68 "INSTAGRAM"
69 ],
70 "snapshot": {
71 "body": {
72 "text": "Clear skin in 14 days"
73 },
74 "title": "New: night mask",
75 "linkUrl": "https://glowskin.com/serum",
76 "ctaText": "Shop now",
77 "displayFormat": "IMAGE",
78 "pageLikeCount": 52000
79 }
80 },
81 {
82 "adArchiveID": "100004",
83 "pageID": "111",
84 "pageName": "Example Skincare",
85 "isActive": false,
86 "startDate": 1777720000,
87 "endDate": 1795000000,
88 "collationCount": 1,
89 "publisherPlatform": [
90 "FACEBOOK",
91 "INSTAGRAM"
92 ],
93 "snapshot": {
94 "body": {
95 "text": "Clear skin in 14 days"
96 },
97 "title": "Glow Serum",
98 "linkUrl": "https://glowskin.com/serum",
99 "ctaText": "Shop now",
100 "displayFormat": "IMAGE",
101 "pageLikeCount": 52000
102 }
103 }
104 ]
105};
106
107
108const run = await client.actor("weav3rx/facebook-winning-ads-finder").call(input);
109
110
111console.log('Results from dataset');
112console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
113const { items } = await client.dataset(run.defaultDatasetId).listItems();
114items.forEach((item) => {
115 console.dir(item);
116});
117
118