Add batch() method to CustomerIO track client#123
Merged
hownowstephen merged 2 commits intomainfrom May 7, 2026
Merged
Conversation
Wraps the v2 batch endpoint (POST /api/v2/batch) to send multiple operations (identify, event, suppress, etc.) in a single request. Useful for backfills and high-volume updates without hitting rate limits. Closes #96
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, have a team admin enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit d59db34. Configure here.
The previous approach used str.replace on base_url which silently produced the wrong URL when url_prefix was customized. Build from self.host and self.port instead, matching setup_base_url pattern.
Closed
washam-cio
approved these changes
May 7, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Summary
batch()method toCustomerIOclass wrappingPOST /api/v2/batchtype,action,identifiers, and action-specific fieldsExample
Closes #96
Test plan
test_batch_call— verifies correct URL (/api/v2/batch), method (POST), auth, content-type, and body structureCustomerIOExceptionNote
Low Risk
Low risk: adds a new client method and corresponding unit test without altering existing request flows; main risk is incorrect endpoint/URL construction for non-default ports.
Overview
Adds a new
CustomerIO.batch(operations)helper that posts a list of Track API v2 operations toPOST /api/v2/batch, with a guard that rejects empty/Noneoperation lists.Introduces
test_batch_callto assert the request method, auth header, content type, URL suffix, and payload shape, and to verify invalid inputs raiseCustomerIOException.Reviewed by Cursor Bugbot for commit 4ec6ce4. Bugbot is set up for automated code reviews on this repo. Configure here.