From b70c01c2430a12ad9731903bdca7f54b65f6fe9f Mon Sep 17 00:00:00 2001 From: Louis Piotti Date: Sat, 19 Sep 2026 14:48:17 -0400 Subject: [PATCH] fix(api-channel): map delivery-status messageId to the worker's messageSourceId POST /api/v1/channels/api/delivery-status accepts { messageId, status, timestamp, error } and answers 204, then enqueues the payload verbatim to the integration worker, whose messageStatus handler validates { messageSourceId, status }. Every status therefore failed with ZodError "messageSourceId: expected string, received undefined" and the hub never recorded delivered/failed for an API channel. Map the field at the enqueue site so the public contract stays unchanged. --- .../src/features/integration-api/api/public.ts | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/apps/builder/src/features/integration-api/api/public.ts b/apps/builder/src/features/integration-api/api/public.ts index 631336b55c..497af1d68d 100644 --- a/apps/builder/src/features/integration-api/api/public.ts +++ b/apps/builder/src/features/integration-api/api/public.ts @@ -150,7 +150,17 @@ export const channelsPublicRouter = { data: { integrationType: "api", integrationIdentifier: context.inbox.id, - payload: input, + // The API integration's messageStatus handler validates + // `{ messageSourceId, status }` (integrations/api/src/handlers/ + // message/outgoing-message.ts); the public contract names the + // same id `messageId`. Passing `input` through verbatim made every + // accepted (204) status die as a ZodError in the worker. + payload: { + messageSourceId: input.messageId, + status: input.status, + timestamp: input.timestamp, + error: input.error, + }, }, }) }),