Repository navigation
feat: iterable audience implementation - #5230
Conversation
Implements the BatchDestination-based router transform for the new iterable_audience destination. Splits record events by action into subscribe/unsubscribe endpoint groups, batches subscribers up to 1000 per request, and selects an Iterable identifier (email or userId) per row based on the configured project type (email-based / userId-based / hybrid). Cross-field validation between projectType and identifierMappings runs at construction time and throws ConfigurationError. - config: BASE_URL routing via constructEndpoint, MAX_BATCH_SIZE, ACTION_RECORD_MAP, PROJECT_TYPES - types: Zod schemas for Account/Connection config, RecordMessage, IterableAudiencePayload and tagged-union IterableSubscriber - utils: IDENTIFIER_FIELD_CONFIG (email lowercased+trimmed, userId case-preserved with whitespace rejection), remapToIterableFields, selectIdentifierForRow (hybrid prefers userId), buildSubscribeBody, buildUnsubscribeBody with explicit channelUnsubscribe: false, validateProjectTypeMappings - routerTransform: IterableAudienceIntegration extends BatchDestination, ChunkBatchStrategy per endpoint with listId+branch captured in closure - tests: 47 cases covering identifier remap, normalize/validate, project- type-vs-mappings, batch overflow, mixed actions, datacenter routing
Implements the v1 networkHandler and AudienceListStrategy for parsing Iterable's list subscribe/unsubscribe responses into per-jobId statuses. Reuses the existing iterable destination's BaseStrategy and createBatchErrorChecker (O(1) lookup over failedUpdates.* paths) and adds audience-specific carve-outs: - GDPR-forgotten users (forgottenEmails/forgottenUserIds) -> 200 with a counter metric tagged identifierType only, never the value itself. - notFound on unsubscribe -> 200 (no-op success, user already off list); notFound on subscribe -> 400 via the shared checker. - Email matching is case-insensitive (Iterable lowercases server-side); userId matching is case-sensitive. handleError throws TransformerProxyError with every metadata entry at the same status and AuthErrorCategory: AUTH on 401. - types: IterableAudienceProxyInput, IterableAudienceRequestBody, IterableSubscriber tagged union - strategies/audience-list: AudienceListStrategy extends BaseStrategy from existing iterable/strategies/base - networkHandler: thin mixin (prepareProxy, proxy, processAxiosResponse, responseHandler -> AudienceListStrategy.handleResponse) - tests: 22 cases covering forgotten/invalid/conflict/notFound paths, case-folding semantics, mixed batches, and 401/404/429/500 error paths
…t fixtures Adds ITERABLE_AUDIENCE: true to the batched destinations map so the BatchDestination loader instantiates IterableAudienceIntegration via the new path. Without this entry the destination would silently fall back to the legacy router pipeline and the BatchDestination class would never be constructed. Adds data-driven router integration fixtures under test/integrations/destinations/iterable_audience/: - common.ts: shared destination/connection configs for email-based, userId-based, hybrid, and EU datacenter variants - maskedSecrets.ts: test-only API key - router/data.ts: 6 RouterTestData cases covering email-based and userId-based subscribe/unsubscribe batching, hybrid identifier selection (userId preferred when both columns present), EU datacenter routing, per-row missing identifier returning 400 while valid rows batch, and schema validation errors
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
🔒 Scanned for secrets using gitleaks 8.28.0
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
Note
|
| Layer / File(s) | Summary |
|---|---|
Batching framework feature enablement and formatting src/constants/batchedDestinationsMap.ts, src/features.ts, .prettierignore |
ITERABLE_AUDIENCE is added to the batching destinations map and routerTransform feature config, enabling the batching framework for this destination. Prettier formatting is excluded for the .claude/ directory. |
V0 router contracts and destination configuration src/v0/destinations/iterable_audience/config.ts, src/v0/destinations/iterable_audience/types.ts |
Destination constants export type, datacenters (US/EU), endpoint builders with datacenter translation (USDC/EUDC), action mapping (INSERT/UPDATE → subscribe, DELETE → unsubscribe), and batch sizing (1000). Account config schema requires apiKey, dataCenter, and projectType; connection config requires audienceId, identifier mappings, and optional updateExistingUsersOnly. Router input schema enforces record type with INSERT/UPDATE/DELETE actions and optional identifiers. Subscriber payload requires at least one identifier field (email or userId, supporting both for hybrid projects). |
V0 identifier normalization and request builders src/v0/destinations/iterable_audience/utils.ts |
IDENTIFIER_FIELD_CONFIG defines email normalization (trim + lowercase) with email validation, and userId normalization (case-preserved) rejecting whitespace. selectIdentifierForRow implements project-type-aware identifier selection, preferring userId in hybrid mode and throwing InstrumentationError when required identifiers are absent. buildSubscribeBody and buildUnsubscribeBody construct Iterable API payloads, with updateExistingUsersOnly conditionally included on subscribe and channelUnsubscribe always set to false on unsubscribe. |
V0 router transformation implementation src/v0/destinations/iterable_audience/routerTransform.ts |
IterableAudienceIntegration constructor precomputes connection-level JSON headers with Api-Key. transformEvent maps action to subscribe/unsubscribe, normalizes and validates identifiers via processAudienceRecord, derives subscriber from projectType, and selects the endpoint by dataCenter, returning a POST request. getBatchStrategy coerces audienceId to a number, determines action from endpoint suffix, wraps event bodies into Iterable subscribe/unsubscribe payloads, and enforces MAX_BATCH_SIZE (1000). |
V1 delivery response handling and network wiring src/v1/destinations/iterable_audience/types.ts, src/v1/destinations/iterable_audience/networkHandler.ts, src/v1/destinations/iterable_audience/strategies/audience-list.ts |
Proxy input types model the typed request body (listId, subscribers, channelUnsubscribe). networkHandler instantiates AudienceListStrategy and wires network adapters. AudienceListStrategy.handleSuccess matches subscribers against forgotten/not-found identifier sets from failedUpdates, emitting iterable_forgotten_user_violations metrics and returning success for GDPR-forgotten and unsubscribe not-found cases; other cases are checked via BatchErrorChecker for abortability. handleError normalizes error messages into per-job entries and throws TransformerProxyError with dynamic error typing. |
Unit tests for router transformation and utilities src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts, src/v0/destinations/iterable_audience/__tests__/utils.test.ts |
Tests validate email/userId normalization and validation, identifier selection across EMAIL_BASED/USERID_BASED/HYBRID types with hybrid precedence, request body builders (conditional updateExistingUsersOnly on subscribe, always channelUnsubscribe:false on unsubscribe), end-to-end router transformation for insert/update/delete actions, batching with chunking by MAX_BATCH_SIZE, subscription/unsubscribe batch separation, per-row validation errors controlled via environment variables, identifier/project-type mismatch detection, EU endpoint routing, header derivation, and email lowercasing. |
Integration test fixtures and end-to-end scenarios test/integrations/destinations/iterable_audience/common.ts, test/integrations/destinations/iterable_audience/maskedSecrets.ts, test/integrations/destinations/iterable_audience/router/data.ts |
Test helpers export destination type, email-based/userId-based/hybrid/EU connection variants with identifier mappings, endpoint URLs, request headers (Api-Key and Content-Type), and instrumentation stat tags. Six router scenarios validate batched subscribe/unsubscribe with updateExistingUsersOnly propagation, userId and email identifier handling, hybrid identifier preference (userId over email), EU datacenter routing, missing mapped identifier error handling, and schema validation failures (invalid action and event type). |
Estimated code review effort
🎯 3 (Moderate) | ⏱️ ~25 minutes
Suggested reviewers
- krishna2020
- ItsSudip
🚥 Pre-merge checks | ✅ 3 | ❌ 2
❌ Failed checks (1 warning, 1 inconclusive)
| Check name | Status | Explanation | Resolution |
|---|---|---|---|
| Docstring Coverage | Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. | Write docstrings for the functions missing them to satisfy the coverage threshold. | |
| Description check | ❓ Inconclusive | The PR description is comprehensive and well-structured. It includes a clear summary of changes, key implementation details across v0 and v1 layers, registration points, test coverage, and important implementation notes. However, it is missing the required template sections: explicit Linear task reference (Resolves INT-XXX), developer/reviewer checklists, and structured sections for dependencies and utility changes. | Ensure the PR description follows the required template by adding: (1) Linear task reference under 'What is the related Linear task?', (2) new dependencies section, (3) new utilities section, (4) developer and reviewer checklists, or confirm the template is optional for this repository. |
✅ Passed checks (3 passed)
| Check name | Status | Explanation |
|---|---|---|
| Title check | ✅ Passed | The PR title 'feat: iterable audience implementation' directly describes the main change—adding a new Iterable Audience destination integration. It is concise, specific, and clearly conveys the primary purpose of the changeset. |
| Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
| Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. |
✏️ Tip: You can configure your own custom pre-merge checks in the settings.
✨ Finishing Touches
🧪 Generate unit tests (beta)
- Create PR with unit tests
- Commit unit tests in branch
feat.iterable_audience
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.
Comment @coderabbitai help to get the list of available commands and usage tips.
Codecov Report❌ Patch coverage is
Additional details and impacted files☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Fixes CI format check (`prettier --check .`) that was failing on doc/plans/DONE-PLAN-iterable-audience-m1.md.
…dateExistingUsersOnly
There was a problem hiding this comment.
Actionable comments posted: 8
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
test/integrations/destinations/iterable_audience/maskedSecrets.ts (1)
1-4: 🛠️ Refactor suggestion | 🟠 Major | ⚡ Quick winUse the required integration-test
mocks.tsstructure for masked credentials.Please fold this helper into the destination’s
mocks.ts(or rename accordingly) to match the mandated integration folder layout.As per coding guidelines "
test/integrations/destinations/**: Structure integration test sub-folders withprocessor/,router/,dataDelivery/,network.ts, andmocks.ts".🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@test/integrations/destinations/iterable_audience/maskedSecrets.ts` around lines 1 - 4, The masked apiKey constant in maskedSecrets.ts should be moved into the destination's integration-test mocks.ts to match the required folder layout: create or update mocks.ts to export the same symbol (export const apiKey = '****-test-iterable-api-key';), remove or delete maskedSecrets.ts, and update any imports that reference maskedSecrets.ts to import { apiKey } from './mocks'; ensure the exported name remains unchanged so tests continue to consume the masked credential.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@doc/loom/knowledge/architecture.md`:
- Around line 21-34: The fenced code block in doc/loom/knowledge/architecture.md
containing the "rudder-server router" / "rudder-server proxy" diagram is missing
a fence language and triggers MD040; update the opening triple-backtick to
include a language (e.g., ```text) so the block becomes fenced as text, leaving
the contents unchanged (refer to the block that begins with "rudder-server
router" and ends after "per-jobId statusCodes returned").
In `@doc/loom/knowledge/entry-points.md`:
- Around line 105-116: The fenced code block containing the directory listing
for src/v0/destinations/iterable_audience/ and
src/v1/destinations/iterable_audience/ needs a language specified to satisfy
MD040; update the code fence around that block to include a language label
(e.g., "text") so the block becomes ```text ... ```, leaving the content
unchanged; this affects the fenced block that documents files like config.ts,
types.ts, utils.ts, routerTransform.ts, networkHandler.ts and
strategies/audience-list.ts.
In `@doc/loom/knowledge/stack.md`:
- Around line 11-13: The doc currently contradicts itself by saying "Package
manager: `bun` (NEVER npm/yarn)" while later referencing `npm test` and other
npm commands; update the document for consistency by choosing one
package-manager approach: if you standardize on bun, replace all npm/yarn
command mentions (e.g., `npm test`, `npm install`, `npm run ...`) with their bun
equivalents (`bun test`, `bun install`/`bun add`, `bun run ...`) and soften the
absolute ban wording (change "NEVER npm/yarn" to a recommendation like "prefer
bun; npm/yarn not recommended") so the guidance is consistent across the
"Package manager: `bun`" line and the occurrences around the original `npm test`
and the references at lines ~55-56.
In `@doc/plans/DONE-PLAN-iterable-audience-m1.md`:
- Around line 436-453: Update the plan to require the full destination test
folder structure instead of only router/data.ts: add a mandate that generated
tests create the processor/, router/, dataDelivery/ subfolders plus network.ts
and mocks.ts for each destination integration; ensure the
batchedDestinationsMap.ts change still includes ITERABLE_AUDIENCE: true for the
destination and keep the original guidance to add data-driven router integration
cases covering subscribe/unsubscribe (verify unsubscribe body has
channelUnsubscribe: false and subscribe body omits it).
- Around line 50-55: The plan places unit tests under __tests__/ directories
which violates the repo co-location rule; move the tests referenced (e.g.,
src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts and
utils.test.ts and
src/v1/destinations/iterable_audience/__tests__/networkHandler.test.ts) so each
*.test.ts file is adjacent to its implementation (e.g., routerTransform.test.ts
next to routerTransform.ts, utils.test.ts next to utils.ts,
networkHandler.test.ts next to networkHandler.ts), and update any references in
the plan and test manifests (lines noted around 222-224 and 359) to the new
co-located paths.
In `@src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts`:
- Line 1: The test file
src/v0/destinations/iterable_audience/__tests__/routerTransform.test.ts should
be moved to sit next to the source module as
src/v0/destinations/iterable_audience/routerTransform.test.ts to follow the
co-located *.test.ts convention; relocate the file, update any relative imports
inside the test (e.g., imports referencing routerTransform or other symbols) to
the new relative path, and remove the __tests__ directory entry if empty so the
test runner picks up the co-located test.
In `@src/v0/destinations/iterable_audience/__tests__/utils.test.ts`:
- Line 1: Test file is misplaced under __tests__; move
src/v0/destinations/iterable_audience/__tests__/utils.test.ts so it is
co-located with the source file as
src/v0/destinations/iterable_audience/utils.test.ts, update any relative imports
in the test to import from ./utils (or appropriate relative path to utils.ts),
and ensure the test filename remains utils.test.ts so the existing Jest/ts-jest
config discovers it automatically.
In `@src/v1/destinations/iterable_audience/__tests__/networkHandler.test.ts`:
- Line 1: Move the test file networkHandler.test.ts out of the __tests__ folder
and co-locate it next to the implementation (the strategy/network handler source
files) so it follows the "*.test.ts" convention; update any relative import
paths in the test to point to the local files (e.g., imports referencing the
network handler or strategy modules such as networkHandler,
IterableAudienceStrategy, or the module that uses ../../../../util/stats) and
adjust jest.mock paths if necessary so they resolve from the new location;
ensure test runner still discovers it and run tests to verify imports/mocks are
correct.
---
Outside diff comments:
In `@test/integrations/destinations/iterable_audience/maskedSecrets.ts`:
- Around line 1-4: The masked apiKey constant in maskedSecrets.ts should be
moved into the destination's integration-test mocks.ts to match the required
folder layout: create or update mocks.ts to export the same symbol (export const
apiKey = '****-test-iterable-api-key';), remove or delete maskedSecrets.ts, and
update any imports that reference maskedSecrets.ts to import { apiKey } from
'./mocks'; ensure the exported name remains unchanged so tests continue to
consume the masked credential.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: defaults
Review profile: CHILL
Plan: Pro
Run ID: 1b6e7816-81ab-46d2-890f-7372c48b91e9
📒 Files selected for processing (24)
.prettierignoredoc/loom/knowledge/architecture.mddoc/loom/knowledge/concerns.mddoc/loom/knowledge/conventions.mddoc/loom/knowledge/entry-points.mddoc/loom/knowledge/mistakes.mddoc/loom/knowledge/patterns.mddoc/loom/knowledge/stack.mddoc/plans/DONE-PLAN-iterable-audience-m1.mdsrc/constants/batchedDestinationsMap.tssrc/features.tssrc/v0/destinations/iterable_audience/__tests__/routerTransform.test.tssrc/v0/destinations/iterable_audience/__tests__/utils.test.tssrc/v0/destinations/iterable_audience/config.tssrc/v0/destinations/iterable_audience/routerTransform.tssrc/v0/destinations/iterable_audience/types.tssrc/v0/destinations/iterable_audience/utils.tssrc/v1/destinations/iterable_audience/__tests__/networkHandler.test.tssrc/v1/destinations/iterable_audience/networkHandler.tssrc/v1/destinations/iterable_audience/strategies/audience-list.tssrc/v1/destinations/iterable_audience/types.tstest/integrations/destinations/iterable_audience/common.tstest/integrations/destinations/iterable_audience/maskedSecrets.tstest/integrations/destinations/iterable_audience/router/data.ts
Add a behavior-focused README (project types, identifier selection, endpoints, error handling) and drop the internal M1 plan doc from the PR.
…entifiers directly - Hybrid projects now send both email and userId when a row has both (was userId-only); widen IterableSubscriber accordingly. - Read email/userId straight from message.identifiers (rudder-sources maps upstream); drop extractIterableIdentifiers and validateProjectTypeMappings — a mismatched identifier is now a per-row 400. - Keep identifierMappings in the connection schema as documented (unused) metadata.
Cover direct identifier extraction, the per-row 400 on project-type mismatch, and hybrid sending both identifiers.
…ither identifier - 401 no longer sets AuthErrorCategory 'AUTH' — Iterable uses Api-Key header auth, not OAuth. - handleSuccess matching now handles subscribers carrying both email and userId (forgotten/notFound match on either field).
…livery - Relocate v1 response-handler coverage from the co-located unit test into the component suite (network mocks + dataDelivery scenarios), adding dual-identifier and invalidData cases. - Update router fixtures for direct identifier reading and hybrid both-identifier output.
There was a problem hiding this comment.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (1)
src/v1/destinations/iterable_audience/strategies/audience-list.ts (1)
82-98:⚠️ Potential issue | 🟡 Minor | ⚡ Quick win
identifierTypemetric tag can be mislabeled for hybrid subscribers.
identifierTypeis derived solely from the presence ofsubscriber.email, so any hybrid subscriber (carrying bothuserId) is always tagged as'email'. When such a subscriber matchesforgottenLookupsonly on itsuserId(email not forgotten), theiterable_forgotten_user_violationsmetric recordsidentifierType: 'email', skewing GDPR-violation observability. Consider deriving the tag from the identifier that actually matched.📊 Proposed fix to label the matched identifier
- const identifierType: 'email' | 'userId' = subscriber.email ? 'email' : 'userId'; const eventForCheck = { email: subscriber.email ? subscriber.email.toLowerCase() : undefined, userId: subscriber.userId, }; // 1. GDPR-forgotten user → success + metric. if (matchesIdentifier(subscriber, forgottenLookups)) { + const emailForgotten = + !!subscriber.email && forgottenLookups.emails.has(subscriber.email.toLowerCase()); + const identifierType: 'email' | 'userId' = emailForgotten ? 'email' : 'userId'; stats.counter('iterable_forgotten_user_violations', 1, { destType: DEST_TYPE, destinationId, workspaceId, identifierType, // NEVER tag the identifier VALUE — it is GDPR-protected. }); return { statusCode: 200, metadata, error: SUCCESS }; }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/v1/destinations/iterable_audience/strategies/audience-list.ts` around lines 82 - 98, The metric tag identifierType is currently set from subscriber.email and mislabels hybrid subscribers; change it to reflect the identifier that actually matched forgottenLookups by computing the matched identifier before logging: use the same matching logic (matchesIdentifier or explicit checks against forgottenLookups using eventForCheck.email and eventForCheck.userId) to set matchedIdentifier = 'email' or 'userId' (or undefined if none) and pass that matchedIdentifier to stats.counter for iterable_forgotten_user_violations; update the return path that logs GDPR-forgotten violations to use this matchedIdentifier instead of the original identifierType.
🧹 Nitpick comments (1)
src/v0/destinations/iterable_audience/utils.ts (1)
9-11: ⚡ Quick winStale reference to a removed helper in the doc comment.
This comment refers to
remapToIterableFields, which was removed in this PR. Identifiers now flow directly throughprocessAudienceRecord, so the comment may mislead future maintainers. Consider updating it to describe the current keying source (rudder-sources resolving the mapping upstream).📝 Suggested wording tweak
-// `processAudienceRecord` consumes this map keyed by the same names returned by -// `remapToIterableFields`. Every field is `HashingType.NONE` because Iterable's -// list API does not accept hashed identifiers. +// `processAudienceRecord` consumes this map keyed by the Iterable field names +// (`email` / `userId`) that rudder-sources resolves upstream. Every field is +// `HashingType.NONE` because Iterable's list API does not accept hashed identifiers.🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@src/v0/destinations/iterable_audience/utils.ts` around lines 9 - 11, Update the doc comment above the map consumed by processAudienceRecord to remove the stale reference to remapToIterableFields and instead state that keys are the raw identifiers passed into processAudienceRecord (not hashed — HashingType.NONE) because mapping is resolved upstream by rudder-sources; keep the note that Iterable's list API does not accept hashed identifiers and clarify the current source of the keys.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Outside diff comments:
In `@src/v1/destinations/iterable_audience/strategies/audience-list.ts`:
- Around line 82-98: The metric tag identifierType is currently set from
subscriber.email and mislabels hybrid subscribers; change it to reflect the
identifier that actually matched forgottenLookups by computing the matched
identifier before logging: use the same matching logic (matchesIdentifier or
explicit checks against forgottenLookups using eventForCheck.email and
eventForCheck.userId) to set matchedIdentifier = 'email' or 'userId' (or
undefined if none) and pass that matchedIdentifier to stats.counter for
iterable_forgotten_user_violations; update the return path that logs
GDPR-forgotten violations to use this matchedIdentifier instead of the original
identifierType.
---
Nitpick comments:
In `@src/v0/destinations/iterable_audience/utils.ts`:
- Around line 9-11: Update the doc comment above the map consumed by
processAudienceRecord to remove the stale reference to remapToIterableFields and
instead state that keys are the raw identifiers passed into
processAudienceRecord (not hashed — HashingType.NONE) because mapping is
resolved upstream by rudder-sources; keep the note that Iterable's list API does
not accept hashed identifiers and clarify the current source of the keys.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: 3d541da2-7cdb-49eb-8667-81b2086fd440
⛔ Files ignored due to path filters (4)
src/v0/destinations/iterable_audience/README.mdis excluded by!**/*.mdtest/integrations/destinations/iterable_audience/dataDelivery/data.tsis excluded by!**/test/**test/integrations/destinations/iterable_audience/dataDelivery/network.tsis excluded by!**/test/**test/integrations/destinations/iterable_audience/router/data.tsis excluded by!**/test/**
📒 Files selected for processing (7)
src/v0/destinations/iterable_audience/__tests__/routerTransform.test.tssrc/v0/destinations/iterable_audience/__tests__/utils.test.tssrc/v0/destinations/iterable_audience/routerTransform.tssrc/v0/destinations/iterable_audience/types.tssrc/v0/destinations/iterable_audience/utils.tssrc/v1/destinations/iterable_audience/strategies/audience-list.tssrc/v1/destinations/iterable_audience/types.ts
🚧 Files skipped from review as they are similar to previous changes (1)
- src/v0/destinations/iterable_audience/types.ts
…d AudienceField Coerce email/userId to string in normalize and guard the validators to match the unknown-typed AudienceField from develop, restoring a clean tsc build.
c0a1298 to
3aedea1
Compare
Drop doc/loom/ knowledge base and its now-orphaned .prettierignore entry.
…ation config Add IterableDestinationConfigSchema extending the account schema with a `name` field and consume it as the BatchDestination destination-config type, matching the <Dest>DestinationConfig naming convention used by the other audience destinations. Addresses PR review feedback.
|



Summary
Adds the
iterable_audiencedestination — a VDM Next audience integration that pushes users to Iterable lists via thelists/subscribeandlists/unsubscribeAPIs. Built on the nativeBatchDestinationframework so per-event transforms are auto-grouped, chunked atIterable's 1,000-record limit, and dispatched as a single batched proxy request.
Key Changes
src/v0/destinations/iterable_audience/):IterableAudienceIntegrationextendsBatchDestination, validates project type (email-based/userId-based/hybrid) against the connection'sidentifierMappingsat construction, and selectsthe correct subscriber identifier per row. Subscribe/unsubscribe routing comes from the record action (
insert/update→ subscribe,delete→ unsubscribe).src/v1/destinations/iterable_audience/):AudienceListStrategyextends the shared IterableBaseStrategyand overrides per-subscriber error classification — GDPR-forgotten identifiers return200 + metric(never retried),notFoundonunsubscribe is a no-op success, everything else delegates to the shared abortability checker.
handleErrorsetsAuthErrorCategory: 'AUTH'on 401 so the platform can flag the destination.features.ts#supportedSourceTypesandbatchedDestinationsMap.tsso the router uses the batching framework path.getSubscribeEndpoint/getUnsubscribeEndpointdelegate to the existingiterabledestination'sconstructEndpoint, translating the UX-facingUS/EUdata-center labels into Iterable's internalUSDC/EUDCkeys.routerTransform,utils, andnetworkHandlerstrategies; integration fixtures undertest/integrations/destinations/iterable_audience/.doc/loom/knowledge/*.mddocuments architecture, conventions, patterns, mistakes, and known concerns for future work on this destination.Things to Note
Api-Keyis sent as a header, never as a query-string parameter. Iterable applies stricter rate limits to query-string auth — flagged inconventions.md.iterable_forgotten_user_violationsmetric tagsidentifierType(email/userId) only, never the value.MAX_BATCH_SIZE = 1000comes from Iterable's documented per-request maximum but has not been verified against the live API (seeconcerns.md).AuthErrorCategory: 'AUTH'signal is emitted; platform-side handling will land separately.doc/loom/knowledge/and the M1 plan underdoc/plans/are tracked deliberately so future iterations have ground truth;.prettierignoreis updated to skip them.