Class: Revox::Resources::Campaigns

Inherits:
Object
  • Object
show all
Defined in:
lib/revox/resources/campaigns.rb,
sig/revox/resources/campaigns.rbs

Instance Method Summary collapse

Constructor Details

#initialize(client:) ⇒ Campaigns

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 Campaigns.

Parameters:



306
307
308
# File 'lib/revox/resources/campaigns.rb', line 306

def initialize(client:)
  @client = client
end

Instance Method Details

#cancel(id, request_options: {}) ⇒ Revox::Models::CampaignCancelResponse

Cancel a running or scheduled campaign. Pending and queued calls will be aborted, while in-progress calls will be allowed to finish. Unlike deletion, the campaign and its rows are preserved for historical reference.

Parameters:

Returns:

See Also:



152
153
154
155
156
157
158
159
# File 'lib/revox/resources/campaigns.rb', line 152

def cancel(id, params = {})
  @client.request(
    method: :post,
    path: ["campaigns/%1$s/cancel", id],
    model: Revox::Models::CampaignCancelResponse,
    options: params[:request_options]
  )
end

#create(assistant_id:, contacts:, name:, call_retry_config: nil, from_phone_number: nil, max_concurrent_calls: nil, request_options: {}) ⇒ Revox::Models::CampaignCreateResponse

Some parameter documentations has been truncated, see Models::CampaignCreateParams for more details.

Create a new outbound calling campaign. Every contact is materialized as a call in the not_launched status — nothing is dialed. Use POST /campaigns/:id/launch-calls to send them.

