Conversation
The README documents both data and recipients as optional, but the
signature required them: calling with only a broadcastId crashed with a
TypeError on recipients[field], and passing {} for recipients sent an
empty recipients filter that the API rejects with a 422.
Empty or omitted data/recipients are now left out of the payload, so
triggering a broadcast with just its id sends to the broadcast's
configured recipients as documented.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 10, 2026
triggerBroadcast(1, { emails: [...] }) type-checks but sends the
selector as liquid data, triggering the broadcast's configured
recipients. Document the undefined placeholder pattern in the JSDoc and
README, and pin triggerBroadcast(1, undefined, recipients) with a test.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Author
|
Addressed the positional-ambiguity feedback in 17c6112:
254 tests passing, lint and build clean. |
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
The README documents both
dataandrecipientsas optional forapi.triggerBroadcast(), but the signature declared them as required positional arguments. Two failure modes:api.triggerBroadcast(4)—recipientsisundefined, sorecipients[field]throws a TypeErrorapi.triggerBroadcast(4, {}, {})— the emptyrecipientsobject is forwarded to the API, which rejects it with a 422 (empty recipients filter is not valid)Both params are now optional, and empty/omitted
data/recipientsare left out of the payload, so triggering a broadcast with just its id sends to the broadcast's configured recipients as documented.Test plan
{}objects for bothnpm test— 253 tests pass, coverage stays at 100%npm run lintandnpm run buildcleanFixes CDP-6131
🤖 Generated with Claude Code
Note
Medium Risk
Changes broadcast trigger request payloads and call signatures; incorrect positional args could still mis-route recipients as liquid data, but behavior now matches documented API.
Overview
Makes
dataandrecipientsoptional onAPIClient.triggerBroadcastso a broadcast can be triggered with only an ID, matching the README and Customer.io API behavior (configured recipients).Payload building now omits empty or missing
data/recipientsinstead of always sending them—fixing a TypeError whenrecipientswas undefined and 422 errors from forwarding{}as recipients. Recipient-only calls must passundefinedfordatabecause arguments are positional.README adds examples and a note about that positional caveat; new Ava tests cover ID-only, partial args, and empty objects.
Reviewed by Cursor Bugbot for commit 17c6112. Bugbot is set up for automated code reviews on this repo. Configure here.