elevenlabs_client 0.6.0 → 0.8.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +220 -0
  3. data/README.md +181 -58
  4. data/lib/elevenlabs_client/client.rb +110 -269
  5. data/lib/elevenlabs_client/configuration.rb +119 -0
  6. data/lib/elevenlabs_client/endpoints/admin/history.rb +1 -1
  7. data/lib/elevenlabs_client/endpoints/admin/pronunciation_dictionaries.rb +103 -0
  8. data/lib/elevenlabs_client/endpoints/admin/samples.rb +30 -0
  9. data/lib/elevenlabs_client/endpoints/admin/service_account_api_keys.rb +77 -0
  10. data/lib/elevenlabs_client/endpoints/admin/service_accounts.rb +29 -0
  11. data/lib/elevenlabs_client/endpoints/admin/user.rb +12 -0
  12. data/lib/elevenlabs_client/endpoints/admin/webhooks.rb +33 -0
  13. data/lib/elevenlabs_client/endpoints/admin/workspace_groups.rb +56 -0
  14. data/lib/elevenlabs_client/endpoints/admin/workspace_invites.rb +52 -0
  15. data/lib/elevenlabs_client/endpoints/admin/workspace_members.rb +31 -0
  16. data/lib/elevenlabs_client/endpoints/admin/workspace_resources.rb +53 -0
  17. data/lib/elevenlabs_client/endpoints/admin/workspace_webhooks.rb +30 -0
  18. data/lib/elevenlabs_client/endpoints/agents_platform/agents.rb +165 -0
  19. data/lib/elevenlabs_client/endpoints/agents_platform/batch_calling.rb +89 -0
  20. data/lib/elevenlabs_client/endpoints/agents_platform/conversations.rb +121 -0
  21. data/lib/elevenlabs_client/endpoints/agents_platform/knowledge_base.rb +234 -0
  22. data/lib/elevenlabs_client/endpoints/agents_platform/llm_usage.rb +50 -0
  23. data/lib/elevenlabs_client/endpoints/agents_platform/mcp_servers.rb +139 -0
  24. data/lib/elevenlabs_client/endpoints/agents_platform/outbound_calling.rb +55 -0
  25. data/lib/elevenlabs_client/endpoints/agents_platform/phone_numbers.rb +86 -0
  26. data/lib/elevenlabs_client/endpoints/agents_platform/test_invocations.rb +44 -0
  27. data/lib/elevenlabs_client/endpoints/agents_platform/tests.rb +138 -0
  28. data/lib/elevenlabs_client/endpoints/agents_platform/tools.rb +107 -0
  29. data/lib/elevenlabs_client/endpoints/agents_platform/widgets.rb +52 -0
  30. data/lib/elevenlabs_client/endpoints/agents_platform/workspace.rb +130 -0
  31. data/lib/elevenlabs_client/errors.rb +4 -0
  32. data/lib/elevenlabs_client/http_client.rb +325 -0
  33. data/lib/elevenlabs_client/version.rb +1 -1
  34. data/lib/elevenlabs_client.rb +99 -15
  35. metadata +27 -2
