Skip to content

Add broadcast trigger support to APIClient#137

Merged
hownowstephen merged 3 commits into
mainfrom
MESS-678_add-broadcast-trigger
May 7, 2026
Merged

Add broadcast trigger support to APIClient#137
hownowstephen merged 3 commits into
mainfrom
MESS-678_add-broadcast-trigger

Conversation

@hownowstephen
Copy link
Copy Markdown
Contributor

@hownowstephen hownowstephen commented May 7, 2026

Summary

  • Add TriggerBroadcastRequest class and APIClient#trigger_broadcast for POST /v1/campaigns/{broadcast_id}/triggers
  • Supports all audience options: recipients, emails, ids, per_user_data, data_file_url (mutually exclusive)
  • Validates broadcast_id is present and integer, rejects multiple audience types
  • Follows existing request class pattern (SendPushRequest, etc.)

Replaces #100. Community-requested feature with multiple forks in use.

Test plan

  • CI passes on Ruby 3.3, 3.4, 4.0, head
  • Correct payload sent to /v1/campaigns/{id}/triggers
  • Each audience type works independently
  • Validation rejects missing/non-integer broadcast_id
  • Validation rejects multiple audience fields
  • 400 and 5xx errors handled correctly

Note

Low Risk
Low risk additive change: introduces a new request type and endpoint wrapper with input validation and thorough tests, without altering existing send flows.

Overview
Adds a new APIClient#trigger_broadcast method and TriggerBroadcastRequest to trigger API-triggered broadcasts via POST /v1/campaigns/{broadcast_id}/triggers.

TriggerBroadcastRequest validates broadcast_id and enforces that only one audience selector (recipients, emails, ids, per_user_data, data_file_url) is provided, while allowing optional data/flag fields. Documentation and specs are updated to cover usage, payload shapes, and error handling (400/5xx).

Reviewed by Cursor Bugbot for commit b3325c0. Bugbot is set up for automated code reviews on this repo. Configure here.

Adds TriggerBroadcastRequest and APIClient#trigger_broadcast for the
POST /v1/campaigns/{broadcast_id}/triggers endpoint. Supports all
audience options (recipients, emails, ids, per_user_data, data_file_url)
with validation that only one audience type is provided per request.

Closes #100
Copy link
Copy Markdown

@cursor cursor Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ 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 b3325c0. Configure here.

Comment thread lib/customerio/api.rb
@hownowstephen hownowstephen merged commit 481f4f4 into main May 7, 2026
9 checks passed
@hownowstephen hownowstephen deleted the MESS-678_add-broadcast-trigger branch May 7, 2026 21:09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants