Class: ElevenlabsClient::Endpoints::AgentsPlatform::OutboundCalling

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ OutboundCalling

Returns a new instance of OutboundCalling.



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

def initialize(client)
  @client = client
end

Instance Method Details

#sip_trunk_call(agent_id:, agent_phone_number_id:, to_number:, **options) ⇒ Hash

POST /v1/convai/sip-trunk/outbound-call Handle an outbound call via SIP trunk Documentation: https://elevenlabs.io/docs/api-reference/convai/sip-trunk/outbound-call

Parameters:

  • agent_id (String)

    The agent ID to use for the call

  • agent_phone_number_id (String)

    The phone number ID to call from

  • to_number (String)

    The phone number to call

  • options (Hash)

    Optional parameters

Options Hash (**options):

  • :conversation_initiation_client_data (Hash)

    Additional data for conversation initiation

Returns:

  • (Hash)

    JSON response containing success status, message, conversation_id, and sip_call_id



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

def sip_trunk_call(agent_id:, agent_phone_number_id:, to_number:, **options)
  endpoint = "/v1/convai/sip-trunk/outbound-call"
  request_body = {
    agent_id: agent_id,
    agent_phone_number_id: agent_phone_number_id,
    to_number: to_number
  }.merge(options)
  
  @client.post(endpoint, request_body)
end

#twilio_call(agent_id:, agent_phone_number_id:, to_number:, **options) ⇒ Hash

POST /v1/convai/twilio/outbound-call Handle an outbound call via Twilio Documentation: https://elevenlabs.io/docs/api-reference/convai/twilio/outbound-call

Parameters:

  • agent_id (String)

    The agent ID to use for the call

  • agent_phone_number_id (String)

    The phone number ID to call from

  • to_number (String)

    The phone number to call

  • options (Hash)

    Optional parameters

Options Hash (**options):

  • :conversation_initiation_client_data (Hash)

    Additional data for conversation initiation

Returns:

  • (Hash)

    JSON response containing success status, message, conversation_id, and callSid



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

def twilio_call(agent_id:, agent_phone_number_id:, to_number:, **options)
  endpoint = "/v1/convai/twilio/outbound-call"
  request_body = {
    agent_id: agent_id,
    agent_phone_number_id: agent_phone_number_id,
    to_number: to_number
  }.merge(options)
  
  @client.post(endpoint, request_body)
end