Skip to content

fix(api-channel): map delivery-status messageId to the worker's messageSourceId - #1249

Open
Uncle-Lou-AfterShockFam wants to merge 1 commit into
ChatbotXIO:mainfrom
Uncle-Lou-AfterShockFam:fix/api-channel-delivery-status-payload
Open

Uncle-Lou-AfterShockFam wants to merge 1 commit into
ChatbotXIO:mainfrom
Uncle-Lou-AfterShockFam:fix/api-channel-delivery-status-payload

Conversation

@Uncle-Lou-AfterShockFam

Copy link
Copy Markdown

Summary

POST /api/v1/channels/api/delivery-status accepts { messageId, status, timestamp, error } and answers 204, then enqueues the payload verbatim to the integration worker. The worker's messageStatus handler validates { messageSourceId, status } (integrations/api/src/handlers/message/outgoing-message.ts), so every accepted status died in the worker with ZodError: messageSourceId: expected string, received undefined and the hub never recorded delivered/failed for an API channel.

This maps the field at the enqueue site so the public contract stays unchanged.

How it was found

A self-hosted instance driving an external SMS line through an API channel: the public endpoint returned 204 for every delivered / failed report, the worker log showed the ZodError for each, and Message rows never left sent. With the patch applied to the builder image the statuses land.

Test plan

  • Reproduced on a self-hosted compose stack pinned at 1b71fc4: 204 + worker ZodError before, status recorded after.
  • Maintainers: the existing apps/builder/__tests__ suite for the integration-api router covers the 204 path; a worker-side assertion on the enqueued payload shape would pin this.

🤖 Generated with Claude Code

…geSourceId

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

Labels

bug Something isn't working as expected

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant