Class: ElevenlabsClient::Endpoints::AgentsPlatform::PhoneNumbers

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

Instance Method Summary collapse

Constructor Details

#initialize(client) ⇒ PhoneNumbers

Returns a new instance of PhoneNumbers.



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

def initialize(client)
  @client = client
end

Instance Method Details

#delete(phone_number_id) ⇒ Hash

DELETE /v1/convai/phone-numbers/phone_number_id Delete Phone Number by ID Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/delete

Parameters:

  • phone_number_id (String)

    The id of a phone number

Returns:

  • (Hash)

    Empty response on success



79
80
81
82
# File 'lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb', line 79

def delete(phone_number_id)
  endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
  @client.delete(endpoint)
end

#get(phone_number_id) ⇒ Hash

GET /v1/convai/phone-numbers/phone_number_id Retrieve Phone Number details by ID Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/get

Parameters:

  • phone_number_id (String)

    The id of a phone number

Returns:

  • (Hash)

    Phone number details including provider info and assigned agent



51
52
53
54
# File 'lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb', line 51

def get(phone_number_id)
  endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
  @client.get(endpoint)
end

#import(phone_number:, label:, **options) ⇒ Hash

POST /v1/convai/phone-numbers Import Phone Number from provider configuration (Twilio or SIP trunk) Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/import

Parameters:

  • phone_number (String)

    The phone number to import

  • label (String)

    Label for the phone number

  • options (Hash)

    Provider-specific configuration

Options Hash (**options):

  • :sid (String)

    Twilio Account SID (for Twilio provider)

  • :token (String)

    Twilio Auth Token (for Twilio provider)

  • :provider_type (String)

    Provider type ("twilio" or "sip_trunk")

  • :inbound_trunk_config (Hash)

    Inbound trunk configuration (for SIP trunk)

  • :outbound_trunk_config (Hash)

    Outbound trunk configuration (for SIP trunk)

  • :livekit_stack (String)

    LiveKit stack configuration

Returns:

  • (Hash)

    Created phone number with phone_number_id



25
26
27
28
29
30
31
32
33
# File 'lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb', line 25

def import(phone_number:, label:, **options)
  endpoint = "/v1/convai/phone-numbers"
  request_body = {
    phone_number: phone_number,
    label: label
  }.merge(options)
  
  @client.post(endpoint, request_body)
end

#listArray<Hash>

GET /v1/convai/phone-numbers Retrieve all Phone Numbers Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/list

Returns:

  • (Array<Hash>)

    List of phone numbers with their details



40
41
42
43
# File 'lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb', line 40

def list
  endpoint = "/v1/convai/phone-numbers"
  @client.get(endpoint)
end

#update(phone_number_id, **options) ⇒ Hash

PATCH /v1/convai/phone-numbers/phone_number_id Update assigned agent of a phone number Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/update

Parameters:

  • phone_number_id (String)

    The id of a phone number

  • options (Hash)

    Update parameters

Options Hash (**options):

  • :agent_id (String)

    Agent ID to assign to the phone number

  • :inbound_trunk_config (Hash)

    Inbound trunk configuration

  • :outbound_trunk_config (Hash)

    Outbound trunk configuration

  • :livekit_stack (String)

    LiveKit stack configuration ("standard" or "static")

Returns:

  • (Hash)

    Updated phone number details



67
68
69
70
71
# File 'lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb', line 67

def update(phone_number_id, **options)
  endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
  request_body = options
  @client.patch(endpoint, request_body)
end