1from apify_client import ApifyClient
2
3
4
5client = ApifyClient("<YOUR_API_TOKEN>")
6
7
8run_input = {
9 "goalDescription": "Posts that beat their page's usual engagement, announce an offer or a launch, or show someone asking where to buy",
10 "maxDiscoveryChargeUsd": 0.5,
11 "maxPostsPerPage": 20,
12 "sourceMode": "list",
13 "itemsList": [
14 {
15 "post_id": "1001",
16 "type": "photo",
17 "url": "https://www.facebook.com/brightsidecoffee/posts/1001",
18 "external_url": "https://brightsidecoffee.example/shop/spring-sale",
19 "message": "Spring sale! 30% off all whole-bean bags with code SPRING30 until Sunday. Free shipping over $40.",
20 "timestamp": 1759060800,
21 "reactions_count": 1240,
22 "comments_count": 188,
23 "reshare_count": 214,
24 "image": "https://example.com/img/1001.jpg",
25 "author": {
26 "name": "Brightside Coffee Roasters",
27 "id": "100090000000001",
28 "url": "https://www.facebook.com/brightsidecoffee",
29 },
30 },
31 {
32 "post_id": "1002",
33 "type": "photo",
34 "url": "https://www.facebook.com/brightsidecoffee/posts/1002",
35 "message": "Good morning from the roastery!",
36 "timestamp": 1759147200,
37 "reactions_count": 210,
38 "comments_count": 14,
39 "reshare_count": 3,
40 "image": "https://example.com/img/1002.jpg",
41 "author": {
42 "name": "Brightside Coffee Roasters",
43 "id": "100090000000001",
44 "url": "https://www.facebook.com/brightsidecoffee",
45 },
46 },
47 {
48 "post_id": "1003",
49 "type": "photo",
50 "url": "https://www.facebook.com/brightsidecoffee/posts/1003",
51 "external_url": "https://brightsidecoffee.example/shop/ethiopia-guji",
52 "message": "Introducing our new Ethiopia Guji single origin - now available online and in store.",
53 "timestamp": 1759233600,
54 "reactions_count": 640,
55 "comments_count": 52,
56 "reshare_count": 61,
57 "image": "https://example.com/img/1003.jpg",
58 "author": {
59 "name": "Brightside Coffee Roasters",
60 "id": "100090000000001",
61 "url": "https://www.facebook.com/brightsidecoffee",
62 },
63 },
64 {
65 "post_id": "1004",
66 "type": "video",
67 "url": "https://www.facebook.com/brightsidecoffee/posts/1004",
68 "message": "Behind the scenes: roasting day.",
69 "timestamp": 1759320000,
70 "reactions_count": 180,
71 "comments_count": 9,
72 "reshare_count": 2,
73 "video": "https://example.com/vid/1004.mp4",
74 "author": {
75 "name": "Brightside Coffee Roasters",
76 "id": "100090000000001",
77 "url": "https://www.facebook.com/brightsidecoffee",
78 },
79 },
80 {
81 "post_id": "1005",
82 "type": "status",
83 "url": "https://www.facebook.com/brightsidecoffee/posts/1005",
84 "message": "We're hiring a barista for our downtown cafe! Apply now at the counter or send us a message.",
85 "timestamp": 1759406400,
86 "reactions_count": 95,
87 "comments_count": 31,
88 "reshare_count": 18,
89 "author": {
90 "name": "Brightside Coffee Roasters",
91 "id": "100090000000001",
92 "url": "https://www.facebook.com/brightsidecoffee",
93 },
94 },
95 {
96 "post_id": "1006",
97 "type": "status",
98 "url": "https://www.facebook.com/brightsidecoffee/posts/1006",
99 "message": "What's your go-to brew method? Tell us below!",
100 "timestamp": 1759492800,
101 "reactions_count": 260,
102 "comments_count": 142,
103 "reshare_count": 6,
104 "author": {
105 "name": "Brightside Coffee Roasters",
106 "id": "100090000000001",
107 "url": "https://www.facebook.com/brightsidecoffee",
108 },
109 },
110 {
111 "post_id": "2001",
112 "type": "status",
113 "url": "https://www.facebook.com/northwindbikes/posts/2001",
114 "message": "Our shop is closed Monday for inventory. Back Tuesday at 9.",
115 "timestamp": 1759579200,
116 "reactions_count": 12,
117 "comments_count": 1,
118 "reshare_count": 0,
119 "author": {
120 "name": "Northwind Bikes",
121 "id": "100090000000002",
122 "url": "https://www.facebook.com/northwindbikes",
123 },
124 },
125 {
126 "post_id": "3001",
127 "type": "status",
128 "url": "https://www.facebook.com/groups/austinparents/posts/3001",
129 "message": "Anyone know where I can buy a kids balance bike under $120 near Austin? Looking for recommendations!",
130 "timestamp": 1759665600,
131 "reactions_count": 9,
132 "comments_count": 14,
133 "reshare_count": 0,
134 "keyword": "kids balance bike",
135 "author": {
136 "name": "Austin Parents Group",
137 "id": "100090000000003",
138 "url": "https://www.facebook.com/groups/austinparents",
139 },
140 },
141 ],
142}
143
144
145run = client.actor("rich_minds/fb-page-post-tracker").call(run_input=run_input)
146
147
148print(f"💾 Check your data here: https://console.apify.com/storage/datasets/{run.default_dataset_id}")
149for item in client.dataset(run.default_dataset_id).iterate_items():
150 print(item)
151
152