Update subtenant

Script adhook Verified

by hugo697 ยท 12/20/2024

The script

Submitted by hugo697 Bun
Verified 519 days ago
1
//native
2
type Adhook = {
3
	token: string
4
}
5

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

1120
	const response = await fetch(url, {
1121
		method: 'PUT',
1122
		headers: {
1123
			Authorization: `Bearer ${auth.token}`,
1124
			'Content-Type': 'application/json'
1125
		},
1126
		body: JSON.stringify(body)
1127
	})
1128

1129
	if (!response.ok) {
1130
		const text = await response.text()
1131
		throw new Error(`${response.status} ${text}`)
1132
	}
1133

1134
	return await response.json()
1135
}
1136