Skip to content

STRATCONN-6833 - [Customerio] - msresponse support#3816

Open
joe-ayoub-segment wants to merge 6 commits into
mainfrom
customerio-msresponse
Open

STRATCONN-6833 - [Customerio] - msresponse support#3816
joe-ayoub-segment wants to merge 6 commits into
mainfrom
customerio-msresponse

Conversation

@joe-ayoub-segment

@joe-ayoub-segment joe-ayoub-segment commented May 27, 2026

Copy link
Copy Markdown
Contributor
  • Adds multi-status response (MSR) support to the Customer.io destination's batch endpoint, converting per-item successes and errors from the Track API into the framework's MultiStatusResponse format

    • Fixes createUpdateObject performBatch to merge two sendBatch results into a single MultiStatusResponse at correct original indices (previously returned an array of two responses via Promise.all, which the framework doesn't recognize as MSR)
    • When the Track API returns a 2xx response with per-item errors in the errors array, those error entries are reported as status 400 rather than the envelope's 2xx status
    • All HTTP errors caught in sendBatch are converted to per-item error entries in the MultiStatusResponse (using the HTTP status code from the error, or 500 for non-HTTP errors)

    New unit tests

    utils.test.ts — sendBatch describe block (all new):

    • should parse 207 multi-status Track API responses
    • should parse 200 Track API responses that still contain batch errors
    • should return all-success responses when the Track API reports an empty errors array
    • should convert HTTP errors into per-item MultiStatusResponse entries
    • should convert 429 HTTP errors into per-item MultiStatusResponse entries
    • should convert 500 HTTP errors into per-item MultiStatusResponse entries
    • should convert 401 auth errors into per-item MultiStatusResponse entries
    • should handle non-HTTP errors with status 500

    utils.test.ts — parseResponse describe block (all new):

    • should create error entries for items referenced by batch errors
    • should use reason as fallback when message is missing
    • should treat missing errors array as all-success
    • should treat an empty errors array as all-success
    • should skip errors without batch_index

    utils.test.ts — convertValidTimestamp (new cases added to existing test):

    • should leave integer unix timestamps unchanged
    • should convert ISO date strings to unix timestamps
    • should return non-string values unchanged
    • should return invalid date strings unchanged

    createUpdateObject.test.ts — performBatch describe block (all new):

    • should return a merged MultiStatusResponse with items at original indices
    • should report per-item errors at the correct original indices

    Manual testing - completed by Customer.io team

image
  • Send a batch of events to the createUpdateObject action with a mix of identified (userId) and anonymous (anonymousId) payloads.
    Verify that when the Track API returns partial errors, the correct items are marked as failed and the successful items at their original positions are reported as successes.
  • Send a batch to any other action (e.g. trackEvent, createUpdatePerson) where the Track API returns a 200 with a non-empty errors array. Confirm those errored items come back as status 400 in the MSR, not 200.
  • Trigger a rate limit (429) or server error (500) from the Track API on a batch call. Confirm all items in the batch are reported as errors with the correct status code.
  • Trigger a 401 (invalid credentials). Confirm all items are reported as UNAUTHORIZED errors.

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 May 27, 2026 12:55

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 Customer.io Track API batch multi-status response support so batch-level responses can be converted into per-item success/error results for the Actions framework.

Changes:

  • Updates sendBatch to await Customer.io batch responses and return MultiStatusResponse.
  • Adds Customer.io batch response/error types and a parseResponse helper.
  • Adds unit coverage for batch MSR parsing/error handling and additional timestamp conversion cases.

Reviewed changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 2 comments.

File Description
packages/destination-actions/src/destinations/customerio/utils.ts Implements MSR parsing and error conversion for Customer.io batch requests.
packages/destination-actions/src/destinations/customerio/types.ts Adds Track API batch response/error type definitions.
packages/destination-actions/src/destinations/customerio/__tests__/utils.test.ts Adds tests for MSR behavior and timestamp conversion edge cases.

Comment thread packages/destination-actions/src/destinations/customerio/utils.ts
Comment thread packages/destination-actions/src/destinations/customerio/utils.ts
Copilot AI review requested due to automatic review settings May 27, 2026 13:09

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 3 out of 3 changed files in this pull request and generated 1 comment.

Comment thread packages/destination-actions/src/destinations/customerio/utils.ts
Copilot AI review requested due to automatic review settings May 27, 2026 13:45
@joe-ayoub-segment joe-ayoub-segment self-assigned this May 27, 2026
@joe-ayoub-segment joe-ayoub-segment added partner-eng-review (cloud) needs-stage-test Must be tested in Stage before deployment labels May 27, 2026
@joe-ayoub-segment joe-ayoub-segment marked this pull request as ready for review May 27, 2026 13:52
@joe-ayoub-segment joe-ayoub-segment requested a review from a team as a code owner May 27, 2026 13:52

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 5 out of 5 changed files in this pull request and generated 2 comments.

Comment thread packages/destination-actions/src/destinations/customerio/utils.ts
Comment thread packages/destination-actions/src/destinations/customerio/utils.ts
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants