-
Notifications
You must be signed in to change notification settings - Fork 452
Expand file tree
/
Copy pathnano_banana_facebook_ad_thief.json
More file actions
567 lines (567 loc) · 15.7 KB
/
Copy pathnano_banana_facebook_ad_thief.json
File metadata and controls
567 lines (567 loc) · 15.7 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
{
"name": "The Recap AI - Facebook Ad Thief",
"nodes": [
{
"parameters": {
"formTitle": "Facebook Ad Thief Form",
"formDescription": "Upload your product image and submit a facebook ad library url for the ads you want to clone/spin for your produc.t",
"formFields": {
"values": [
{
"fieldLabel": "Facebook Ad Library Url",
"placeholder": "https://www.facebook.com/",
"requiredField": true
},
{
"fieldLabel": "Your Product Image",
"fieldType": "file",
"multipleFiles": false,
"requiredField": true
}
]
},
"options": {}
},
"type": "n8n-nodes-base.formTrigger",
"typeVersion": 2.2,
"position": [
304,
224
],
"id": "02aa1570-98cc-4e51-8984-7078b67f8e69",
"name": "form_trigger",
"webhookId": "739f6e4b-c69f-4baf-b6fe-f671f8ba6279"
},
{
"parameters": {
"options": {}
},
"type": "n8n-nodes-base.splitInBatches",
"typeVersion": 3,
"position": [
304,
448
],
"id": "3b44e844-211b-435e-b559-b86f50c969bc",
"name": "iterate_ads"
},
{
"parameters": {
"url": "={{ $node['iterate_ads'].json.snapshot.cards.first().original_image_url }}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
944,
464
],
"id": "a647a369-8233-4bf1-9fb4-12d40376672c",
"name": "download_image"
},
{
"parameters": {
"operation": "binaryToPropery",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
1232,
464
],
"id": "01df58ea-a0b6-4282-ae66-681bc2dd3ace",
"name": "convert_ad_image_to_base64"
},
{
"parameters": {
"name": "={{ $node['iterate_ads'].json.snapshot.cards.first().title }}",
"driveId": {
"__rl": true,
"mode": "list",
"value": "My Drive"
},
"folderId": {
"__rl": true,
"value": "1HoXBHX3gvz5TxhczPwI0d5gWI3mxJT7h",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
1232,
288
],
"id": "508fdd2d-1d9e-437b-83ea-a234eb755195",
"name": "upload_ad_reference",
"credentials": {
"googleDriveOAuth2Api": {
"id": "PgwI1k1VFnoEhOi6",
"name": "Google Drive account"
}
}
},
{
"parameters": {},
"type": "n8n-nodes-base.merge",
"typeVersion": 3.2,
"position": [
1504,
448
],
"id": "6145dd1e-1b1e-4acf-b41c-acdcbcc938d6",
"name": "merge"
},
{
"parameters": {
"fieldsToAggregate": {
"fieldToAggregate": [
{}
]
},
"options": {}
},
"type": "n8n-nodes-base.aggregate",
"typeVersion": 1,
"position": [
304,
704
],
"id": "a01db21f-c4b1-481b-a55b-31ede9b7814d",
"name": "aggregate"
},
{
"parameters": {
"operation": "toBinary",
"sourceProperty": "image_result",
"options": {}
},
"type": "n8n-nodes-base.convertToFile",
"typeVersion": 1.1,
"position": [
1504,
720
],
"id": "3b1c6a2e-eca8-494d-837a-3d09cc482c3d",
"name": "get_image"
},
{
"parameters": {
"name": "=Cloned Ad #{{ $runIndex + 1 }}",
"driveId": {
"__rl": true,
"value": "My Drive",
"mode": "list",
"cachedResultName": "My Drive",
"cachedResultUrl": "https://drive.google.com/drive/my-drive"
},
"folderId": {
"__rl": true,
"value": "1X4SkqnUptmbLuAbdEzyZeSnb_nt_2qTe",
"mode": "id"
},
"options": {}
},
"type": "n8n-nodes-base.googleDrive",
"typeVersion": 3,
"position": [
1792,
784
],
"id": "2805dfd1-dce7-4d5d-86c9-dc3b925e9249",
"name": "upload_image",
"credentials": {
"googleDriveOAuth2Api": {
"id": "PgwI1k1VFnoEhOi6",
"name": "Google Drive account"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "524da01b-f8b9-4c2c-9e28-319455903e4d",
"name": "=image_result",
"value": "={{ $json.candidates[0].content.parts.filter(item => item.inlineData).first().inlineData.data }}",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
1232,
720
],
"id": "2e6a04de-1329-41bb-967a-73aade05fef8",
"name": "set_result"
},
{
"parameters": {
"conditions": {
"options": {
"caseSensitive": true,
"leftValue": "",
"typeValidation": "strict",
"version": 2
},
"conditions": [
{
"id": "f46e65cf-d695-4e2e-a64c-be500cd788dd",
"leftValue": "={{ $json.candidates.first().finishReason }}",
"rightValue": "PROHIBITED_CONTENT",
"operator": {
"type": "string",
"operation": "equals",
"name": "filter.operator.equals"
}
}
],
"combinator": "and"
},
"options": {}
},
"type": "n8n-nodes-base.if",
"typeVersion": 2.2,
"position": [
944,
704
],
"id": "23c1e641-04d7-4540-8336-77b24c29007d",
"name": "check_if_prohibited"
},
{
"parameters": {
"operation": "binaryToPropery",
"binaryPropertyName": "Your_Product_Image",
"options": {}
},
"type": "n8n-nodes-base.extractFromFile",
"typeVersion": 1,
"position": [
608,
224
],
"id": "d09e9817-e30f-4239-b105-e394e0b60d40",
"name": "convert_product_image_to_base64"
},
{
"parameters": {
"method": "POST",
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-pro:generateContent",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"contents\": [{\n \"parts\": [\n { \"text\": {{ JSON.stringify($json.prompt) }} },\n {\n \"inline_data\": {\n \"mime_type\": \"image/png\",\n \"data\": \"{{ $node['convert_product_image_to_base64'].json.data }}\"\n }\n },\n {\n \"inline_data\": {\n \"mime_type\": \"image/jpeg\",\n \"data\": \"{{ $node['convert_ad_image_to_base64'].json.data }}\"\n }\n }\n ]\n }]\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
608,
704
],
"id": "f9af4c0e-e2d9-479a-a360-703407c0eba3",
"name": "generate_ad_image_prompt",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "abcMckGk9RG9i0Ba",
"name": "Google Gemini"
}
}
},
{
"parameters": {
"method": "POST",
"url": "https://generativelanguage.googleapis.com/v1beta/models/gemini-2.5-flash-image-preview:generateContent",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "={\n \"contents\": [{\n \"parts\": [\n { \"text\": {{ JSON.stringify($json.candidates.first().content.parts.first().text) }} },\n {\n \"inline_data\": {\n \"mime_type\": \"image/png\",\n \"data\": \"{{ $node['convert_product_image_to_base64'].json.data }}\"\n }\n },\n {\n \"inline_data\": {\n \"mime_type\": \"image/jpeg\",\n \"data\": \"{{ $node['convert_ad_image_to_base64'].json.data }}\"\n }\n }\n ]\n }]\n}",
"options": {}
},
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [
784,
704
],
"id": "43ae4270-b8d8-4d1d-9e30-024f5b0c1a17",
"name": "generate_ad_image",
"retryOnFail": true,
"waitBetweenTries": 5000,
"credentials": {
"httpHeaderAuth": {
"id": "abcMckGk9RG9i0Ba",
"name": "Google Gemini"
}
}
},
{
"parameters": {
"assignments": {
"assignments": [
{
"id": "2fcf84d7-4a17-4899-9bea-a7d3b6027acd",
"name": "prompt",
"value": "You are an expert in image I need your help to write a perfect prompt that is going to help me generate/edit an image for my company's product called Thrive Mix. Attached to this request are two images: 1. Product picture of Thrive Mix (our product) 2. Reference image of the competitor's ad we're trying to replicate In your analysis of these images, I want you to come up with a plan and write a very detailed prompt on how we can clone and spin the ad from image number two (our competitor AG1) to make an identical ad that features our product with our packaging (ThriveMix) and image number one. We need to replicate the same style used on the AG1 competitor ad, but it should always be our packaging that's included. Some tricky edge cases you need to handle are: Partial branding items of the AG1 text (there can be text that says AG1, labels on products that say AG1, multiple products, multiple packages that are different from ours). Please check for all placements in the AG1 ad that need to be replaced. You need to figure out how to write a specific prompt that is going to detail this image generator how to replace it and create the ad for our product. The end result we're going for is a new ad that promotes our product ThriveMix. Make sure your prompt includes changes that need to be changed on the text of the image like labels and calls to action. It's possible that the source ad image for our competitor AG1 will have partial text on the product or packaging like \"A\", \"AG\", \"G, \"G\" (standalone), \"G1\", or some other partial text that needs to be checked for and analyzed in your plan. Keep the ad copy the same EXCEPT for switching \"AG1\" to \"ThriveMix\" to Think deeply about the prompt you are going to write.",
"type": "string"
}
]
},
"options": {}
},
"type": "n8n-nodes-base.set",
"typeVersion": 3.4,
"position": [
448,
704
],
"id": "47fa9f9a-6699-4944-9ad0-531ad34b4ead",
"name": "build_prompt"
},
{
"parameters": {
"operation": "Run actor and get dataset",
"actorSource": "store",
"actorId": {
"__rl": true,
"value": "XtaWFhbtfxyzqrFmd",
"mode": "list",
"cachedResultName": "Facebook Ad Library Scraper (curious_coder/facebook-ads-library-scraper)",
"cachedResultUrl": "https://console.apify.com/actors/XtaWFhbtfxyzqrFmd/input"
},
"customBody": "={\n \"limitPerSource\": 20,\n \"scrapeAdDetails\": false,\n \"scrapePageAds.activeStatus\": \"all\",\n \"scrapePageAds.countryCode\": \"ALL\",\n \"urls\": [\n {\n \"url\": \"{{ $('form_trigger').item.json['Facebook Ad Library Url'] }}\",\n \"method\": \"GET\"\n }\n ]\n}",
"memory": 512,
"authentication": "apifyOAuth2Api"
},
"type": "@apify/n8n-nodes-apify.apify",
"typeVersion": 1,
"position": [
944,
224
],
"id": "1086bf1c-2495-45a2-93cf-2cefd2e51735",
"name": "scrape_ads",
"credentials": {
"apifyOAuth2Api": {
"id": "H654WxAlFsyNy0MJ",
"name": "Apify"
}
}
}
],
"pinData": {},
"connections": {
"form_trigger": {
"main": [
[
{
"node": "convert_product_image_to_base64",
"type": "main",
"index": 0
}
]
]
},
"iterate_ads": {
"main": [
[],
[
{
"node": "download_image",
"type": "main",
"index": 0
}
]
]
},
"download_image": {
"main": [
[
{
"node": "upload_ad_reference",
"type": "main",
"index": 0
},
{
"node": "convert_ad_image_to_base64",
"type": "main",
"index": 0
}
]
]
},
"upload_ad_reference": {
"main": [
[
{
"node": "merge",
"type": "main",
"index": 0
}
]
]
},
"convert_ad_image_to_base64": {
"main": [
[
{
"node": "merge",
"type": "main",
"index": 1
}
]
]
},
"merge": {
"main": [
[
{
"node": "aggregate",
"type": "main",
"index": 0
}
]
]
},
"aggregate": {
"main": [
[
{
"node": "build_prompt",
"type": "main",
"index": 0
}
]
]
},
"get_image": {
"main": [
[
{
"node": "upload_image",
"type": "main",
"index": 0
}
]
]
},
"set_result": {
"main": [
[
{
"node": "get_image",
"type": "main",
"index": 0
}
]
]
},
"upload_image": {
"main": [
[
{
"node": "iterate_ads",
"type": "main",
"index": 0
}
]
]
},
"check_if_prohibited": {
"main": [
[
{
"node": "iterate_ads",
"type": "main",
"index": 0
}
],
[
{
"node": "set_result",
"type": "main",
"index": 0
}
]
]
},
"convert_product_image_to_base64": {
"main": [
[
{
"node": "scrape_ads",
"type": "main",
"index": 0
}
]
]
},
"generate_ad_image_prompt": {
"main": [
[
{
"node": "generate_ad_image",
"type": "main",
"index": 0
}
]
]
},
"generate_ad_image": {
"main": [
[
{
"node": "check_if_prohibited",
"type": "main",
"index": 0
}
]
]
},
"build_prompt": {
"main": [
[
{
"node": "generate_ad_image_prompt",
"type": "main",
"index": 0
}
]
]
},
"scrape_ads": {
"main": [
[
{
"node": "iterate_ads",
"type": "main",
"index": 0
}
]
]
}
},
"active": false,
"settings": {
"executionOrder": "v1"
},
"versionId": "db043963-5e7e-4343-b986-7a870df2ab23",
"meta": {
"templateCredsSetupCompleted": true,
"instanceId": "06e5009344f682419c20ccd4ecdcb5223bbb91761882af93ac6d468dbc2cbf8d"
},
"id": "qvBUGGr9hb1LlVuX",
"tags": []
}