@@ -0,0 +1,86 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class PhoneNumbers
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # POST /v1/convai/phone-numbers
12
+ # Import Phone Number from provider configuration (Twilio or SIP trunk)
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/import
14
+ #
15
+ # @param phone_number [String] The phone number to import
16
+ # @param label [String] Label for the phone number
17
+ # @param options [Hash] Provider-specific configuration
18
+ # @option options [String] :sid Twilio Account SID (for Twilio provider)
19
+ # @option options [String] :token Twilio Auth Token (for Twilio provider)
20
+ # @option options [String] :provider_type Provider type ("twilio" or "sip_trunk")
21
+ # @option options [Hash] :inbound_trunk_config Inbound trunk configuration (for SIP trunk)
22
+ # @option options [Hash] :outbound_trunk_config Outbound trunk configuration (for SIP trunk)
23
+ # @option options [String] :livekit_stack LiveKit stack configuration
24
+ # @return [Hash] Created phone number with phone_number_id
25
+ def import(phone_number:, label:, **options)
26
+ endpoint = "/v1/convai/phone-numbers"
27
+ request_body = {
28
+ phone_number: phone_number,
29
+ label: label
30
+ }.merge(options)
31
+
32
+ @client.post(endpoint, request_body)
33
+ end
34
+
35
+ # GET /v1/convai/phone-numbers
36
+ # Retrieve all Phone Numbers
37
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/list
38
+ #
39
+ # @return [Array<Hash>] List of phone numbers with their details
40
+ def list
41
+ endpoint = "/v1/convai/phone-numbers"
42
+ @client.get(endpoint)
43
+ end
44
+
45
+ # GET /v1/convai/phone-numbers/{phone_number_id}
46
+ # Retrieve Phone Number details by ID
47
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/get
48
+ #
49
+ # @param phone_number_id [String] The id of a phone number
50
+ # @return [Hash] Phone number details including provider info and assigned agent
51
+ def get(phone_number_id)
52
+ endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
53
+ @client.get(endpoint)
54
+ end
55
+
56
+ # PATCH /v1/convai/phone-numbers/{phone_number_id}
57
+ # Update assigned agent of a phone number
58
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/update
59
+ #
60
+ # @param phone_number_id [String] The id of a phone number
61
+ # @param options [Hash] Update parameters
62
+ # @option options [String] :agent_id Agent ID to assign to the phone number
63
+ # @option options [Hash] :inbound_trunk_config Inbound trunk configuration
64
+ # @option options [Hash] :outbound_trunk_config Outbound trunk configuration
65
+ # @option options [String] :livekit_stack LiveKit stack configuration ("standard" or "static")
66
+ # @return [Hash] Updated phone number details
67
+ def update(phone_number_id, **options)
68
+ endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
69
+ request_body = options
70
+ @client.patch(endpoint, request_body)
71
+ end
72
+
73
+ # DELETE /v1/convai/phone-numbers/{phone_number_id}
74
+ # Delete Phone Number by ID
75
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/phone-numbers/delete
76
+ #
77
+ # @param phone_number_id [String] The id of a phone number
78
+ # @return [Hash] Empty response on success
79
+ def delete(phone_number_id)
80
+ endpoint = "/v1/convai/phone-numbers/#{phone_number_id}"
81
+ @client.delete(endpoint)
82
+ end
83
+ end
84
+ end
85
+ end
86
+ end
@@ -0,0 +1,44 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class TestInvocations
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /v1/convai/test-invocations/{test_invocation_id}
12
+ # Gets a test invocation by ID
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/test-invocations/get
14
+ #
15
+ # @param test_invocation_id [String] The id of a test invocation
16
+ # @return [Hash] Test invocation details including test runs and status
17
+ def get(test_invocation_id)
18
+ endpoint = "/v1/convai/test-invocations/#{test_invocation_id}"
19
+ @client.get(endpoint)
20
+ end
21
+
22
+ # POST /v1/convai/test-invocations/{test_invocation_id}/resubmit
23
+ # Resubmits specific test runs from a test invocation
24
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/test-invocations/resubmit
25
+ #
26
+ # @param test_invocation_id [String] The id of a test invocation
27
+ # @param test_run_ids [Array<String>] List of test run IDs to resubmit
28
+ # @param agent_id [String] Agent ID to resubmit tests for
29
+ # @param options [Hash] Optional parameters
30
+ # @option options [Hash] :agent_config_override Configuration overrides to use for testing
31
+ # @return [Hash] Resubmission response
32
+ def resubmit(test_invocation_id, test_run_ids:, agent_id:, **options)
33
+ endpoint = "/v1/convai/test-invocations/#{test_invocation_id}/resubmit"
34
+ request_body = {
35
+ test_run_ids: test_run_ids,
36
+ agent_id: agent_id
37
+ }.merge(options)
38
+
39
+ @client.post(endpoint, request_body)
40
+ end
41
+ end
42
+ end
43
+ end
44
+ end
@@ -0,0 +1,138 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class Tests
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /v1/convai/agent-testing
12
+ # Lists all agent response tests with pagination support and optional search filtering
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/list
14
+ #
15
+ # @param options [Hash] Query parameters
16
+ # @option options [String] :cursor Used for fetching next page
17
+ # @option options [Integer] :page_size How many tests to return at maximum (1-100, default: 30)
18
+ # @option options [String] :search Search query to filter tests by name
19
+ # @return [Hash] List of tests with pagination info
20
+ def list(**options)
21
+ endpoint = "/v1/convai/agent-testing"
22
+ query_params = options.compact
23
+
24
+ if query_params.any?
25
+ query_string = URI.encode_www_form(query_params)
26
+ endpoint = "#{endpoint}?#{query_string}"
27
+ end
28
+
29
+ @client.get(endpoint)
30
+ end
31
+
32
+ # GET /v1/convai/agent-testing/{test_id}
33
+ # Gets an agent response test by ID
34
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/get
35
+ #
36
+ # @param test_id [String] The id of a chat response test
37
+ # @return [Hash] Complete test details including chat history and evaluation criteria
38
+ def get(test_id)
39
+ endpoint = "/v1/convai/agent-testing/#{test_id}"
40
+ @client.get(endpoint)
41
+ end
42
+
43
+ # POST /v1/convai/agent-testing/create
44
+ # Creates a new agent response test
45
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/create
46
+ #
47
+ # @param name [String] Name of the test
48
+ # @param chat_history [Array<Hash>] List of chat messages for the test
49
+ # @param success_condition [String] Prompt that evaluates whether the agent's response is successful
50
+ # @param success_examples [Array<Hash>] Non-empty list of example responses that should be considered successful
51
+ # @param failure_examples [Array<Hash>] Non-empty list of example responses that should be considered failures
52
+ # @param options [Hash] Optional parameters
53
+ # @option options [Hash] :tool_call_parameters How to evaluate the agent's tool call (if any)
54
+ # @option options [Hash] :dynamic_variables Dynamic variables to replace in the agent config during testing
55
+ # @option options [String] :type Test type ("llm" or "tool")
56
+ # @return [Hash] Created test with ID
57
+ def create(name:, chat_history:, success_condition:, success_examples:, failure_examples:, **options)
58
+ endpoint = "/v1/convai/agent-testing/create"
59
+ request_body = {
60
+ name: name,
61
+ chat_history: chat_history,
62
+ success_condition: success_condition,
63
+ success_examples: success_examples,
64
+ failure_examples: failure_examples
65
+ }.merge(options)
66
+
67
+ @client.post(endpoint, request_body)
68
+ end
69
+
70
+ # PUT /v1/convai/agent-testing/{test_id}
71
+ # Updates an agent response test by ID
72
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/update
73
+ #
74
+ # @param test_id [String] The id of a chat response test
75
+ # @param name [String] Name of the test
76
+ # @param chat_history [Array<Hash>] List of chat messages for the test
77
+ # @param success_condition [String] Prompt that evaluates whether the agent's response is successful
78
+ # @param success_examples [Array<Hash>] Non-empty list of example responses that should be considered successful
79
+ # @param failure_examples [Array<Hash>] Non-empty list of example responses that should be considered failures
80
+ # @param options [Hash] Optional parameters
81
+ # @option options [Hash] :tool_call_parameters How to evaluate the agent's tool call (if any)
82
+ # @option options [Hash] :dynamic_variables Dynamic variables to replace in the agent config during testing
83
+ # @option options [String] :type Test type ("llm" or "tool")
84
+ # @return [Hash] Updated test details
85
+ def update(test_id, name:, chat_history:, success_condition:, success_examples:, failure_examples:, **options)
86
+ endpoint = "/v1/convai/agent-testing/#{test_id}"
87
+ request_body = {
88
+ name: name,
89
+ chat_history: chat_history,
90
+ success_condition: success_condition,
91
+ success_examples: success_examples,
92
+ failure_examples: failure_examples
93
+ }.merge(options)
94
+
95
+ @client.patch(endpoint, request_body)
96
+ end
97
+
98
+ # DELETE /v1/convai/agent-testing/{test_id}
99
+ # Deletes an agent response test by ID
100
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/delete
101
+ #
102
+ # @param test_id [String] The id of a chat response test
103
+ # @return [Hash] Empty response on success
104
+ def delete(test_id)
105
+ endpoint = "/v1/convai/agent-testing/#{test_id}"
106
+ @client.delete(endpoint)
107
+ end
108
+
109
+ # POST /v1/convai/agent-testing/summaries
110
+ # Gets multiple agent response tests by their IDs
111
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/summaries
112
+ #
113
+ # @param test_ids [Array<String>] List of test IDs to fetch (no duplicates allowed)
114
+ # @return [Hash] Dictionary mapping test IDs to their summary information
115
+ def get_summaries(test_ids)
116
+ endpoint = "/v1/convai/agent-testing/summaries"
117
+ request_body = { test_ids: test_ids }
118
+ @client.post(endpoint, request_body)
119
+ end
120
+
121
+ # POST /v1/convai/agents/{agent_id}/run-tests
122
+ # Run selected tests on the agent with provided configuration
123
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agent-testing/run-tests
124
+ #
125
+ # @param agent_id [String] The id of an agent
126
+ # @param tests [Array<Hash>] List of tests to run on the agent
127
+ # @param options [Hash] Optional parameters
128
+ # @option options [Hash] :agent_config_override Configuration overrides to use for testing
129
+ # @return [Hash] Test run results with status and responses
130
+ def run_on_agent(agent_id, tests:, **options)
131
+ endpoint = "/v1/convai/agents/#{agent_id}/run-tests"
132
+ request_body = { tests: tests }.merge(options)
133
+ @client.post(endpoint, request_body)
134
+ end
135
+ end
136
+ end
137
+ end
138
+ end
@@ -0,0 +1,107 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class Tools
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /v1/convai/tools
12
+ # Get all available tools in the workspace
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/list
14
+ #
15
+ # @return [Hash] List of tools with their configurations and metadata
16
+ def list
17
+ endpoint = "/v1/convai/tools"
18
+ @client.get(endpoint)
19
+ end
20
+
21
+ # GET /v1/convai/tools/{tool_id}
22
+ # Get tool that is available in the workspace
23
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/get
24
+ #
25
+ # @param tool_id [String] ID of the requested tool
26
+ # @return [Hash] Tool configuration and metadata
27
+ def get(tool_id)
28
+ endpoint = "/v1/convai/tools/#{tool_id}"
29
+ @client.get(endpoint)
30
+ end
31
+
32
+ # POST /v1/convai/tools
33
+ # Add a new tool to the available tools in the workspace
34
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/create
35
+ #
36
+ # @param tool_config [Hash] Configuration for the tool
37
+ # @option tool_config [String] :name Required name of the tool
38
+ # @option tool_config [String] :description Required description of the tool
39
+ # @option tool_config [Hash] :api_schema Required API schema configuration
40
+ # @option tool_config [Integer] :response_timeout_secs Optional response timeout (default: 20)
41
+ # @option tool_config [Boolean] :disable_interruptions Optional disable interruptions (default: false)
42
+ # @option tool_config [Boolean] :force_pre_tool_speech Optional force pre-tool speech (default: false)
43
+ # @option tool_config [Array<Hash>] :assignments Optional variable assignments
44
+ # @option tool_config [Hash] :dynamic_variables Optional dynamic variables
45
+ # @return [Hash] Created tool with ID and configuration
46
+ def create(tool_config:)
47
+ endpoint = "/v1/convai/tools"
48
+ request_body = { tool_config: tool_config }
49
+ @client.post(endpoint, request_body)
50
+ end
51
+
52
+ # PATCH /v1/convai/tools/{tool_id}
53
+ # Update tool that is available in the workspace
54
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/update
55
+ #
56
+ # @param tool_id [String] ID of the requested tool
57
+ # @param tool_config [Hash] Updated configuration for the tool
58
+ # @option tool_config [String] :name Optional updated name of the tool
59
+ # @option tool_config [String] :description Optional updated description of the tool
60
+ # @option tool_config [Hash] :api_schema Optional updated API schema configuration
61
+ # @option tool_config [Integer] :response_timeout_secs Optional response timeout
62
+ # @option tool_config [Boolean] :disable_interruptions Optional disable interruptions
63
+ # @option tool_config [Boolean] :force_pre_tool_speech Optional force pre-tool speech
64
+ # @option tool_config [Array<Hash>] :assignments Optional variable assignments
65
+ # @option tool_config [Hash] :dynamic_variables Optional dynamic variables
66
+ # @return [Hash] Updated tool configuration and metadata
67
+ def update(tool_id, tool_config:)
68
+ endpoint = "/v1/convai/tools/#{tool_id}"
69
+ request_body = { tool_config: tool_config }
70
+ @client.patch(endpoint, request_body)
71
+ end
72
+
73
+ # DELETE /v1/convai/tools/{tool_id}
74
+ # Delete tool from the workspace
75
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/delete
76
+ #
77
+ # @param tool_id [String] ID of the requested tool
78
+ # @return [Hash] Empty response on success
79
+ def delete(tool_id)
80
+ endpoint = "/v1/convai/tools/#{tool_id}"
81
+ @client.delete(endpoint)
82
+ end
83
+
84
+ # GET /v1/convai/tools/{tool_id}/dependent-agents
85
+ # Get a list of agents depending on this tool
86
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/tools/dependent-agents
87
+ #
88
+ # @param tool_id [String] ID of the requested tool
89
+ # @param options [Hash] Query parameters
90
+ # @option options [String] :cursor Used for fetching next page
91
+ # @option options [Integer] :page_size How many agents to return at maximum (1-100, default: 30)
92
+ # @return [Hash] List of dependent agents with pagination info
93
+ def get_dependent_agents(tool_id, **options)
94
+ endpoint = "/v1/convai/tools/#{tool_id}/dependent-agents"
95
+ query_params = options.compact
96
+
97
+ if query_params.any?
98
+ query_string = URI.encode_www_form(query_params)
99
+ endpoint = "#{endpoint}?#{query_string}"
100
+ end
101
+
102
+ @client.get(endpoint)
103
+ end
104
+ end
105
+ end
106
+ end
107
+ end
@@ -0,0 +1,52 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class Widgets
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /v1/convai/agents/{agent_id}/widget
12
+ # Retrieve the widget configuration for an agent
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/get-widget
14
+ #
15
+ # @param agent_id [String] The id of an agent
16
+ # @param options [Hash] Optional parameters
17
+ # @option options [String] :conversation_signature An expiring token that enables a websocket conversation to start
18
+ # @return [Hash] Widget configuration including styling, behavior, and text content
19
+ def get(agent_id, **options)
20
+ endpoint = "/v1/convai/agents/#{agent_id}/widget"
21
+ query_params = options.compact
22
+
23
+ if query_params.any?
24
+ query_string = URI.encode_www_form(query_params)
25
+ endpoint = "#{endpoint}?#{query_string}"
26
+ end
27
+
28
+ @client.get(endpoint)
29
+ end
30
+
31
+ # POST /v1/convai/agents/{agent_id}/avatar
32
+ # Sets the avatar for an agent displayed in the widget
33
+ # Documentation: https://elevenlabs.io/docs/api-reference/convai/agents/create-avatar
34
+ #
35
+ # @param agent_id [String] The id of an agent
36
+ # @param avatar_file_io [IO] The avatar file to upload (e.g., `File.open("avatar.png", "rb")`)
37
+ # @param filename [String] The name of the file, including extension
38
+ # @return [Hash] JSON response containing agent_id and avatar_url
39
+ def create_avatar(agent_id, avatar_file_io:, filename:)
40
+ endpoint = "/v1/convai/agents/#{agent_id}/avatar"
41
+
42
+ # Prepare multipart form data
43
+ payload = {
44
+ "avatar_file" => @client.file_part(avatar_file_io, filename)
45
+ }
46
+
47
+ @client.post_multipart(endpoint, payload)
48
+ end
49
+ end
50
+ end
51
+ end
52
+ end
@@ -0,0 +1,130 @@
1
+ # frozen_string_literal: true
2
+
3
+ module ElevenlabsClient
4
+ module Endpoints
5
+ module AgentsPlatform
6
+ class Workspace
7
+ def initialize(client)
8
+ @client = client
9
+ end
10
+
11
+ # GET /v1/convai/settings
12
+ # Retrieve Convai settings for the workspace
13
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/get-settings
14
+ #
15
+ # @return [Hash] JSON response containing workspace settings
16
+ def get_settings
17
+ @client.get("/v1/convai/settings")
18
+ end
19
+
20
+ # PATCH /v1/convai/settings
21
+ # Update Convai settings for the workspace
22
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/update-settings
23
+ #
24
+ # @param options [Hash] Settings to update
25
+ # @option options [Hash] :conversation_initiation_client_data_webhook Webhook configuration
26
+ # @option options [Hash] :webhooks Webhook settings
27
+ # @option options [Boolean] :can_use_mcp_servers Whether workspace can use MCP servers
28
+ # @option options [Integer] :rag_retention_period_days RAG retention period (<=30)
29
+ # @option options [String] :default_livekit_stack Default LiveKit stack ("standard" or "static")
30
+ # @return [Hash] JSON response containing updated settings
31
+ def update_settings(**options)
32
+ body = options.compact
33
+ @client.patch("/v1/convai/settings", body)
34
+ end
35
+
36
+ # GET /v1/convai/secrets
37
+ # Get all workspace secrets for the user
38
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/get-secrets
39
+ #
40
+ # @return [Hash] JSON response containing list of secrets
41
+ def get_secrets
42
+ @client.get("/v1/convai/secrets")
43
+ end
44
+
45
+ # POST /v1/convai/secrets
46
+ # Create a new secret for the workspace
47
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/create-secret
48
+ #
49
+ # @param name [String] Name of the secret
50
+ # @param value [String] Value of the secret
51
+ # @param type [String] Type of secret (defaults to "new")
52
+ # @return [Hash] JSON response containing created secret info
53
+ def create_secret(name:, value:, type: "new")
54
+ raise ArgumentError, "name is required" if name.nil? || name.to_s.strip.empty?
55
+ raise ArgumentError, "value is required" if value.nil? || value.to_s.strip.empty?
56
+
57
+ body = {
58
+ type: type,
59
+ name: name,
60
+ value: value
61
+ }
62
+
63
+ @client.post("/v1/convai/secrets", body)
64
+ end
65
+
66
+ # PATCH /v1/convai/secrets/:secret_id
67
+ # Update an existing secret for the workspace
68
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/update-secret
69
+ #
70
+ # @param secret_id [String] ID of the secret to update
71
+ # @param name [String] New name for the secret
72
+ # @param value [String] New value for the secret
73
+ # @param type [String] Type of operation (defaults to "update")
74
+ # @return [Hash] JSON response containing updated secret info
75
+ def update_secret(secret_id, name:, value:, type: "update")
76
+ raise ArgumentError, "secret_id is required" if secret_id.nil? || secret_id.to_s.strip.empty?
77
+ raise ArgumentError, "name is required" if name.nil? || name.to_s.strip.empty?
78
+ raise ArgumentError, "value is required" if value.nil? || value.to_s.strip.empty?
79
+
80
+ body = {
81
+ type: type,
82
+ name: name,
83
+ value: value
84
+ }
85
+
86
+ @client.patch("/v1/convai/secrets/#{secret_id}", body)
87
+ end
88
+
89
+ # DELETE /v1/convai/secrets/:secret_id
90
+ # Delete a workspace secret if it's not in use
91
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/delete-secret
92
+ #
93
+ # @param secret_id [String] ID of the secret to delete
94
+ # @return [Hash] JSON response with deletion confirmation
95
+ def delete_secret(secret_id)
96
+ raise ArgumentError, "secret_id is required" if secret_id.nil? || secret_id.to_s.strip.empty?
97
+
98
+ @client.delete("/v1/convai/secrets/#{secret_id}")
99
+ end
100
+
101
+ # GET /v1/convai/settings/dashboard
102
+ # Retrieve Convai dashboard settings for the workspace
103
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/get-dashboard-settings
104
+ #
105
+ # @return [Hash] JSON response containing dashboard settings
106
+ def get_dashboard_settings
107
+ @client.get("/v1/convai/settings/dashboard")
108
+ end
109
+
110
+ # PATCH /v1/convai/settings/dashboard
111
+ # Update Convai dashboard settings for the workspace
112
+ # Documentation: https://elevenlabs.io/docs/api-reference/conversational-ai/workspace/update-dashboard-settings
113
+ #
114
+ # @param charts [Array] Array of chart configurations
115
+ # @return [Hash] JSON response containing updated dashboard settings
116
+ def update_dashboard_settings(charts: nil)
117
+ body = {}
118
+ body[:charts] = charts if charts
119
+
120
+ @client.patch("/v1/convai/settings/dashboard", body)
121
+ end
122
+
123
+ # Convenience method aliases
124
+ alias_method :settings, :get_settings
125
+ alias_method :secrets, :get_secrets
126
+ alias_method :dashboard_settings, :get_dashboard_settings
127
+ end
128
+ end
129
+ end
130
+ end
@@ -9,4 +9,8 @@ module ElevenlabsClient
9
9
  class NotFoundError < Error; end
10
10
  class BadRequestError < Error; end
11
11
  class UnprocessableEntityError < Error; end
12
+ class ForbiddenError < Error; end
13
+ class ServiceUnavailableError < Error; end
14
+ class TimeoutError < Error; end
15
+ class PaymentRequiredError < Error; end
12
16
  end