Edits history of script submission #10517 for ' Create subtenant (adhook)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Adhook = {
    	token: string
    }
    
    export async function main(
    	auth: Adhook,
    	body: {
    		id?: string
    		tenantId?: string
    		name?: string
    		status?: 'ACTIVE' | 'INACTIVE'
    		googleUser?: {
    			emailAddress?: string
    			googleCredentials?: string
    			customerId?: string
    			mccCustomerId?: string
    			analyticsProfileId?: string
    			analyticsType?: 'UNIVERSAL' | 'GA4'
    			name?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    			youTubeChannelId?: string
    		}
    		googleMyBusinessLocation?: {
    			accountName?: string
    			locationName?: string
    			title?: string
    			placeId?: string
    		}
    		facebookUser?: {
    			internalId?: string
    			name?: string
    			accessToken?: string
    			accountId?: string
    			email?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    		}
    		linkedInUser?: {
    			name?: string
    			accessToken?: string
    			accountId?: string
    			email?: string
    			expires?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    			refreshToken?: string
    			refreshTokenExpires?: string
    			status?: 'ACTIVE' | 'CANCELED' | 'DRAFT' | 'REMOVED'
    		}
    		linkedInPage?: {
    			pictureUrl?: string
    			name?: string
    			id?: string
    			search?: string
    		}
    		twitterUser?: {
    			name?: string
    			accessToken?: string
    			accessTokenSecret?: string
    			accountId?: string
    			email?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    		}
    		facebookPage?: {
    			pictureUrl?: string
    			name?: string
    			id?: string
    			search?: string
    		}
    		instagramAccount?: {
    			pictureUrl?: string
    			name?: string
    			id?: string
    			search?: string
    		}
    		hideFacebook?: false | true
    		twitterProfile?: {
    			pictureUrl?: string
    			name?: string
    			id?: string
    			search?: string
    		}
    		tikTokBusinessUser?: {
    			name?: string
    			accessToken?: string
    			expires?: string
    			refreshToken?: string
    			refreshTokenExpires?: string
    			accessTokenSecret?: string
    			accountId?: string
    			email?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    			displayName?: string
    			profileImageUrl?: string
    			profileImageId?: string
    		}
    		tikTokUser?: {
    			name?: string
    			accessToken?: string
    			expires?: string
    			refreshToken?: string
    			refreshTokenExpires?: string
    			accessTokenSecret?: string
    			accountId?: string
    			email?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    			displayName?: string
    			profileImageUrl?: string
    			profileImageId?: string
    		}
    		tikTokProfileName?: string
    		tikTokProfileImage?: {
    			thumbnailUrl?: string
    			url?: string
    			croppedUrl?: string
    			croppedImageSize?: number
    			croppedWidth?: number
    			croppedHeight?: number
    			facebookImageUrl?: string
    			tikTokImageId?: string
    			tags?: { x?: number; y?: number; name?: string }[]
    			productTags?: {
    				x?: number
    				y?: number
    				productId?: string
    				productName?: string
    			}[]
    			link?: string
    			linkTitle?: string
    			linkDescription?: string
    			order?: number
    		}
    		youTubeUser?: {
    			emailAddress?: string
    			googleCredentials?: string
    			customerId?: string
    			mccCustomerId?: string
    			analyticsProfileId?: string
    			analyticsType?: 'UNIVERSAL' | 'GA4'
    			name?: string
    			accountType?: 'AD_ACCOUNT' | 'USER_ACCOUNT'
    			currency?: string
    			youTubeChannelId?: string
    		}
    		targetRegions?: {
    			type?: 'CITY' | 'REGION' | 'ZIP' | 'COORDINATE'
    			city?: string
    			useRadius?: false | true
    			radiusInKm?: number
    			countryCode?: string
    			lat?: number
    			lon?: number
    			bidModifier?: number
    			bidModifierType?: 'INCREASE' | 'DECREASE'
    			linkedInUrn?: string
    			twitterTargetingValue?: string
    			tikTokLocationId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			externalPlaceId?: string
    			regionReviewEnabled?: false | true
    			regionReviewStatus?: 'PENDING_APPROVAL' | 'APPROVED' | 'NOT_APPROVED'
    		}[]
    		parentSubtenantId?: string
    		statisticNotifications?: {
    			showCampaignInsights?: false | true
    			showPostInsights?: false | true
    			showOrganicPostInsights?: false | true
    			showPaidPostInsights?: false | true
    			showFollowerInsights?: false | true
    			email?: string
    			ccEmailAddresses?: string[]
    			firstname?: string
    			name?: string
    			notificationsMode?: 'DAILY' | 'THREE_DAYS' | 'WEEKLY' | 'MONTHLY' | 'NONE'
    			sentNotificationsTimestampProtocol?: string[]
    			language?:
    				| 'ALL'
    				| 'DE'
    				| 'FR'
    				| 'EN'
    				| 'IT'
    				| 'ES'
    				| 'PT'
    				| 'NL'
    				| 'SV'
    				| 'RO'
    				| 'CS'
    				| 'EL'
    				| 'TR'
    				| 'PL'
    				| 'DA'
    				| 'EU'
    				| 'CY'
    				| 'CA'
    				| 'HU'
    				| 'SK'
    				| 'SL'
    				| 'SQ'
    				| 'HY'
    				| 'BS'
    				| 'BG'
    				| 'HR'
    				| 'UK'
    				| 'NO'
    				| 'FI'
    			includeCost?: false | true
    		}[]
    		color?: string
    		linkedInAccountCurrency?:
    			| 'ALL'
    			| 'CHF'
    			| 'USD'
    			| 'EUR'
    			| 'AED'
    			| 'AFN'
    			| 'AMD'
    			| 'ANG'
    			| 'AOA'
    			| 'ARS'
    			| 'AUD'
    			| 'AWG'
    			| 'AZN'
    			| 'BAM'
    			| 'BBD'
    			| 'BDT'
    			| 'BGN'
    			| 'BHD'
    			| 'BIF'
    			| 'BMD'
    			| 'BND'
    			| 'BOB'
    			| 'BOV'
    			| 'BRL'
    			| 'BSD'
    			| 'BTN'
    			| 'BWP'
    			| 'BYN'
    			| 'BZD'
    			| 'CAD'
    			| 'CDF'
    			| 'CHE'
    			| 'CHW'
    			| 'CLF'
    			| 'CLP'
    			| 'CNY'
    			| 'COP'
    			| 'COU'
    			| 'CRC'
    			| 'CUC'
    			| 'CUP'
    			| 'CVE'
    			| 'CZK'
    			| 'DJF'
    			| 'DKK'
    			| 'DOP'
    			| 'DZD'
    			| 'EGP'
    			| 'ERN'
    			| 'ETB'
    			| 'FJD'
    			| 'FKP'
    			| 'GBP'
    			| 'GEL'
    			| 'GHS'
    			| 'GIP'
    			| 'GMD'
    			| 'GNF'
    			| 'GTQ'
    			| 'GYD'
    			| 'HKD'
    			| 'HNL'
    			| 'HRK'
    			| 'HTG'
    			| 'HUF'
    			| 'IDR'
    			| 'ILS'
    			| 'INR'
    			| 'IQD'
    			| 'IRR'
    			| 'ISK'
    			| 'JMD'
    			| 'JOD'
    			| 'JPY'
    			| 'KES'
    			| 'KGS'
    			| 'KHR'
    			| 'KMF'
    			| 'KPW'
    			| 'KRW'
    			| 'KWD'
    			| 'KYD'
    			| 'KZT'
    			| 'LAK'
    			| 'LBP'
    			| 'LKR'
    			| 'LRD'
    			| 'LSL'
    			| 'LYD'
    			| 'MAD'
    			| 'MDL'
    			| 'MGA'
    			| 'MKD'
    			| 'MMK'
    			| 'MNT'
    			| 'MOP'
    			| 'MRU'
    			| 'MUR'
    			| 'MVR'
    			| 'MWK'
    			| 'MXN'
    			| 'MXV'
    			| 'MYR'
    			| 'MZN'
    			| 'NAD'
    			| 'NGN'
    			| 'NIO'
    			| 'NOK'
    			| 'NPR'
    			| 'NZD'
    			| 'OMR'
    			| 'PAB'
    			| 'PEN'
    			| 'PGK'
    			| 'PHP'
    			| 'PKR'
    			| 'PLN'
    			| 'PYG'
    			| 'QAR'
    			| 'RON'
    			| 'RSD'
    			| 'RUB'
    			| 'RWF'
    			| 'SAR'
    			| 'SBD'
    			| 'SCR'
    			| 'SDG'
    			| 'SEK'
    			| 'SGD'
    			| 'SHP'
    			| 'SLL'
    			| 'SOS'
    			| 'SRD'
    			| 'SSP'
    			| 'STN'
    			| 'SVC'
    			| 'SYP'
    			| 'SZL'
    			| 'THB'
    			| 'TJS'
    			| 'TMT'
    			| 'TND'
    			| 'TOP'
    			| 'TRY'
    			| 'TTD'
    			| 'TWD'
    			| 'TZS'
    			| 'UAH'
    			| 'UGX'
    			| 'UYI'
    			| 'UYU'
    			| 'UYW'
    			| 'UZS'
    			| 'VES'
    			| 'VND'
    			| 'VUV'
    			| 'WST'
    			| 'XAF'
    			| 'XCD'
    			| 'XOF'
    			| 'XPF'
    			| 'XSU'
    			| 'YER'
    			| 'ZAR'
    			| 'ZMW'
    			| 'ZWL'
    		authorizationGroup?: {
    			id?: string
    			name?: string
    			externalProcessGroupId?: string
    			tenantId?: string
    			subtenantIds?: string[]
    			permissions?:
    				| 'READ_PROMOTION'
    				| 'WRITE_PROMOTION'
    				| 'MANAGE_PROMOTION_TARGETS'
    				| 'MANAGE_PROMOTION_UTM_TAGS'
    				| 'MANAGE_PROMOTION_BUDGET_CHANNELS'
    				| 'UPDATE_PROMOTION_TIMERANGE'
    				| 'UPDATE_PROMOTION_BUDGET'
    				| 'UPDATE_PROMOTION_TARGET'
    				| 'UPDATE_PROMOTION_ADS'
    				| 'CREATE_PROMOTION_ADS'
    				| 'CREATE_PROMOTION_AD_FROM_SOCIAL_MEDIA_POST'
    				| 'MANAGE_PROMOTION_AD_NAME'
    				| 'MANAGE_PROMOTION_AD_CHANNELS'
    				| 'MANAGE_PROMOTION_AD_PAGE'
    				| 'MANAGE_PROMOTION_AD_MEDIA'
    				| 'MANAGE_PROMOTION_AD_LINK'
    				| 'MANAGE_PROMOTION_AD_CTA'
    				| 'PUBLISH_SOCIAL_COMMENTS'
    				| 'DELETE_SOCIAL_COMMENTS'
    				| 'MANAGE_REPORTS'
    				| 'MANAGE_PROMOTION_AD_LINK_DESCRIPTION'
    				| 'READ_POST'
    				| 'WRITE_POST'
    				| 'PUBLISH_POST'
    				| 'REMOVE_PROMOTION_ADS'
    				| 'MANAGE_PERSONAL_POSTS'
    				| 'MANAGE_PAGE_POSTS'
    				| 'MANAGE_STORIES'
    				| 'MANAGE_PROMOTION_MARGIN'
    				| 'GENERATE_POSTS'
    				| 'GENERATE_CAMPAIGNS'
    				| 'MANAGE_SUBTENANT_SETTINGS'
    				| 'MANAGE_POST_TEMPLATES'
    				| 'MANAGE_AD_TEMPLATES'
    				| 'MANAGE_TARGETING_TEMPLATES'
    				| 'IMPORT_POSTS'
    				| 'IMPORT_CAMPAIGNS'
    				| 'REVIEW_PROMOTION'
    				| 'MANAGE_TOPICS'
    				| 'TRANSLATE_POSTS'[]
    			filterable?: false | true
    		}
    		language?:
    			| 'ALL'
    			| 'DE'
    			| 'FR'
    			| 'EN'
    			| 'IT'
    			| 'ES'
    			| 'PT'
    			| 'NL'
    			| 'SV'
    			| 'RO'
    			| 'CS'
    			| 'EL'
    			| 'TR'
    			| 'PL'
    			| 'DA'
    			| 'EU'
    			| 'CY'
    			| 'CA'
    			| 'HU'
    			| 'SK'
    			| 'SL'
    			| 'SQ'
    			| 'HY'
    			| 'BS'
    			| 'BG'
    			| 'HR'
    			| 'UK'
    			| 'NO'
    			| 'FI'
    		website?: string
    		variables?: { key?: string; value?: string }[]
    		googleRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		facebookRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		linkedInRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		twitterRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		googleRetargetingLists2?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		facebookRetargetingLists2?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		linkedInRetargetingLists2?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		twitterRetargetingLists2?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		googleExcludedRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		facebookExcludedRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		linkedInExcludedRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		twitterExcludedRetargetingLists?: {
    			googleCustomerId?: string
    			facebookAccountId?: string
    			channel?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			name?: string
    			status?: 'OPEN' | 'NOT_ENOUGH_USERS' | 'CLOSED'
    			userId?: string
    			googleRetargetingListId?: string
    			facebookCustomAudienceId?: string
    			linkedInAudienceId?: string
    			twitterAudienceId?: string
    			tikTokAudienceId?: string
    			urlPath?: string
    			engagementSource?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'
    			engagementType?: 'ENGAGED' | 'FOLLOWER'
    			description?: string
    			audienceSize?: number
    			retentionDays?: number
    		}[]
    		skippablePostReview?: false | true
    		postReviewUserId?: string
    		postReviewUserIds?: string[]
    		campaignReviewUserIds?: string[]
    		postCandidateReviewMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		campaignCandidateReviewMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		secondPostReviewStepEnabled?: false | true
    		secondCampaignReviewStepEnabled?: false | true
    		secondPostReviewStepUserIds?: string[]
    		secondCampaignReviewStepUserIds?: string[]
    		postCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		campaignCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		thirdPostReviewStepEnabled?: false | true
    		thirdCampaignReviewStepEnabled?: false | true
    		thirdPostReviewStepUserIds?: string[]
    		thirdCampaignReviewStepUserIds?: string[]
    		postCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		campaignCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    		enforceManualApprovalForSelfCreatedPosts?: false | true
    		allowInstagram?: false | true
    		postTargeting?: {
    			linkedInLanguageTargeting?: false | true
    			selectedLinkedInLanguages?:
    				| 'ALL'
    				| 'DE'
    				| 'FR'
    				| 'EN'
    				| 'IT'
    				| 'ES'
    				| 'PT'
    				| 'NL'
    				| 'SV'
    				| 'RO'
    				| 'CS'
    				| 'EL'
    				| 'TR'
    				| 'PL'
    				| 'DA'
    				| 'EU'
    				| 'CY'
    				| 'CA'
    				| 'HU'
    				| 'SK'
    				| 'SL'
    				| 'SQ'
    				| 'HY'
    				| 'BS'
    				| 'BG'
    				| 'HR'
    				| 'UK'
    				| 'NO'
    				| 'FI'[]
    			linkedInRegionTargeting?: false | true
    			selectedLinkedInRegions?: { id?: string; name?: string }[]
    			facebookRegionTargeting?: false | true
    			selectedFacebookCountries?: { id?: string; name?: string }[]
    			facebookLocaleTargeting?: false | true
    			selectedFacebookLocales?: { id?: string; name?: string }[]
    		}
    		responsibleUserId?: string
    		marginPercentage?: number
    		marginPerChannel?: false | true
    		googleMarginPercentage?: number
    		facebookMarginPercentage?: number
    		linkedInMarginPercentage?: number
    		twitterMarginPercentage?: number
    		tikTokMarginPercentage?: number
    		primary?: false | true
    		postPublishingEnabled?: false | true
    		postGenerationEnabled?: false | true
    		campaignGenerationEnabled?: false | true
    		automaticPostImportEnabled?: false | true
    		automaticCampaignImportEnabled?: false | true
    		postTargetingEnabled?: false | true
    		adCommentModerationEnabled?: false | true
    		postCommentModerationEnabled?: false | true
    		adCommentDefaultAssigneeUserId?: string
    		postCommentDefaultAssigneeUserId?: string
    		mentionModerationEnabled?: false | true
    		messageModerationEnabled?: false | true
    		reviewModerationEnabled?: false | true
    		adCommentNotificationEnabled?: false | true
    		postCommentNotificationEnabled?: false | true
    		mentionNotificationEnabled?: false | true
    		messageNotificationEnabled?: false | true
    		reviewNotificationEnabled?: false | true
    		linkedInFollowerBreakdownByCountry?: false | true
    		facebookFollowerBreakdownByCountry?: false | true
    		adBeneficiary?: string
    		adPayor?: string
    		favorite?: false | true
    		socialMessageBlacklists?: {
    			id?: string
    			tenantId?: string
    			subtenantId?: string
    			name?: string
    			blacklistWords?: { text?: string }[]
    			sendNotification?: false | true
    			hideComments?: false | true
    			deleteComments?: false | true
    			notificationUserIds?: string[]
    			channels?:
    				| 'FACEBOOK'
    				| 'INSTAGRAM'
    				| 'GOOGLE_ADWORDS'
    				| 'GOOGLE_DISPLAY_NETWORK'
    				| 'GOOGLE_ANALYTICS'
    				| 'YOUTUBE'
    				| 'XING'
    				| 'LINKED_IN'
    				| 'TWITTER'
    				| 'GOOGLE_MY_BUSINESS'
    				| 'TIKTOK'
    				| 'BITLY'[]
    		}[]
    		ccModerationNotificationUserIds?: string[]
    		ccModerationNotificationScopes?:
    			| 'AD_COMMENTS'
    			| 'POST_COMMENTS'
    			| 'MENTIONS'
    			| 'DIRECT_MESSAGES'[]
    		hashtagMonitoring?: {
    			hashtags?: { name?: string; instagramId?: string }[]
    		}
    		allowAddingLinksToBio?: false | true
    		sendNotificationOnPostPublicationDefault?: false | true
    	}
    ) {
    	const url = new URL(`https://app.adhook.io/v1/subtenants`)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: `Bearer ${auth.token}`,
    			'Content-Type': 'application/json'
    		},
    		body: JSON.stringify(body)
    	})
    
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    
    	return await response.json()
    }
    

    Submitted by hugo697 519 days ago