Skip to content

Align App API metric/message methods with backend from audit - #237

Merged
mike-engel merged 1 commit into
mainfrom
appapi-backend-alignment
Jul 13, 2026
Merged

mike-engel merged 1 commit into
mainfrom
appapi-backend-alignment

Conversation

@mike-engel

@mike-engel mike-engel commented Jul 10, 2026 •

Copy link
Copy Markdown
Collaborator

Cross-verified all App API methods against the backends after we found the published OpenAPI spec drifts from the actual handlers. This fixes the SDK params that don't match reality, and the spec will be fixed separately internally.

None of these methods shipped in v5.1.0: they're all in unreleased batches, so there's no released-user impact.

Fixes

Method Fix Backend evidence
getCampaignJourneyMetrics send resolution (not res) back end reads resolution — previously 400'd every call
getCampaignActionMetrics, getBroadcastActionMetrics drop type back end hardcodes all channels
getCampaignActionMetricsLinks, getBroadcastActionMetricsLinks type → unique back end reads unique
getBroadcastMessages, getTransactionalMessageDeliveries drop state back end never reads state
getCampaignMetrics, getCampaignActionMetrics version moved into options + made optional server defaults it; never required
downloadExport doc: returns { url } not { link }

Type changes

  • Added MetricsWindowOptions (base window) and CampaignActionMetricsOptions (campaign action metrics, no type).
  • Removed the now-unused DeliveryState.
  • getCampaignMetrics(campaignId, options) / getCampaignActionMetrics(campaignId, actionId, options) — version is now an optional field in options rather than a required positional arg.

Assisted by AI 🤖


Note

Medium Risk
Breaking signature and query-param changes across many client methods, but PR states these APIs were not yet released; fixes include a journey-metrics bug that caused 400s.

Overview
Aligns unreleased App API client methods with what the backend actually accepts, after audit against real handlers (not the drifting OpenAPI spec).

Query string fixes: getCampaignJourneyMetrics now sends resolution instead of res (previously broke every call). Campaign/broadcast action link metrics send unique instead of type. Action-level metrics no longer send type (all-channel aggregation). Transactional/broadcast message listings no longer send unsupported state.

Signatures & types: getCampaignMetrics and getCampaignActionMetrics drop the required positional version arg; version is optional inside options. Adds MetricsWindowOptions / CampaignActionMetricsOptions, removes DeliveryState. downloadExport JSDoc corrected to { url }.

Docs & tests: docs/app.md, unit tests, and live integration call sites updated to match.

Reviewed by Cursor Bugbot for commit ac5f661. Bugbot is set up for automated code reviews on this repo. Configure here.

Cross-verified all App API methods against the backends (services/edge/gaia).
Fixes SDK params that don't match the actual handlers (all in unreleased
batches 3-5; nothing shipped in 5.1.0 is affected):

- getCampaignJourneyMetrics: send `resolution` (handler reads that, not `res`)
  — previously 400'd on every call.
- getCampaignActionMetrics / getBroadcastActionMetrics: drop `type` (handler
  hardcodes channeltype.All / ignores it); action metrics are all-channel.
- getCampaignActionMetricsLinks / getBroadcastActionMetricsLinks: send `unique`
  instead of `type` (handler reads `unique`).
- getBroadcastMessages / getTransactionalMessageDeliveries: drop `state`
  (shared deliveries handler never reads it).
- getCampaignMetrics / getCampaignActionMetrics: `version` moved into options
  and made optional (server defaults it; it was never required).
- downloadExport doc: returns { url }, not { link }.

Type changes: add MetricsWindowOptions base + CampaignActionMetricsOptions;
remove the now-unused DeliveryState. resource metrics keep `type` (handler
reads it). Backend/spec corrections are handled by a separate project.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@mike-engel mike-engel changed the title Align App API metric/message methods with backend (audit) Align App API metric/message methods with backend from audit Jul 10, 2026
@mike-engel mike-engel self-assigned this Jul 10, 2026
@mike-engel
mike-engel merged commit bea5e8b into main Jul 13, 2026
11 checks passed
@mike-engel
mike-engel deleted the appapi-backend-alignment branch July 13, 2026 08:32
@mike-engel mike-engel mentioned this pull request Jul 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants