[MDB] - New Marketo Private destination#3831
Open
joe-ayoub-segment wants to merge 9 commits into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
This PR adds a new cloud-mode destination, Marketo Private, including a sendForm action that mints a Marketo access token per request, submits a form via Marketo’s submitForm API, and applies structured handling for response-level vs record-level errors. It also adds tests/snapshots for the destination and action, plus a new analysis doc on audience membership centralization.
Changes:
- Introduces the
marketo-privatedestination definition with custom authentication that mints a token using customer-provided credentials. - Adds
sendFormaction (fields, request construction, Marketo error handling, and retry/auth classification) plus associated types/constants. - Adds unit tests and snapshot tests for both the destination and the action; adds an audience-membership analysis doc.
Reviewed changes
Copilot reviewed 18 out of 18 changed files in this pull request and generated 5 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/destination-actions/src/destinations/marketo-private/index.ts | Adds the Marketo Private destination definition and authentication config |
| packages/destination-actions/src/destinations/marketo-private/generated-types.ts | Generated settings types for Marketo Private |
| packages/destination-actions/src/destinations/marketo-private/constants.ts | Adds Marketo OAuth token endpoint constant |
| packages/destination-actions/src/destinations/marketo-private/types.ts | Adds token response type used by token minting |
| packages/destination-actions/src/destinations/marketo-private/functions.ts | Implements inline token minting (client_credentials) |
| packages/destination-actions/src/destinations/marketo-private/tests/index.test.ts | Tests testAuthentication success/failure paths |
| packages/destination-actions/src/destinations/marketo-private/tests/snapshot.test.ts | Destination-level snapshot test harness |
| packages/destination-actions/src/destinations/marketo-private/tests/snapshots/snapshot.test.ts.snap | Jest snapshots for destination-level snapshot tests |
| packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts | Adds sendForm action definition and field schema |
| packages/destination-actions/src/destinations/marketo-private/sendForm/generated-types.ts | Generated payload types for sendForm |
| packages/destination-actions/src/destinations/marketo-private/sendForm/constants.ts | Defines Marketo submitForm endpoint and retry/auth error code sets |
| packages/destination-actions/src/destinations/marketo-private/sendForm/types.ts | Defines request/response shapes for submitForm API |
| packages/destination-actions/src/destinations/marketo-private/sendForm/functions.ts | Builds request payload, executes submitForm call, and classifies errors |
| packages/destination-actions/src/destinations/marketo-private/sendForm/tests/index.test.ts | Unit tests for token minting + error classification behavior |
| packages/destination-actions/src/destinations/marketo-private/sendForm/tests/snapshot.test.ts | Action-level snapshot test harness |
| packages/destination-actions/src/destinations/marketo-private/sendForm/tests/snapshots/snapshot.test.ts.snap | Jest snapshots for action-level snapshot tests |
| docs/analysis-centralizing-audience-membership.md | Adds analysis doc on centralizing audience membership resolution |
Switch from scheme: 'custom' to scheme: 'oauth2' (client_credentials grant). The customer-supplied client_id/client_secret remain regular settings fields; refreshAccessToken mints the token from them and the platform caches it, re-minting reactively on a 401 instead of minting a fresh token per event. - index.ts: scheme oauth2 + refreshAccessToken + extendRequest bearer header - sendForm: drop inline per-event token mint; header comes from extendRequest - tests: pass access token via auth rather than mocking the token endpoint Mirrors the Marketo Static Lists destination, which uses oauth2 with no Segment-owned client credentials. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Comment on lines
+7
to
+10
| const destination: DestinationDefinition<Settings> = { | ||
| name: 'Marketo Private', | ||
| slug: 'actions-marketo-private', | ||
| mode: 'cloud', |
Comment on lines
+1
to
+3
| export interface RefreshTokenResponse { | ||
| access_token: string | ||
| } |
Comment on lines
+2
to
+13
| export type MarketoJSON = { | ||
| input: [ | ||
| { | ||
| leadFormFields: Record<string, string | number | boolean> | ||
| visitorData: { | ||
| email: string | ||
| } & Record<string, string | number | boolean> | ||
| cookie?: string | ||
| } | ||
| ] | ||
| formId: string | ||
| } |
Comment on lines
+46
to
+54
| try { | ||
| const json = JSON.parse(rawBody) | ||
| expect(json).toMatchSnapshot() | ||
| return | ||
| } catch (err) { | ||
| expect(rawBody).toMatchSnapshot() | ||
| } | ||
|
|
||
| expect(request.headers).toMatchSnapshot() |
Comment on lines
+77
to
+84
| try { | ||
| const json = JSON.parse(rawBody) | ||
| expect(json).toMatchSnapshot() | ||
| return | ||
| } catch (err) { | ||
| expect(rawBody).toMatchSnapshot() | ||
| } | ||
| }) |
Comment on lines
+44
to
+52
| try { | ||
| const json = JSON.parse(rawBody) | ||
| expect(json).toMatchSnapshot() | ||
| return | ||
| } catch (err) { | ||
| expect(rawBody).toMatchSnapshot() | ||
| } | ||
|
|
||
| expect(request.headers).toMatchSnapshot() |
Comment on lines
+76
to
+83
| try { | ||
| const json = JSON.parse(rawBody) | ||
| expect(json).toMatchSnapshot() | ||
| return | ||
| } catch (err) { | ||
| expect(rawBody).toMatchSnapshot() | ||
| } | ||
| }) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New private Markeo destination.
Testing
TBD
Security Review
Please ensure sensitive data is properly protected in your integration.
type: 'password'New Destination Checklist
verioning-info.tsfile. example