0
Update promotion settings
One script reply has been approved by the moderators Verified
Created by hugo697 14 days ago Viewed 1210 times
0
Submitted by hugo697 Bun
Verified 14 days ago
1
//native
2
type Adhook = {
3
	token: string
4
}
5

6
export async function main(
7
	auth: Adhook,
8
	id: string,
9
	body: {
10
		name?: string
11
		tags?: {
12
			id?: string
13
			userId?: string
14
			tenantId?: string
15
			subtenantId?: string
16
			text?: string
17
			color?: string
18
		}[]
19
		topics?: { id?: string; name?: string }[]
20
		color?: string
21
		subtenant?: {
22
			id?: string
23
			tenantId?: string
24
			name?: string
25
			status?: 'ACTIVE' | 'INACTIVE'
26
			googleUser?: {
27
				emailAddress?: string
28
				googleCredentials?: string
29
				customerId?: string
30
				mccCustomerId?: string
31
				analyticsProfileId?: string
32
				analyticsType?: 'UNIVERSAL' | 'GA4'
33
				name?: string
34
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
35
				currency?: string
36
				youTubeChannelId?: string
37
			}
38
			googleMyBusinessLocation?: {
39
				accountName?: string
40
				locationName?: string
41
				title?: string
42
				placeId?: string
43
			}
44
			facebookUser?: {
45
				internalId?: string
46
				name?: string
47
				accessToken?: string
48
				accountId?: string
49
				email?: string
50
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
51
				currency?: string
52
			}
53
			facebookPage?: {
54
				pictureUrl?: string
55
				name?: string
56
				id?: string
57
				search?: string
58
			}
59
			instagramAccount?: {
60
				pictureUrl?: string
61
				name?: string
62
				id?: string
63
				search?: string
64
			}
65
			facebookPageForInstagramAdvertising?: {
66
				pictureUrl?: string
67
				name?: string
68
				id?: string
69
				search?: string
70
			}
71
			hideFacebook?: false | true
72
			linkedInUser?: {
73
				name?: string
74
				accessToken?: string
75
				accountId?: string
76
				email?: string
77
				expires?: string
78
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
79
				currency?: string
80
				refreshToken?: string
81
				refreshTokenExpires?: string
82
				status?: 'ACTIVE' | 'CANCELED' | 'DRAFT' | 'REMOVED'
83
			}
84
			linkedInPage?: {
85
				pictureUrl?: string
86
				name?: string
87
				id?: string
88
				search?: string
89
			}
90
			twitterUser?: {
91
				name?: string
92
				accessToken?: string
93
				accessTokenSecret?: string
94
				accountId?: string
95
				email?: string
96
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
97
				currency?: string
98
			}
99
			twitterProfile?: {
100
				pictureUrl?: string
101
				name?: string
102
				id?: string
103
				search?: string
104
			}
105
			tikTokBusinessUser?: {
106
				name?: string
107
				accessToken?: string
108
				expires?: string
109
				refreshToken?: string
110
				refreshTokenExpires?: string
111
				accessTokenSecret?: string
112
				accountId?: string
113
				email?: string
114
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
115
				currency?: string
116
				displayName?: string
117
				profileImageUrl?: string
118
				profileImageId?: string
119
			}
120
			tikTokUser?: {
121
				name?: string
122
				accessToken?: string
123
				expires?: string
124
				refreshToken?: string
125
				refreshTokenExpires?: string
126
				accessTokenSecret?: string
127
				accountId?: string
128
				email?: string
129
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
130
				currency?: string
131
				displayName?: string
132
				profileImageUrl?: string
133
				profileImageId?: string
134
			}
135
			tikTokProfileName?: string
136
			tikTokProfileImage?: {
137
				thumbnailUrl?: string
138
				url?: string
139
				croppedUrl?: string
140
				croppedImageSize?: number
141
				croppedWidth?: number
142
				croppedHeight?: number
143
				facebookImageUrl?: string
144
				tikTokImageId?: string
145
				tags?: { x?: number; y?: number; name?: string }[]
146
				productTags?: {
147
					x?: number
148
					y?: number
149
					productId?: string
150
					productName?: string
151
				}[]
152
				link?: string
153
				linkTitle?: string
154
				linkDescription?: string
155
				order?: number
156
			}
157
			tikTokIdentityId?: string
158
			youTubeUser?: {
159
				emailAddress?: string
160
				googleCredentials?: string
161
				customerId?: string
162
				mccCustomerId?: string
163
				analyticsProfileId?: string
164
				analyticsType?: 'UNIVERSAL' | 'GA4'
165
				name?: string
166
				accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
167
				currency?: string
168
				youTubeChannelId?: string
169
			}
170
			targetRegions?: {
171
				type?: 'CITY' | 'REGION' | 'ZIP' | 'COORDINATE'
172
				city?: string
173
				useRadius?: false | true
174
				radiusInKm?: number
175
				countryCode?: string
176
				lat?: number
177
				lon?: number
178
				bidModifier?: number
179
				bidModifierType?: 'INCREASE' | 'DECREASE'
180
				linkedInUrn?: string
181
				twitterTargetingValue?: string
182
				tikTokLocationId?: string
183
				channel?:
184
					| 'FACEBOOK'
185
					| 'INSTAGRAM'
186
					| 'GOOGLE_ADWORDS'
187
					| 'GOOGLE_DISPLAY_NETWORK'
188
					| 'GOOGLE_ANALYTICS'
189
					| 'YOUTUBE'
190
					| 'XING'
191
					| 'LINKED_IN'
192
					| 'TWITTER'
193
					| 'GOOGLE_MY_BUSINESS'
194
					| 'TIKTOK'
195
					| 'BITLY'
196
				externalPlaceId?: string
197
				regionReviewEnabled?: false | true
198
				regionReviewStatus?: 'PENDING_APPROVAL' | 'APPROVED' | 'NOT_APPROVED'
199
			}[]
200
			language?:
201
				| 'ALL'
202
				| 'DE'
203
				| 'FR'
204
				| 'EN'
205
				| 'IT'
206
				| 'ES'
207
				| 'PT'
208
				| 'NL'
209
				| 'SV'
210
				| 'RO'
211
				| 'CS'
212
				| 'EL'
213
				| 'TR'
214
				| 'PL'
215
				| 'DA'
216
				| 'EU'
217
				| 'CY'
218
				| 'CA'
219
				| 'HU'
220
				| 'SK'
221
				| 'SL'
222
				| 'SQ'
223
				| 'HY'
224
				| 'BS'
225
				| 'BG'
226
				| 'HR'
227
				| 'UK'
228
				| 'NO'
229
				| 'FI'
230
			parentSubtenantId?: string
231
			statisticNotifications?: {
232
				showCampaignInsights?: false | true
233
				showPostInsights?: false | true
234
				showOrganicPostInsights?: false | true
235
				showPaidPostInsights?: false | true
236
				showFollowerInsights?: false | true
237
				email?: string
238
				ccEmailAddresses?: string[]
239
				firstname?: string
240
				name?: string
241
				notificationsMode?: 'DAILY' | 'THREE_DAYS' | 'WEEKLY' | 'MONTHLY' | 'NONE'
242
				sentNotificationsTimestampProtocol?: string[]
243
				language?:
244
					| 'ALL'
245
					| 'DE'
246
					| 'FR'
247
					| 'EN'
248
					| 'IT'
249
					| 'ES'
250
					| 'PT'
251
					| 'NL'
252
					| 'SV'
253
					| 'RO'
254
					| 'CS'
255
					| 'EL'
256
					| 'TR'
257
					| 'PL'
258
					| 'DA'
259
					| 'EU'
260
					| 'CY'
261
					| 'CA'
262
					| 'HU'
263
					| 'SK'
264
					| 'SL'
265
					| 'SQ'
266
					| 'HY'
267
					| 'BS'
268
					| 'BG'
269
					| 'HR'
270
					| 'UK'
271
					| 'NO'
272
					| 'FI'
273
				includeCost?: false | true
274
			}[]
275
			color?: string
276
			website?: string
277
			variables?: { key?: string; value?: string }[]
278
			googleRetargetingLists?: {
279
				googleCustomerId?: string
280
				facebookAccountId?: string
281
				channel?:
282
					| 'FACEBOOK'
283
					| 'INSTAGRAM'
284
					| 'GOOGLE_ADWORDS'
285
					| 'GOOGLE_DISPLAY_NETWORK'
286
					| 'GOOGLE_ANALYTICS'
287
					| 'YOUTUBE'
288
					| 'XING'
289
					| 'LINKED_IN'
290
					| 'TWITTER'
291
					| 'GOOGLE_MY_BUSINESS'
292
					| 'TIKTOK'
293
					| 'BITLY'
294
				name?: string
295
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
296
				userId?: string
297
				googleRetargetingListId?: string
298
				facebookCustomAudienceId?: string
299
				linkedInAudienceId?: string
300
				twitterAudienceId?: string
301
				tikTokAudienceId?: string
302
				urlPath?: string
303
				engagementSource?:
304
					| 'FACEBOOK'
305
					| 'INSTAGRAM'
306
					| 'GOOGLE_ADWORDS'
307
					| 'GOOGLE_DISPLAY_NETWORK'
308
					| 'GOOGLE_ANALYTICS'
309
					| 'YOUTUBE'
310
					| 'XING'
311
					| 'LINKED_IN'
312
					| 'TWITTER'
313
					| 'GOOGLE_MY_BUSINESS'
314
					| 'TIKTOK'
315
					| 'BITLY'
316
				engagementType?: 'ENGAGED' | 'FOLLOWER'
317
				description?: string
318
				audienceSize?: number
319
				retentionDays?: number
320
			}[]
321
			facebookRetargetingLists?: {
322
				googleCustomerId?: string
323
				facebookAccountId?: string
324
				channel?:
325
					| 'FACEBOOK'
326
					| 'INSTAGRAM'
327
					| 'GOOGLE_ADWORDS'
328
					| 'GOOGLE_DISPLAY_NETWORK'
329
					| 'GOOGLE_ANALYTICS'
330
					| 'YOUTUBE'
331
					| 'XING'
332
					| 'LINKED_IN'
333
					| 'TWITTER'
334
					| 'GOOGLE_MY_BUSINESS'
335
					| 'TIKTOK'
336
					| 'BITLY'
337
				name?: string
338
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
339
				userId?: string
340
				googleRetargetingListId?: string
341
				facebookCustomAudienceId?: string
342
				linkedInAudienceId?: string
343
				twitterAudienceId?: string
344
				tikTokAudienceId?: string
345
				urlPath?: string
346
				engagementSource?:
347
					| 'FACEBOOK'
348
					| 'INSTAGRAM'
349
					| 'GOOGLE_ADWORDS'
350
					| 'GOOGLE_DISPLAY_NETWORK'
351
					| 'GOOGLE_ANALYTICS'
352
					| 'YOUTUBE'
353
					| 'XING'
354
					| 'LINKED_IN'
355
					| 'TWITTER'
356
					| 'GOOGLE_MY_BUSINESS'
357
					| 'TIKTOK'
358
					| 'BITLY'
359
				engagementType?: 'ENGAGED' | 'FOLLOWER'
360
				description?: string
361
				audienceSize?: number
362
				retentionDays?: number
363
			}[]
364
			linkedInRetargetingLists?: {
365
				googleCustomerId?: string
366
				facebookAccountId?: string
367
				channel?:
368
					| 'FACEBOOK'
369
					| 'INSTAGRAM'
370
					| 'GOOGLE_ADWORDS'
371
					| 'GOOGLE_DISPLAY_NETWORK'
372
					| 'GOOGLE_ANALYTICS'
373
					| 'YOUTUBE'
374
					| 'XING'
375
					| 'LINKED_IN'
376
					| 'TWITTER'
377
					| 'GOOGLE_MY_BUSINESS'
378
					| 'TIKTOK'
379
					| 'BITLY'
380
				name?: string
381
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
382
				userId?: string
383
				googleRetargetingListId?: string
384
				facebookCustomAudienceId?: string
385
				linkedInAudienceId?: string
386
				twitterAudienceId?: string
387
				tikTokAudienceId?: string
388
				urlPath?: string
389
				engagementSource?:
390
					| 'FACEBOOK'
391
					| 'INSTAGRAM'
392
					| 'GOOGLE_ADWORDS'
393
					| 'GOOGLE_DISPLAY_NETWORK'
394
					| 'GOOGLE_ANALYTICS'
395
					| 'YOUTUBE'
396
					| 'XING'
397
					| 'LINKED_IN'
398
					| 'TWITTER'
399
					| 'GOOGLE_MY_BUSINESS'
400
					| 'TIKTOK'
401
					| 'BITLY'
402
				engagementType?: 'ENGAGED' | 'FOLLOWER'
403
				description?: string
404
				audienceSize?: number
405
				retentionDays?: number
406
			}[]
407
			twitterRetargetingLists?: {
408
				googleCustomerId?: string
409
				facebookAccountId?: string
410
				channel?:
411
					| 'FACEBOOK'
412
					| 'INSTAGRAM'
413
					| 'GOOGLE_ADWORDS'
414
					| 'GOOGLE_DISPLAY_NETWORK'
415
					| 'GOOGLE_ANALYTICS'
416
					| 'YOUTUBE'
417
					| 'XING'
418
					| 'LINKED_IN'
419
					| 'TWITTER'
420
					| 'GOOGLE_MY_BUSINESS'
421
					| 'TIKTOK'
422
					| 'BITLY'
423
				name?: string
424
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
425
				userId?: string
426
				googleRetargetingListId?: string
427
				facebookCustomAudienceId?: string
428
				linkedInAudienceId?: string
429
				twitterAudienceId?: string
430
				tikTokAudienceId?: string
431
				urlPath?: string
432
				engagementSource?:
433
					| 'FACEBOOK'
434
					| 'INSTAGRAM'
435
					| 'GOOGLE_ADWORDS'
436
					| 'GOOGLE_DISPLAY_NETWORK'
437
					| 'GOOGLE_ANALYTICS'
438
					| 'YOUTUBE'
439
					| 'XING'
440
					| 'LINKED_IN'
441
					| 'TWITTER'
442
					| 'GOOGLE_MY_BUSINESS'
443
					| 'TIKTOK'
444
					| 'BITLY'
445
				engagementType?: 'ENGAGED' | 'FOLLOWER'
446
				description?: string
447
				audienceSize?: number
448
				retentionDays?: number
449
			}[]
450
			googleRetargetingLists2?: {
451
				googleCustomerId?: string
452
				facebookAccountId?: string
453
				channel?:
454
					| 'FACEBOOK'
455
					| 'INSTAGRAM'
456
					| 'GOOGLE_ADWORDS'
457
					| 'GOOGLE_DISPLAY_NETWORK'
458
					| 'GOOGLE_ANALYTICS'
459
					| 'YOUTUBE'
460
					| 'XING'
461
					| 'LINKED_IN'
462
					| 'TWITTER'
463
					| 'GOOGLE_MY_BUSINESS'
464
					| 'TIKTOK'
465
					| 'BITLY'
466
				name?: string
467
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
468
				userId?: string
469
				googleRetargetingListId?: string
470
				facebookCustomAudienceId?: string
471
				linkedInAudienceId?: string
472
				twitterAudienceId?: string
473
				tikTokAudienceId?: string
474
				urlPath?: string
475
				engagementSource?:
476
					| 'FACEBOOK'
477
					| 'INSTAGRAM'
478
					| 'GOOGLE_ADWORDS'
479
					| 'GOOGLE_DISPLAY_NETWORK'
480
					| 'GOOGLE_ANALYTICS'
481
					| 'YOUTUBE'
482
					| 'XING'
483
					| 'LINKED_IN'
484
					| 'TWITTER'
485
					| 'GOOGLE_MY_BUSINESS'
486
					| 'TIKTOK'
487
					| 'BITLY'
488
				engagementType?: 'ENGAGED' | 'FOLLOWER'
489
				description?: string
490
				audienceSize?: number
491
				retentionDays?: number
492
			}[]
493
			facebookRetargetingLists2?: {
494
				googleCustomerId?: string
495
				facebookAccountId?: string
496
				channel?:
497
					| 'FACEBOOK'
498
					| 'INSTAGRAM'
499
					| 'GOOGLE_ADWORDS'
500
					| 'GOOGLE_DISPLAY_NETWORK'
501
					| 'GOOGLE_ANALYTICS'
502
					| 'YOUTUBE'
503
					| 'XING'
504
					| 'LINKED_IN'
505
					| 'TWITTER'
506
					| 'GOOGLE_MY_BUSINESS'
507
					| 'TIKTOK'
508
					| 'BITLY'
509
				name?: string
510
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
511
				userId?: string
512
				googleRetargetingListId?: string
513
				facebookCustomAudienceId?: string
514
				linkedInAudienceId?: string
515
				twitterAudienceId?: string
516
				tikTokAudienceId?: string
517
				urlPath?: string
518
				engagementSource?:
519
					| 'FACEBOOK'
520
					| 'INSTAGRAM'
521
					| 'GOOGLE_ADWORDS'
522
					| 'GOOGLE_DISPLAY_NETWORK'
523
					| 'GOOGLE_ANALYTICS'
524
					| 'YOUTUBE'
525
					| 'XING'
526
					| 'LINKED_IN'
527
					| 'TWITTER'
528
					| 'GOOGLE_MY_BUSINESS'
529
					| 'TIKTOK'
530
					| 'BITLY'
531
				engagementType?: 'ENGAGED' | 'FOLLOWER'
532
				description?: string
533
				audienceSize?: number
534
				retentionDays?: number
535
			}[]
536
			linkedInRetargetingLists2?: {
537
				googleCustomerId?: string
538
				facebookAccountId?: string
539
				channel?:
540
					| 'FACEBOOK'
541
					| 'INSTAGRAM'
542
					| 'GOOGLE_ADWORDS'
543
					| 'GOOGLE_DISPLAY_NETWORK'
544
					| 'GOOGLE_ANALYTICS'
545
					| 'YOUTUBE'
546
					| 'XING'
547
					| 'LINKED_IN'
548
					| 'TWITTER'
549
					| 'GOOGLE_MY_BUSINESS'
550
					| 'TIKTOK'
551
					| 'BITLY'
552
				name?: string
553
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
554
				userId?: string
555
				googleRetargetingListId?: string
556
				facebookCustomAudienceId?: string
557
				linkedInAudienceId?: string
558
				twitterAudienceId?: string
559
				tikTokAudienceId?: string
560
				urlPath?: string
561
				engagementSource?:
562
					| 'FACEBOOK'
563
					| 'INSTAGRAM'
564
					| 'GOOGLE_ADWORDS'
565
					| 'GOOGLE_DISPLAY_NETWORK'
566
					| 'GOOGLE_ANALYTICS'
567
					| 'YOUTUBE'
568
					| 'XING'
569
					| 'LINKED_IN'
570
					| 'TWITTER'
571
					| 'GOOGLE_MY_BUSINESS'
572
					| 'TIKTOK'
573
					| 'BITLY'
574
				engagementType?: 'ENGAGED' | 'FOLLOWER'
575
				description?: string
576
				audienceSize?: number
577
				retentionDays?: number
578
			}[]
579
			twitterRetargetingLists2?: {
580
				googleCustomerId?: string
581
				facebookAccountId?: string
582
				channel?:
583
					| 'FACEBOOK'
584
					| 'INSTAGRAM'
585
					| 'GOOGLE_ADWORDS'
586
					| 'GOOGLE_DISPLAY_NETWORK'
587
					| 'GOOGLE_ANALYTICS'
588
					| 'YOUTUBE'
589
					| 'XING'
590
					| 'LINKED_IN'
591
					| 'TWITTER'
592
					| 'GOOGLE_MY_BUSINESS'
593
					| 'TIKTOK'
594
					| 'BITLY'
595
				name?: string
596
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
597
				userId?: string
598
				googleRetargetingListId?: string
599
				facebookCustomAudienceId?: string
600
				linkedInAudienceId?: string
601
				twitterAudienceId?: string
602
				tikTokAudienceId?: string
603
				urlPath?: string
604
				engagementSource?:
605
					| 'FACEBOOK'
606
					| 'INSTAGRAM'
607
					| 'GOOGLE_ADWORDS'
608
					| 'GOOGLE_DISPLAY_NETWORK'
609
					| 'GOOGLE_ANALYTICS'
610
					| 'YOUTUBE'
611
					| 'XING'
612
					| 'LINKED_IN'
613
					| 'TWITTER'
614
					| 'GOOGLE_MY_BUSINESS'
615
					| 'TIKTOK'
616
					| 'BITLY'
617
				engagementType?: 'ENGAGED' | 'FOLLOWER'
618
				description?: string
619
				audienceSize?: number
620
				retentionDays?: number
621
			}[]
622
			googleExcludedRetargetingLists?: {
623
				googleCustomerId?: string
624
				facebookAccountId?: string
625
				channel?:
626
					| 'FACEBOOK'
627
					| 'INSTAGRAM'
628
					| 'GOOGLE_ADWORDS'
629
					| 'GOOGLE_DISPLAY_NETWORK'
630
					| 'GOOGLE_ANALYTICS'
631
					| 'YOUTUBE'
632
					| 'XING'
633
					| 'LINKED_IN'
634
					| 'TWITTER'
635
					| 'GOOGLE_MY_BUSINESS'
636
					| 'TIKTOK'
637
					| 'BITLY'
638
				name?: string
639
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
640
				userId?: string
641
				googleRetargetingListId?: string
642
				facebookCustomAudienceId?: string
643
				linkedInAudienceId?: string
644
				twitterAudienceId?: string
645
				tikTokAudienceId?: string
646
				urlPath?: string
647
				engagementSource?:
648
					| 'FACEBOOK'
649
					| 'INSTAGRAM'
650
					| 'GOOGLE_ADWORDS'
651
					| 'GOOGLE_DISPLAY_NETWORK'
652
					| 'GOOGLE_ANALYTICS'
653
					| 'YOUTUBE'
654
					| 'XING'
655
					| 'LINKED_IN'
656
					| 'TWITTER'
657
					| 'GOOGLE_MY_BUSINESS'
658
					| 'TIKTOK'
659
					| 'BITLY'
660
				engagementType?: 'ENGAGED' | 'FOLLOWER'
661
				description?: string
662
				audienceSize?: number
663
				retentionDays?: number
664
			}[]
665
			facebookExcludedRetargetingLists?: {
666
				googleCustomerId?: string
667
				facebookAccountId?: string
668
				channel?:
669
					| 'FACEBOOK'
670
					| 'INSTAGRAM'
671
					| 'GOOGLE_ADWORDS'
672
					| 'GOOGLE_DISPLAY_NETWORK'
673
					| 'GOOGLE_ANALYTICS'
674
					| 'YOUTUBE'
675
					| 'XING'
676
					| 'LINKED_IN'
677
					| 'TWITTER'
678
					| 'GOOGLE_MY_BUSINESS'
679
					| 'TIKTOK'
680
					| 'BITLY'
681
				name?: string
682
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
683
				userId?: string
684
				googleRetargetingListId?: string
685
				facebookCustomAudienceId?: string
686
				linkedInAudienceId?: string
687
				twitterAudienceId?: string
688
				tikTokAudienceId?: string
689
				urlPath?: string
690
				engagementSource?:
691
					| 'FACEBOOK'
692
					| 'INSTAGRAM'
693
					| 'GOOGLE_ADWORDS'
694
					| 'GOOGLE_DISPLAY_NETWORK'
695
					| 'GOOGLE_ANALYTICS'
696
					| 'YOUTUBE'
697
					| 'XING'
698
					| 'LINKED_IN'
699
					| 'TWITTER'
700
					| 'GOOGLE_MY_BUSINESS'
701
					| 'TIKTOK'
702
					| 'BITLY'
703
				engagementType?: 'ENGAGED' | 'FOLLOWER'
704
				description?: string
705
				audienceSize?: number
706
				retentionDays?: number
707
			}[]
708
			linkedInExcludedRetargetingLists?: {
709
				googleCustomerId?: string
710
				facebookAccountId?: string
711
				channel?:
712
					| 'FACEBOOK'
713
					| 'INSTAGRAM'
714
					| 'GOOGLE_ADWORDS'
715
					| 'GOOGLE_DISPLAY_NETWORK'
716
					| 'GOOGLE_ANALYTICS'
717
					| 'YOUTUBE'
718
					| 'XING'
719
					| 'LINKED_IN'
720
					| 'TWITTER'
721
					| 'GOOGLE_MY_BUSINESS'
722
					| 'TIKTOK'
723
					| 'BITLY'
724
				name?: string
725
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
726
				userId?: string
727
				googleRetargetingListId?: string
728
				facebookCustomAudienceId?: string
729
				linkedInAudienceId?: string
730
				twitterAudienceId?: string
731
				tikTokAudienceId?: string
732
				urlPath?: string
733
				engagementSource?:
734
					| 'FACEBOOK'
735
					| 'INSTAGRAM'
736
					| 'GOOGLE_ADWORDS'
737
					| 'GOOGLE_DISPLAY_NETWORK'
738
					| 'GOOGLE_ANALYTICS'
739
					| 'YOUTUBE'
740
					| 'XING'
741
					| 'LINKED_IN'
742
					| 'TWITTER'
743
					| 'GOOGLE_MY_BUSINESS'
744
					| 'TIKTOK'
745
					| 'BITLY'
746
				engagementType?: 'ENGAGED' | 'FOLLOWER'
747
				description?: string
748
				audienceSize?: number
749
				retentionDays?: number
750
			}[]
751
			twitterExcludedRetargetingLists?: {
752
				googleCustomerId?: string
753
				facebookAccountId?: string
754
				channel?:
755
					| 'FACEBOOK'
756
					| 'INSTAGRAM'
757
					| 'GOOGLE_ADWORDS'
758
					| 'GOOGLE_DISPLAY_NETWORK'
759
					| 'GOOGLE_ANALYTICS'
760
					| 'YOUTUBE'
761
					| 'XING'
762
					| 'LINKED_IN'
763
					| 'TWITTER'
764
					| 'GOOGLE_MY_BUSINESS'
765
					| 'TIKTOK'
766
					| 'BITLY'
767
				name?: string
768
				status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
769
				userId?: string
770
				googleRetargetingListId?: string
771
				facebookCustomAudienceId?: string
772
				linkedInAudienceId?: string
773
				twitterAudienceId?: string
774
				tikTokAudienceId?: string
775
				urlPath?: string
776
				engagementSource?:
777
					| 'FACEBOOK'
778
					| 'INSTAGRAM'
779
					| 'GOOGLE_ADWORDS'
780
					| 'GOOGLE_DISPLAY_NETWORK'
781
					| 'GOOGLE_ANALYTICS'
782
					| 'YOUTUBE'
783
					| 'XING'
784
					| 'LINKED_IN'
785
					| 'TWITTER'
786
					| 'GOOGLE_MY_BUSINESS'
787
					| 'TIKTOK'
788
					| 'BITLY'
789
				engagementType?: 'ENGAGED' | 'FOLLOWER'
790
				description?: string
791
				audienceSize?: number
792
				retentionDays?: number
793
			}[]
794
			skippablePostReview?: false | true
795
			postReviewUserId?: string
796
			postReviewUserIds?: string[]
797
			campaignReviewUserIds?: string[]
798
			postCandidateReviewMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
799
			campaignCandidateReviewMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
800
			postCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
801
			campaignCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
802
			secondPostReviewStepEnabled?: false | true
803
			secondCampaignReviewStepEnabled?: false | true
804
			secondPostReviewStepUserIds?: string[]
805
			secondCampaignReviewStepUserIds?: string[]
806
			postCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
807
			campaignCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
808
			thirdPostReviewStepEnabled?: false | true
809
			thirdCampaignReviewStepEnabled?: false | true
810
			thirdPostReviewStepUserIds?: string[]
811
			thirdCampaignReviewStepUserIds?: string[]
812
			enforceManualApprovalForSelfCreatedPosts?: false | true
813
			enforceManualApprovalForSelfCreatedCampaigns?: false | true
814
			allowInstagram?: false | true
815
			postTargeting?: {
816
				linkedInLanguageTargeting?: false | true
817
				selectedLinkedInLanguages?:
818
					| 'ALL'
819
					| 'DE'
820
					| 'FR'
821
					| 'EN'
822
					| 'IT'
823
					| 'ES'
824
					| 'PT'
825
					| 'NL'
826
					| 'SV'
827
					| 'RO'
828
					| 'CS'
829
					| 'EL'
830
					| 'TR'
831
					| 'PL'
832
					| 'DA'
833
					| 'EU'
834
					| 'CY'
835
					| 'CA'
836
					| 'HU'
837
					| 'SK'
838
					| 'SL'
839
					| 'SQ'
840
					| 'HY'
841
					| 'BS'
842
					| 'BG'
843
					| 'HR'
844
					| 'UK'
845
					| 'NO'
846
					| 'FI'[]
847
				linkedInRegionTargeting?: false | true
848
				selectedLinkedInRegions?: { id?: string; name?: string }[]
849
				facebookRegionTargeting?: false | true
850
				selectedFacebookCountries?: { id?: string; name?: string }[]
851
				facebookLocaleTargeting?: false | true
852
				selectedFacebookLocales?: { id?: string; name?: string }[]
853
			}
854
			responsibleUserId?: string
855
			linkedInAccountCurrency?:
856
				| 'ALL'
857
				| 'CHF'
858
				| 'USD'
859
				| 'EUR'
860
				| 'AED'
861
				| 'AFN'
862
				| 'AMD'
863
				| 'ANG'
864
				| 'AOA'
865
				| 'ARS'
866
				| 'AUD'
867
				| 'AWG'
868
				| 'AZN'
869
				| 'BAM'
870
				| 'BBD'
871
				| 'BDT'
872
				| 'BGN'
873
				| 'BHD'
874
				| 'BIF'
875
				| 'BMD'
876
				| 'BND'
877
				| 'BOB'
878
				| 'BOV'
879
				| 'BRL'
880
				| 'BSD'
881
				| 'BTN'
882
				| 'BWP'
883
				| 'BYN'
884
				| 'BZD'
885
				| 'CAD'
886
				| 'CDF'
887
				| 'CHE'
888
				| 'CHW'
889
				| 'CLF'
890
				| 'CLP'
891
				| 'CNY'
892
				| 'COP'
893
				| 'COU'
894
				| 'CRC'
895
				| 'CUC'
896
				| 'CUP'
897
				| 'CVE'
898
				| 'CZK'
899
				| 'DJF'
900
				| 'DKK'
901
				| 'DOP'
902
				| 'DZD'
903
				| 'EGP'
904
				| 'ERN'
905
				| 'ETB'
906
				| 'FJD'
907
				| 'FKP'
908
				| 'GBP'
909
				| 'GEL'
910
				| 'GHS'
911
				| 'GIP'
912
				| 'GMD'
913
				| 'GNF'
914
				| 'GTQ'
915
				| 'GYD'
916
				| 'HKD'
917
				| 'HNL'
918
				| 'HRK'
919
				| 'HTG'
920
				| 'HUF'
921
				| 'IDR'
922
				| 'ILS'
923
				| 'INR'
924
				| 'IQD'
925
				| 'IRR'
926
				| 'ISK'
927
				| 'JMD'
928
				| 'JOD'
929
				| 'JPY'
930
				| 'KES'
931
				| 'KGS'
932
				| 'KHR'
933
				| 'KMF'
934
				| 'KPW'
935
				| 'KRW'
936
				| 'KWD'
937
				| 'KYD'
938
				| 'KZT'
939
				| 'LAK'
940
				| 'LBP'
941
				| 'LKR'
942
				| 'LRD'
943
				| 'LSL'
944
				| 'LYD'
945
				| 'MAD'
946
				| 'MDL'
947
				| 'MGA'
948
				| 'MKD'
949
				| 'MMK'
950
				| 'MNT'
951
				| 'MOP'
952
				| 'MRU'
953
				| 'MUR'
954
				| 'MVR'
955
				| 'MWK'
956
				| 'MXN'
957
				| 'MXV'
958
				| 'MYR'
959
				| 'MZN'
960
				| 'NAD'
961
				| 'NGN'
962
				| 'NIO'
963
				| 'NOK'
964
				| 'NPR'
965
				| 'NZD'
966
				| 'OMR'
967
				| 'PAB'
968
				| 'PEN'
969
				| 'PGK'
970
				| 'PHP'
971
				| 'PKR'
972
				| 'PLN'
973
				| 'PYG'
974
				| 'QAR'
975
				| 'RON'
976
				| 'RSD'
977
				| 'RUB'
978
				| 'RWF'
979
				| 'SAR'
980
				| 'SBD'
981
				| 'SCR'
982
				| 'SDG'
983
				| 'SEK'
984
				| 'SGD'
985
				| 'SHP'
986
				| 'SLL'
987
				| 'SOS'
988
				| 'SRD'
989
				| 'SSP'
990
				| 'STN'
991
				| 'SVC'
992
				| 'SYP'
993
				| 'SZL'
994
				| 'THB'
995
				| 'TJS'
996
				| 'TMT'
997
				| 'TND'
998
				| 'TOP'
999
				| 'TRY'
1000
				| 'TTD'
1001
				| 'TWD'
1002
				| 'TZS'
1003
				| 'UAH'
1004
				| 'UGX'
1005
				| 'UYI'
1006
				| 'UYU'
1007
				| 'UYW'
1008
				| 'UZS'
1009
				| 'VES'
1010
				| 'VND'
1011
				| 'VUV'
1012
				| 'WST'
1013
				| 'XAF'
1014
				| 'XCD'
1015
				| 'XOF'
1016
				| 'XPF'
1017
				| 'XSU'
1018
				| 'YER'
1019
				| 'ZAR'
1020
				| 'ZMW'
1021
				| 'ZWL'
1022
			marginPercentage?: number
1023
			marginPerChannel?: false | true
1024
			googleMarginPercentage?: number
1025
			facebookMarginPercentage?: number
1026
			linkedInMarginPercentage?: number
1027
			twitterMarginPercentage?: number
1028
			tikTokMarginPercentage?: number
1029
			primary?: false | true
1030
			postPublishingEnabled?: false | true
1031
			postGenerationEnabled?: false | true
1032
			automaticPostImportEnabled?: false | true
1033
			automaticCampaignImportEnabled?: false | true
1034
			campaignGenerationEnabled?: false | true
1035
			postTargetingEnabled?: false | true
1036
			adCommentModerationEnabled?: false | true
1037
			postCommentModerationEnabled?: false | true
1038
			mentionModerationEnabled?: false | true
1039
			messageModerationEnabled?: false | true
1040
			reviewModerationEnabled?: false | true
1041
			adCommentNotificationEnabled?: false | true
1042
			postCommentNotificationEnabled?: false | true
1043
			adCommentDefaultAssigneeUserId?: string
1044
			postCommentDefaultAssigneeUserId?: string
1045
			mentionNotificationEnabled?: false | true
1046
			messageNotificationEnabled?: false | true
1047
			reviewNotificationEnabled?: false | true
1048
			ccModerationNotificationUserIds?: string[]
1049
			ccModerationNotificationScopes?:
1050
				| 'AD_COMMENTS'
1051
				| 'POST_COMMENTS'
1052
				| 'MENTIONS'
1053
				| 'DIRECT_MESSAGES'[]
1054
			postPublishErrorHandling?: 'USER_NOTIFICATION' | 'SUPPORT_TICKET'
1055
			linkedInFollowerBreakdownByCountry?: false | true
1056
			facebookFollowerBreakdownByCountry?: false | true
1057
			adBeneficiary?: string
1058
			adPayor?: string
1059
			favorite?: false | true
1060
			hashtagMonitoring?: {
1061
				hashtags?: { name?: string; instagramId?: string }[]
1062
			}
1063
			allowAddingLinksToBio?: false | true
1064
			sendNotificationOnPostPublicationDefault?: false | true
1065
			biolinkPage?: {
1066
				pictureUrl?: string
1067
				name?: string
1068
				id?: string
1069
				search?: string
1070
			}
1071
		}
1072
		type?:
1073
			| 'TRAFFIC'
1074
			| 'CONVERSIONS'
1075
			| 'RETARGETING'
1076
			| 'SHOPPING'
1077
			| 'CARS'
1078
			| 'REAL_ESTATE'
1079
			| 'JOBS'
1080
			| 'EVENTS'
1081
			| 'APP'
1082
			| 'ENGAGEMENT'
1083
			| 'VIDEO_VIEWS'
1084
			| 'CALLS'
1085
			| 'REACH'
1086
			| 'FOLLOWERS'
1087
			| 'PROFILE_VIEWS'
1088
			| 'LEADS'
1089
			| 'PERFORMANCE_MAX'
1090
		customGoal?: string
1091
		marginPercentage?: number
1092
	}
1093
) {
1094
	const url = new URL(`https://app.adhook.io/v1/promotions/${id}/settings`)
1095

1096
	const response = await fetch(url, {
1097
		method: 'POST',
1098
		headers: {
1099
			Authorization: `Bearer ${auth.token}`,
1100
			'Content-Type': 'application/json'
1101
		},
1102
		body: JSON.stringify(body)
1103
	})
1104

1105
	if (!response.ok) {
1106
		const text = await response.text()
1107
		throw new Error(`${response.status} ${text}`)
1108
	}
1109

1110
	return await response.json()
1111
}
1112