Parameters:

  • assistant_id (String)

    The ID of the assistant to use

  • contacts (Array<Revox::Models::CampaignCreateParams::Contact>)

    The list of contacts to call

  • name (String)

    The name of the campaign

  • call_retry_config (Revox::Models::CampaignCreateParams::CallRetryConfig)

    Override retry configuration for calls in this campaign. If not provided, uses t

  • from_phone_number (String)

    The phone number to use for outbound calls (E.164 format, e.g., +1234567890)

  • max_concurrent_calls (Float)

    Maximum number of concurrent calls allowed for this campaign

  • request_options (Revox::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



32
33
34
35
36
37
38
39
40
41
# File 'lib/revox/resources/campaigns.rb', line 32

def create(params)
  parsed, options = Revox::CampaignCreateParams.dump_request(params)
  @client.request(
    method: :post,
    path: "campaigns",
    body: parsed,
    model: Revox::Models::CampaignCreateResponse,
    options: options
  )
end

#delete(id, request_options: {}) ⇒ Revox::Models::CampaignDeleteResponse

Permanently delete a campaign and all its associated rows. This action is irreversible. In-progress calls will not be affected, but no new calls will be placed.

Parameters:

Returns:

See Also:



131
132
133
134
135
136
137
138
# File 'lib/revox/resources/campaigns.rb', line 131

def delete(id, params = {})
  @client.request(
    method: :delete,
    path: ["campaigns/%1$s", id],
    model: Revox::Models::CampaignDeleteResponse,
    options: params[:request_options]
  )
end

#export_rows(id, request_options: {}) ⇒ Revox::Models::CampaignExportRowsResponse

Export all rows of a campaign as a CSV file for offline analysis or reporting.

Parameters:

Returns:

See Also:



171
172
173
174
175
176
177
178
# File 'lib/revox/resources/campaigns.rb', line 171

def export_rows(id, params = {})
  @client.request(
    method: :get,
    path: ["campaigns/%1$s/export", id],
    model: Revox::Models::CampaignExportRowsResponse,
    options: params[:request_options]
  )
end

#get_rows(id, request_options: {}) ⇒ Revox::Models::CampaignGetRowsResponse

Retrieve all contact rows for a campaign.

Parameters:

Returns:

See Also:



190
191
192
193
194
195
196
197
# File 'lib/revox/resources/campaigns.rb', line 190

def get_rows(id, params = {})
  @client.request(
    method: :get,
    path: ["campaigns/%1$s/rows", id],
    model: Revox::Models::CampaignGetRowsResponse,
    options: params[:request_options]
  )
end

#launch(id, mode:, selection:, scheduled_at: nil, request_options: {}) ⇒ Revox::Models::CampaignLaunchResponse

Some parameter documentations has been truncated, see Models::CampaignLaunchParams for more details.

Send the campaign's calls matching a selection. In ai_first mode each call is handed to the admission scheduler at the requested time and follows the retry configuration from there. In speed_dial mode a live operator session dials them, and any call waiting on an AI retry is un-scheduled first so the same contact is never dialed twice. Calls the AI is already dialing are skipped, as are calls whose attempt budget is spent.

Parameters:

Returns:

See Also:



224
225
226
227
228
229
230
231
232
233
# File 'lib/revox/resources/campaigns.rb', line 224

def launch(id, params)
  parsed, options = Revox::CampaignLaunchParams.dump_request(params)
  @client.request(
    method: :post,
    path: ["campaigns/%1$s/launch-calls", id],
    body: parsed,
    model: Revox::Models::CampaignLaunchResponse,
    options: options
  )
end

#list(request_options: {}) ⇒ Revox::Models::CampaignListResponse

Retrieve all campaigns for your organization, including both active and completed ones.

Parameters:

Returns:

See Also:



110
111
112
113
114
115
116
117
# File 'lib/revox/resources/campaigns.rb', line 110

def list(params = {})
  @client.request(
    method: :get,
    path: "campaigns",
    model: Revox::Models::CampaignListResponse,
    options: params[:request_options]
  )
end

#pause(id, request_options: {}) ⇒ Revox::Models::CampaignPauseResponse

Pause a running campaign so no further calls are placed. In-progress calls are allowed to finish; pending and scheduled calls are held until the campaign is resumed. Scheduled retry timers keep counting down, so a call resumed before its time fires on schedule, while one resumed after its time fires at the next available calling window.

Parameters:

Returns:

See Also:



249
250
251
252
253
254
255
256
# File 'lib/revox/resources/campaigns.rb', line 249

def pause(id, params = {})
  @client.request(
    method: :post,
    path: ["campaigns/%1$s/pause", id],
    model: Revox::Models::CampaignPauseResponse,
    options: params[:request_options]
  )
end

#resume(id, request_options: {}) ⇒ Revox::Models::CampaignResumeResponse

Resume a paused campaign. Held calls continue from where they left off; calls whose scheduled time passed during the pause are placed at the next available calling window.

Parameters:

Returns:

See Also:



270
271
272
273
274
275
276
277
# File 'lib/revox/resources/campaigns.rb', line 270

def resume(id, params = {})
  @client.request(
    method: :post,
    path: ["campaigns/%1$s/resume", id],
    model: Revox::Models::CampaignResumeResponse,
    options: params[:request_options]
  )
end

#retrieve(id, request_options: {}) ⇒ Revox::Models::CampaignRetrieveResponse

Retrieve the full details of a single campaign by its unique ID. Can be used to poll for campaign completion.

Parameters:

Returns:

See Also:



54
55
56
57
58
59
60
61
# File 'lib/revox/resources/campaigns.rb', line 54

def retrieve(id, params = {})
  @client.request(
    method: :get,
    path: ["campaigns/%1$s", id],
    model: Revox::Models::CampaignRetrieveResponse,
    options: params[:request_options]
  )
end

#statistics(id, request_options: {}) ⇒ Revox::Models::CampaignStatisticsResponse

Retrieve the "Statistiques" report for a campaign: the four-tile cascade funnel (appelés → eus en ligne → réels échanges → leads chauds), two secondary tiles, the distribution of exchanges by outcome, the list of hot leads, and data-extraction coverage. All counts are over distinct E.164-normalized phone numbers, and the outcome-based categories derive exclusively from calls.outcome. Cascade percentages are null when their denominator is zero.

Parameters:

Returns:

See Also:



294
295
296
297
298
299
300
301
# File 'lib/revox/resources/campaigns.rb', line 294

def statistics(id, params = {})
  @client.request(
    method: :get,
    path: ["campaigns/%1$s/statistics", id],
    model: Revox::Models::CampaignStatisticsResponse,
    options: params[:request_options]
  )
end

#update(id, call_retry_config: nil, from_phone_number: nil, max_concurrent_calls: nil, name: nil, request_options: {}) ⇒ Revox::Models::CampaignUpdateResponse

Some parameter documentations has been truncated, see Models::CampaignUpdateParams for more details.

Update a campaign's name, outbound number, retry configuration (calling hours, retry delay, max attempts) and concurrency cap. Changes are applied to the campaign's calls that have not completed yet. The assistant is fixed at creation; add contacts with POST /campaigns/:id/rows, and choose when calls go out with POST /campaigns/:id/launch-calls.

Parameters:

  • id (String)
  • call_retry_config (Revox::Models::CampaignUpdateParams::CallRetryConfig, nil)

    Configuration for call retry behavior including time windows, delays, and max it

  • from_phone_number (String, nil)

    The phone number to use for outbound calls. Editable after launch; applied to th

  • max_concurrent_calls (Float, nil)

    Maximum concurrent calls. Editable after launch.

  • name (String)

    Campaign display name

  • request_options (Revox::RequestOptions, Hash{Symbol=>Object}, nil)

Returns:

See Also:



89
90
91
92
93
94
95
96
97
98
# File 'lib/revox/resources/campaigns.rb', line 89

def update(id, params = {})
  parsed, options = Revox::CampaignUpdateParams.dump_request(params)
  @client.request(
    method: :patch,
    path: ["campaigns/%1$s", id],
    body: parsed,
    model: Revox::Models::CampaignUpdateResponse,
    options: options
  )
end