Edits history of script submission #10590 for ' Update promotion settings (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,
    	id: string,
    	body: {
    		name?: string
    		tags?: {
    			id?: string
    			userId?: string
    			tenantId?: string
    			subtenantId?: string
    			text?: string
    			color?: string
    		}[]
    		topics?: { id?: string; name?: string }[]
    		color?: string
    		subtenant?: {
    			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
    			}
    			facebookPage?: {
    				pictureUrl?: string
    				name?: string
    				id?: string
    				search?: string
    			}
    			instagramAccount?: {
    				pictureUrl?: string
    				name?: string
    				id?: string
    				search?: string
    			}
    			facebookPageForInstagramAdvertising?: {
    				pictureUrl?: string
    				name?: string
    				id?: string
    				search?: string
    			}
    			hideFacebook?: false | true
    			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
    			}
    			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
    			}
    			tikTokIdentityId?: string
    			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'
    			}[]
    			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'
    			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
    			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'
    			postCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    			campaignCandidateReviewSecondStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    			secondPostReviewStepEnabled?: false | true
    			secondCampaignReviewStepEnabled?: false | true
    			secondPostReviewStepUserIds?: string[]
    			secondCampaignReviewStepUserIds?: string[]
    			postCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    			campaignCandidateReviewThirdStepMode?: 'ONE_CANDIDATE_APPROVAL' | 'ALL_CANDIDATES_APPROVAL'
    			thirdPostReviewStepEnabled?: false | true
    			thirdCampaignReviewStepEnabled?: false | true
    			thirdPostReviewStepUserIds?: string[]
    			thirdCampaignReviewStepUserIds?: string[]
    			enforceManualApprovalForSelfCreatedPosts?: false | true
    			enforceManualApprovalForSelfCreatedCampaigns?: 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
    			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'
    			marginPercentage?: number
    			marginPerChannel?: false | true
    			googleMarginPercentage?: number
    			facebookMarginPercentage?: number
    			linkedInMarginPercentage?: number
    			twitterMarginPercentage?: number
    			tikTokMarginPercentage?: number
    			primary?: false | true
    			postPublishingEnabled?: false | true
    			postGenerationEnabled?: false | true
    			automaticPostImportEnabled?: false | true
    			automaticCampaignImportEnabled?: false | true
    			campaignGenerationEnabled?: false | true
    			postTargetingEnabled?: false | true
    			adCommentModerationEnabled?: false | true
    			postCommentModerationEnabled?: false | true
    			mentionModerationEnabled?: false | true
    			messageModerationEnabled?: false | true
    			reviewModerationEnabled?: false | true
    			adCommentNotificationEnabled?: false | true
    			postCommentNotificationEnabled?: false | true
    			adCommentDefaultAssigneeUserId?: string
    			postCommentDefaultAssigneeUserId?: string
    			mentionNotificationEnabled?: false | true
    			messageNotificationEnabled?: false | true
    			reviewNotificationEnabled?: false | true
    			ccModerationNotificationUserIds?: string[]
    			ccModerationNotificationScopes?:
    				| 'AD_COMMENTS'
    				| 'POST_COMMENTS'
    				| 'MENTIONS'
    				| 'DIRECT_MESSAGES'[]
    			postPublishErrorHandling?: 'USER_NOTIFICATION' | 'SUPPORT_TICKET'
    			linkedInFollowerBreakdownByCountry?: false | true
    			facebookFollowerBreakdownByCountry?: false | true
    			adBeneficiary?: string
    			adPayor?: string
    			favorite?: false | true
    			hashtagMonitoring?: {
    				hashtags?: { name?: string; instagramId?: string }[]
    			}
    			allowAddingLinksToBio?: false | true
    			sendNotificationOnPostPublicationDefault?: false | true
    			biolinkPage?: {
    				pictureUrl?: string
    				name?: string
    				id?: string
    				search?: string
    			}
    		}
    		type?:
    			| 'TRAFFIC'
    			| 'CONVERSIONS'
    			| 'RETARGETING'
    			| 'SHOPPING'
    			| 'CARS'
    			| 'REAL_ESTATE'
    			| 'JOBS'
    			| 'EVENTS'
    			| 'APP'
    			| 'ENGAGEMENT'
    			| 'VIDEO_VIEWS'
    			| 'CALLS'
    			| 'REACH'
    			| 'FOLLOWERS'
    			| 'PROFILE_VIEWS'
    			| 'LEADS'
    			| 'PERFORMANCE_MAX'
    		customGoal?: string
    		marginPercentage?: number
    	}
    ) {
    	const url = new URL(`https://app.adhook.io/v1/promotions/${id}/settings`)
    
    	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