diff --git a/packages/destination-actions/src/destinations/facebook-custom-audiences/fbca-properties.ts b/packages/destination-actions/src/destinations/facebook-custom-audiences/fbca-properties.ts index 915c34f429..4e534ce181 100644 --- a/packages/destination-actions/src/destinations/facebook-custom-audiences/fbca-properties.ts +++ b/packages/destination-actions/src/destinations/facebook-custom-audiences/fbca-properties.ts @@ -1,4 +1,4 @@ -import { GlobalSetting } from '@segment/actions-core' +import { GlobalSetting, InputField } from '@segment/actions-core' export const adAccountId: GlobalSetting = { type: 'string', @@ -7,6 +7,24 @@ export const adAccountId: GlobalSetting = { required: true } +export const enable_batching: InputField = { + label: 'Enable Batching', + description: 'Enable batching of requests.', + type: 'boolean', + default: true, + unsafe_hidden: true, + required: true +} + +export const batch_size: InputField = { + label: 'Batch Size', + description: 'Maximum number of events to include in each batch. Actual batch sizes may be lower.', + type: 'number', + default: 10000, + unsafe_hidden: true, + required: true +} + // A hardcoded list of all possible schema properties that can be sent to Facebook. // If the payloads do not contain a value for one of these schema properties, then empty string will be sent export const SCHEMA_PROPERTIES = [ diff --git a/packages/destination-actions/src/destinations/facebook-custom-audiences/sync/index.ts b/packages/destination-actions/src/destinations/facebook-custom-audiences/sync/index.ts index 69c29a9675..bd4a901b9c 100644 --- a/packages/destination-actions/src/destinations/facebook-custom-audiences/sync/index.ts +++ b/packages/destination-actions/src/destinations/facebook-custom-audiences/sync/index.ts @@ -1,7 +1,8 @@ -import type { ActionDefinition } from '@segment/actions-core' +import { IntegrationError, ActionDefinition } from '@segment/actions-core' import type { Settings } from '../generated-types' import type { Payload } from './generated-types' import FacebookClient from '../fbca-operations' +import { batch_size, enable_batching } from '../fbca-properties' const action: ActionDefinition = { title: 'Sync Audience', @@ -251,7 +252,9 @@ const action: ActionDefinition = { multiple: true, label: 'Page IDs', description: 'The page IDs of the user.' - } + }, + enable_batching, + batch_size }, perform: async (request, { settings, payload, hookOutputs, syncMode }) => { const fbClient = new FacebookClient(request, settings.retlAdAccountId) @@ -263,6 +266,8 @@ const action: ActionDefinition = { deleteUsers: syncMode === 'delete' ? true : false }) } + + throw new IntegrationError('Sync mode is required for perform', 'MISSING_REQUIRED_FIELD', 400) }, performBatch: async (request, { settings, payload, hookOutputs, syncMode }) => { const fbClient = new FacebookClient(request, settings.retlAdAccountId) @@ -274,6 +279,8 @@ const action: ActionDefinition = { deleteUsers: syncMode === 'delete' ? true : false }) } + + throw new IntegrationError('Sync mode is required for performBatch', 'MISSING_REQUIRED_FIELD', 400) } }