Skip to content

[MDB] - New Marketo Private destination#3831

Open
joe-ayoub-segment wants to merge 9 commits into
mainfrom
mdb_marketo
Open

[MDB] - New Marketo Private destination#3831
joe-ayoub-segment wants to merge 9 commits into
mainfrom
mdb_marketo

Conversation

@joe-ayoub-segment

@joe-ayoub-segment joe-ayoub-segment commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

New private Markeo destination.

Testing

TBD

Security Review

Please ensure sensitive data is properly protected in your integration.

  • Reviewed all field definitions for sensitive data (API keys, tokens, passwords, client secrets) and confirmed they use type: 'password'

New Destination Checklist

  • Extracted all action API versions to verioning-info.ts file. example

Copilot AI review requested due to automatic review settings June 15, 2026 16:59
@joe-ayoub-segment joe-ayoub-segment requested a review from a team as a code owner June 15, 2026 16:59
@joe-ayoub-segment joe-ayoub-segment self-assigned this Jun 15, 2026

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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-private destination definition with custom authentication that mints a token using customer-provided credentials.
  • Adds sendForm action (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

Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/types.ts Outdated
Copilot AI review requested due to automatic review settings June 15, 2026 17:05

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/types.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
@joe-ayoub-segment joe-ayoub-segment changed the title Mdb marketo [MDB] - New Marketo Private destination Jun 15, 2026
@joe-ayoub-segment joe-ayoub-segment marked this pull request as draft June 15, 2026 17:10
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>
Copilot AI review requested due to automatic review settings June 17, 2026 10:21

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 5 comments.

Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/types.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
Comment thread packages/destination-actions/src/destinations/marketo-private/sendForm/index.ts Outdated
@joe-ayoub-segment joe-ayoub-segment marked this pull request as ready for review June 18, 2026 14:15
Copilot AI review requested due to automatic review settings June 18, 2026 14:15

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Copilot reviewed 17 out of 17 changed files in this pull request and generated 7 comments.

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()
}
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants