Class: Zavudev::Resources::Broadcasts
- Inherits:
-
Object
- Object
- Zavudev::Resources::Broadcasts
- Defined in:
- lib/zavudev/resources/broadcasts.rb,
lib/zavudev/resources/broadcasts/contacts.rb,
sig/zavudev/resources/broadcasts.rbs,
sig/zavudev/resources/broadcasts/contacts.rbs
Defined Under Namespace
Classes: Contacts
Instance Attribute Summary collapse
Instance Method Summary collapse
-
#cancel(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastCancelResponse
Cancel a broadcast.
-
#create(channel:, name:, content: nil, email_html_body: nil, email_subject: nil, idempotency_key: nil, message_type: nil, metadata: nil, scheduled_at: nil, sender_id: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastCreateResponse
Create a new broadcast campaign.
-
#delete(broadcast_id, request_options: {}) ⇒ nil
Delete a broadcast in draft status.
-
#escalate_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastEscalateReviewResponse
Request manual review by the Zavu team for a rejected broadcast.
-
#initialize(client:) ⇒ Broadcasts
constructor
private
A new instance of Broadcasts.
-
#list(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Broadcast>
List broadcasts for this project.
-
#progress(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastProgress
Get real-time progress of a broadcast including delivery counts and estimated completion time.
-
#reschedule(broadcast_id, scheduled_at:, request_options: {}) ⇒ Zavudev::Models::BroadcastRescheduleResponse
Update the scheduled time for a broadcast.
-
#retrieve(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetrieveResponse
Get broadcast.
-
#retry_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetryReviewResponse
Resubmit a rejected broadcast for AI review after editing content.
-
#send_(broadcast_id, scheduled_at: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastSendResponse
Start sending the broadcast immediately or schedule for later.
-
#update(broadcast_id, content: nil, email_html_body: nil, email_subject: nil, metadata: nil, name: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastUpdateResponse
Update a broadcast in draft status.
Constructor Details
#initialize(client:) ⇒ Broadcasts
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Broadcasts.
312 313 314 315 |
# File 'lib/zavudev/resources/broadcasts.rb', line 312 def initialize(client:) @client = client @contacts = Zavudev::Resources::Broadcasts::Contacts.new(client: client) end |
Instance Attribute Details
#contacts ⇒ Zavudev::Resources::Broadcasts::Contacts (readonly)
7 8 9 |
# File 'lib/zavudev/resources/broadcasts.rb', line 7 def contacts @contacts end |
Instance Method Details
#cancel(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastCancelResponse
Cancel a broadcast. Pending contacts will be skipped, but already queued messages may still be delivered.
162 163 164 165 166 167 168 169 |
# File 'lib/zavudev/resources/broadcasts.rb', line 162 def cancel(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/cancel", broadcast_id], model: Zavudev::Models::BroadcastCancelResponse, options: params[:request_options] ) end |
#create(channel:, name:, content: nil, email_html_body: nil, email_subject: nil, idempotency_key: nil, message_type: nil, metadata: nil, scheduled_at: nil, sender_id: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastCreateResponse
Create a new broadcast campaign. Add contacts after creation, then send.
40 41 42 43 44 45 46 47 48 49 |
# File 'lib/zavudev/resources/broadcasts.rb', line 40 def create(params) parsed, = Zavudev::BroadcastCreateParams.dump_request(params) @client.request( method: :post, path: "v1/broadcasts", body: parsed, model: Zavudev::Models::BroadcastCreateResponse, options: ) end |
#delete(broadcast_id, request_options: {}) ⇒ nil
Delete a broadcast in draft status.
142 143 144 145 146 147 148 149 |
# File 'lib/zavudev/resources/broadcasts.rb', line 142 def delete(broadcast_id, params = {}) @client.request( method: :delete, path: ["v1/broadcasts/%1$s", broadcast_id], model: NilClass, options: params[:request_options] ) end |
#escalate_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastEscalateReviewResponse
Request manual review by the Zavu team for a rejected broadcast. Use this after automated review rejection if you believe the content is legitimate.
182 183 184 185 186 187 188 189 |
# File 'lib/zavudev/resources/broadcasts.rb', line 182 def escalate_review(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/escalate", broadcast_id], model: Zavudev::Models::BroadcastEscalateReviewResponse, options: params[:request_options] ) end |
#list(cursor: nil, limit: nil, status: nil, request_options: {}) ⇒ Zavudev::Internal::Cursor<Zavudev::Models::Broadcast>
List broadcasts for this project.
119 120 121 122 123 124 125 126 127 128 129 130 |
# File 'lib/zavudev/resources/broadcasts.rb', line 119 def list(params = {}) parsed, = Zavudev::BroadcastListParams.dump_request(params) query = Zavudev::Internal::Util.encode_query_params(parsed) @client.request( method: :get, path: "v1/broadcasts", query: query, page: Zavudev::Internal::Cursor, model: Zavudev::Broadcast, options: ) end |
#progress(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastProgress
Get real-time progress of a broadcast including delivery counts and estimated completion time.
202 203 204 205 206 207 208 209 |
# File 'lib/zavudev/resources/broadcasts.rb', line 202 def progress(broadcast_id, params = {}) @client.request( method: :get, path: ["v1/broadcasts/%1$s/progress", broadcast_id], model: Zavudev::BroadcastProgress, options: params[:request_options] ) end |
#reschedule(broadcast_id, scheduled_at:, request_options: {}) ⇒ Zavudev::Models::BroadcastRescheduleResponse
Update the scheduled time for a broadcast. The broadcast must be in scheduled status.
225 226 227 228 229 230 231 232 233 234 |
# File 'lib/zavudev/resources/broadcasts.rb', line 225 def reschedule(broadcast_id, params) parsed, = Zavudev::BroadcastRescheduleParams.dump_request(params) @client.request( method: :patch, path: ["v1/broadcasts/%1$s/schedule", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastRescheduleResponse, options: ) end |
#retrieve(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetrieveResponse
Get broadcast
61 62 63 64 65 66 67 68 |
# File 'lib/zavudev/resources/broadcasts.rb', line 61 def retrieve(broadcast_id, params = {}) @client.request( method: :get, path: ["v1/broadcasts/%1$s", broadcast_id], model: Zavudev::Models::BroadcastRetrieveResponse, options: params[:request_options] ) end |
#retry_review(broadcast_id, request_options: {}) ⇒ Zavudev::Models::BroadcastRetryReviewResponse
Resubmit a rejected broadcast for AI review after editing content. Maximum 3 review attempts allowed per broadcast.
247 248 249 250 251 252 253 254 |
# File 'lib/zavudev/resources/broadcasts.rb', line 247 def retry_review(broadcast_id, params = {}) @client.request( method: :post, path: ["v1/broadcasts/%1$s/retry-review", broadcast_id], model: Zavudev::Models::BroadcastRetryReviewResponse, options: params[:request_options] ) end |
#send_(broadcast_id, scheduled_at: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastSendResponse
Start sending the broadcast immediately or schedule for later.
The account must be past the unverified level to send, except on WhatsApp.
An account that has verified nothing is refused with 403 and code
kyc_required on every channel other than whatsapp. Any one of these lifts
it: identity verification (KYC), a saved payment method, a settled deposit, or a
paid plan. Business verification (KYB) is not required to broadcast; it gates
10DLC registration only. A whatsapp broadcast is exempt: it can only be built
on a template, and Meta vets the business and the content when it approves that
template, so an unapproved template is refused instead. smart is not exempt,
since it can route a contact to SMS or email. Drafts can be created, edited and
kept without any check. Every send path (dashboard, API and CLI) enforces the
same rule.
Daily ceilings apply per recipient. Each message a broadcast sends counts
against the channel's daily ceiling (see POST /v1/messages). Once the ceiling
is reached, the remaining recipients are marked failed with errorCode
DAILY_LIMIT_EXCEEDED; they are not retried the next day.
Review depends on the channel, and cannot be bypassed. A draft is submitted
to automated content review here; it does not go straight out. A WhatsApp
broadcast built on a Meta-approved template skips review (Meta already vetted
the content) and begins sending. An email broadcast sends as soon as the
automated review passes. Every other channel moves to pending_admin_review and
waits for a person. If the review rejects it, use PATCH to edit the content then
call POST /retry-review.
Calling this on a broadcast that is already approved or scheduled sends or
reschedules it directly, since it has already been reviewed. Reserves the
estimated cost from your balance.
298 299 300 301 302 303 304 305 306 307 |
# File 'lib/zavudev/resources/broadcasts.rb', line 298 def send_(broadcast_id, params = {}) parsed, = Zavudev::BroadcastSendParams.dump_request(params) @client.request( method: :post, path: ["v1/broadcasts/%1$s/send", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastSendResponse, options: ) end |
#update(broadcast_id, content: nil, email_html_body: nil, email_subject: nil, metadata: nil, name: nil, text: nil, request_options: {}) ⇒ Zavudev::Models::BroadcastUpdateResponse
Update a broadcast in draft status.
93 94 95 96 97 98 99 100 101 102 |
# File 'lib/zavudev/resources/broadcasts.rb', line 93 def update(broadcast_id, params = {}) parsed, = Zavudev::BroadcastUpdateParams.dump_request(params) @client.request( method: :patch, path: ["v1/broadcasts/%1$s", broadcast_id], body: parsed, model: Zavudev::Models::BroadcastUpdateResponse, options: ) end |