Class: ElevenlabsClient::Endpoints::AgentsPlatform::BatchCalling

Inherits:
Object
  • Object
show all
Defined in:
lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ BatchCalling

Returns a new instance of BatchCalling.



7
8
9
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 7

def initialize(client)
  @client = client
end

Instance Method Details

#cancel(batch_id) ⇒ Hash

POST /v1/convai/batch-calling/batch_id/cancel Cancel a running batch call and set all recipients to cancelled status Documentation: https://elevenlabs.io/docs/api-reference/convai/batch-calling/cancel

Parameters:

  • batch_id (String)

    The ID of the batch call job to cancel

Returns:

  • (Hash)

    JSON response containing updated batch call information



71
72
73
74
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 71

def cancel(batch_id)
  endpoint = "/v1/convai/batch-calling/#{batch_id}/cancel"
  @client.post(endpoint, {})
end

#get(batch_id) ⇒ Hash

GET /v1/convai/batch-calling/batch_id Get detailed information about a batch call including all recipients Documentation: https://elevenlabs.io/docs/api-reference/convai/batch-calling/get

Parameters:

  • batch_id (String)

    The ID of the batch call job

Returns:

  • (Hash)

    JSON response containing detailed batch call information including recipients



60
61
62
63
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 60

def get(batch_id)
  endpoint = "/v1/convai/batch-calling/#{batch_id}"
  @client.get(endpoint)
end

#list(**options) ⇒ Hash

GET /v1/convai/batch-calling/workspace Get all batch calls for the current workspace Documentation: https://elevenlabs.io/docs/api-reference/convai/batch-calling/list

Parameters:

  • options (Hash)

    Optional parameters

Options Hash (**options):

  • :limit (Integer)

    Maximum number of results to return (default: 100)

  • :last_doc (String)

    Last document ID for pagination

Returns:

  • (Hash)

    JSON response containing batch calls list with pagination info



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 42

def list(**options)
  endpoint = "/v1/convai/batch-calling/workspace"
  query_params = options.compact

  if query_params.any?
    query_string = URI.encode_www_form(query_params)
    endpoint = "#{endpoint}?#{query_string}"
  end

  @client.get(endpoint)
end

#retry(batch_id) ⇒ Hash

POST /v1/convai/batch-calling/batch_id/retry Retry a batch call, calling failed and no-response recipients again Documentation: https://elevenlabs.io/docs/api-reference/convai/batch-calling/retry

Parameters:

  • batch_id (String)

    The ID of the batch call job to retry

Returns:

  • (Hash)

    JSON response containing updated batch call information



82
83
84
85
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 82

def retry(batch_id)
  endpoint = "/v1/convai/batch-calling/#{batch_id}/retry"
  @client.post(endpoint, {})
end

#submit(call_name:, agent_id:, agent_phone_number_id:, scheduled_time_unix:, recipients:) ⇒ Hash

POST /v1/convai/batch-calling/submit Submit a batch call request to schedule calls for multiple recipients Documentation: https://elevenlabs.io/docs/api-reference/convai/batch-calling/submit

Parameters:

  • call_name (String)

    Name for the batch call job

  • agent_id (String)

    The agent ID to use for all calls

  • agent_phone_number_id (String)

    The phone number ID to call from

  • scheduled_time_unix (Integer)

    Unix timestamp for when to schedule the calls

  • recipients (Array<Hash>)

    Array of recipient objects with phone numbers

Returns:

  • (Hash)

    JSON response containing batch call job details



21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb', line 21

def submit(call_name:, agent_id:, agent_phone_number_id:, scheduled_time_unix:, recipients:)
  endpoint = "/v1/convai/batch-calling/submit"
  request_body = {
    call_name: call_name,
    agent_id: agent_id,
    agent_phone_number_id: agent_phone_number_id,
    scheduled_time_unix: scheduled_time_unix,
    recipients: recipients
  }
  
  @client.post(endpoint, request_body)
end