elevenlabs-voice-agent-mcp 1.0.1 → 1.0.3
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.
- package/README.md +15 -0
- package/dist/index.js +1 -3
- package/dist/index.js.map +1 -1
- package/package.json +25 -2
- package/.claude/settings.local.json +0 -23
- package/.env.example +0 -3
- package/AGENTS.md +0 -37
- package/CLAUDE.md +0 -233
- package/call-exact-format.ts +0 -66
- package/call-wait-null.ts +0 -71
- package/create-agent-simple.ts +0 -84
- package/create-new-agent.ts +0 -98
- package/demo-agent-system-prompt.xml +0 -166
- package/elevenlabs-voice-agent-mcp-1.0.0.tgz +0 -0
- package/em_positive_leads.csv +0 -25
- package/list-resources.ts +0 -93
- package/make-call-now.ts +0 -66
- package/make-test-call.ts +0 -80
- package/openapi.json +0 -3238
- package/src/constants.ts +0 -62
- package/src/index.ts +0 -143
- package/src/schemas/agent-schemas.ts +0 -193
- package/src/schemas/batch-calling-schemas.ts +0 -96
- package/src/schemas/common-schemas.ts +0 -83
- package/src/schemas/conversation-schemas.ts +0 -44
- package/src/schemas/outbound-schemas.ts +0 -70
- package/src/schemas/phone-number-schemas.ts +0 -140
- package/src/schemas/tool-schemas.ts +0 -161
- package/src/services/elevenlabs-api.ts +0 -113
- package/src/services/formatters.ts +0 -623
- package/src/tools/agent-tools.ts +0 -425
- package/src/tools/batch-calling-tools.ts +0 -237
- package/src/tools/conversation-tools.ts +0 -167
- package/src/tools/knowledge-tools.ts +0 -73
- package/src/tools/outbound-tools.ts +0 -95
- package/src/tools/phone-number-tools.ts +0 -346
- package/src/tools/tool-tools.ts +0 -195
- package/src/tools/utility-tools.ts +0 -147
- package/src/types.ts +0 -327
- package/src/utils/error-handlers.ts +0 -98
- package/src/utils/truncation.ts +0 -97
- package/test-call-wait-for-hello.ts +0 -76
- package/test-call.json +0 -5
- package/tsconfig.json +0 -21
package/src/tools/tool-tools.ts
DELETED
|
@@ -1,195 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Agent tool management
|
|
3
|
-
*
|
|
4
|
-
* MCP tools for creating, listing, and deleting webhook tools that agents can invoke.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { getRequest, postRequest, deleteRequest } from "../services/elevenlabs-api.js";
|
|
8
|
-
import { formatResponse } from "../services/formatters.js";
|
|
9
|
-
import { ToolConfig, Agent } from "../types.js";
|
|
10
|
-
import {
|
|
11
|
-
CreateWebhookToolSchema,
|
|
12
|
-
ListToolsSchema,
|
|
13
|
-
DeleteToolSchema
|
|
14
|
-
} from "../schemas/tool-schemas.js";
|
|
15
|
-
|
|
16
|
-
/**
|
|
17
|
-
* Creates a webhook tool for an agent
|
|
18
|
-
*/
|
|
19
|
-
export const elevenlabs_create_webhook_tool = {
|
|
20
|
-
name: "elevenlabs_create_webhook_tool",
|
|
21
|
-
description: `Create a webhook tool that the agent can invoke during conversations.
|
|
22
|
-
|
|
23
|
-
This tool allows agents to interact with external APIs and services. When the agent determines it needs to use the tool, it will make an HTTP request to the specified URL with the provided parameters. The webhook response can inform the agent's next response.
|
|
24
|
-
|
|
25
|
-
Args:
|
|
26
|
-
- agent_id (string): Agent to add the tool to
|
|
27
|
-
- name (string): Unique tool name (alphanumeric, hyphens, underscores only, max 64 chars)
|
|
28
|
-
- description (string): Clear description of what the tool does (10-500 chars)
|
|
29
|
-
- url (string): Webhook URL to call when tool is invoked
|
|
30
|
-
- method (string): HTTP method (GET, POST, PUT, PATCH, DELETE, default: POST)
|
|
31
|
-
- headers (object): Optional custom headers as key-value pairs
|
|
32
|
-
- parameters (array): Array of parameter definitions with:
|
|
33
|
-
- name (string): Parameter name
|
|
34
|
-
- type (string): Data type (string, number, boolean, object, array)
|
|
35
|
-
- description (string): Parameter description
|
|
36
|
-
- required (boolean): Whether parameter is required
|
|
37
|
-
- enum (array): Optional array of allowed values
|
|
38
|
-
- response_format ('markdown' | 'json'): Output format
|
|
39
|
-
|
|
40
|
-
Returns:
|
|
41
|
-
Created tool configuration.
|
|
42
|
-
|
|
43
|
-
Examples:
|
|
44
|
-
- Use when: "Add a tool to check order status from our API"
|
|
45
|
-
- Use when: "Create a webhook tool to schedule callbacks"
|
|
46
|
-
- Use when: "Give the agent ability to search our product catalog"
|
|
47
|
-
- Don't use when: You want to add knowledge/documents (use elevenlabs_add_knowledge_base)
|
|
48
|
-
|
|
49
|
-
Error Handling:
|
|
50
|
-
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
51
|
-
- Returns "Error: Tool name already exists" if name is taken
|
|
52
|
-
- Returns "Error: Invalid URL" if webhook URL is not valid`,
|
|
53
|
-
|
|
54
|
-
zodSchema: CreateWebhookToolSchema,
|
|
55
|
-
|
|
56
|
-
annotations: {
|
|
57
|
-
readOnlyHint: false,
|
|
58
|
-
destructiveHint: false,
|
|
59
|
-
idempotentHint: false,
|
|
60
|
-
openWorldHint: true
|
|
61
|
-
},
|
|
62
|
-
|
|
63
|
-
handler: async (args: unknown) => {
|
|
64
|
-
const parsed = CreateWebhookToolSchema.parse(args);
|
|
65
|
-
|
|
66
|
-
const toolData = {
|
|
67
|
-
name: parsed.name,
|
|
68
|
-
description: parsed.description,
|
|
69
|
-
type: "webhook",
|
|
70
|
-
url: parsed.url,
|
|
71
|
-
method: parsed.method,
|
|
72
|
-
...(parsed.headers && { headers: parsed.headers }),
|
|
73
|
-
parameters: parsed.parameters
|
|
74
|
-
};
|
|
75
|
-
|
|
76
|
-
const tool = await postRequest<ToolConfig>(
|
|
77
|
-
`/convai/agents/${parsed.agent_id}/tools`,
|
|
78
|
-
toolData
|
|
79
|
-
);
|
|
80
|
-
|
|
81
|
-
return {
|
|
82
|
-
content: [
|
|
83
|
-
{
|
|
84
|
-
type: "text",
|
|
85
|
-
text: formatResponse(tool, parsed.response_format, "tool")
|
|
86
|
-
}
|
|
87
|
-
]
|
|
88
|
-
};
|
|
89
|
-
}
|
|
90
|
-
};
|
|
91
|
-
|
|
92
|
-
/**
|
|
93
|
-
* Lists all tools configured for an agent
|
|
94
|
-
*/
|
|
95
|
-
export const elevenlabs_list_tools = {
|
|
96
|
-
name: "elevenlabs_list_tools",
|
|
97
|
-
description: `List all tools configured for an agent.
|
|
98
|
-
|
|
99
|
-
This tool retrieves all webhook tools that have been added to an agent. Use this to see what external capabilities the agent currently has access to.
|
|
100
|
-
|
|
101
|
-
Args:
|
|
102
|
-
- agent_id (string): Agent identifier
|
|
103
|
-
- response_format ('markdown' | 'json'): Output format
|
|
104
|
-
|
|
105
|
-
Returns:
|
|
106
|
-
Array of tool configurations including names, descriptions, URLs, and parameters.
|
|
107
|
-
|
|
108
|
-
Examples:
|
|
109
|
-
- Use when: "Show me all tools for this agent"
|
|
110
|
-
- Use when: "What APIs can the agent access?"
|
|
111
|
-
- Use when: "List the webhook tools configured"
|
|
112
|
-
- Don't use when: You want to see agent configuration (use elevenlabs_get_agent)
|
|
113
|
-
|
|
114
|
-
Error Handling:
|
|
115
|
-
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
116
|
-
- Returns empty list if agent has no tools`,
|
|
117
|
-
|
|
118
|
-
zodSchema: ListToolsSchema,
|
|
119
|
-
|
|
120
|
-
annotations: {
|
|
121
|
-
readOnlyHint: true,
|
|
122
|
-
destructiveHint: false,
|
|
123
|
-
idempotentHint: true,
|
|
124
|
-
openWorldHint: true
|
|
125
|
-
},
|
|
126
|
-
|
|
127
|
-
handler: async (args: unknown) => {
|
|
128
|
-
const parsed = ListToolsSchema.parse(args);
|
|
129
|
-
|
|
130
|
-
// Get agent to access tools from conversation config
|
|
131
|
-
const agent = await getRequest<Agent>(`/convai/agents/${parsed.agent_id}`);
|
|
132
|
-
const tools = agent.conversation_config.agent.prompt.tools || [];
|
|
133
|
-
|
|
134
|
-
return {
|
|
135
|
-
content: [
|
|
136
|
-
{
|
|
137
|
-
type: "text",
|
|
138
|
-
text: formatResponse(tools, parsed.response_format, "tool_list")
|
|
139
|
-
}
|
|
140
|
-
]
|
|
141
|
-
};
|
|
142
|
-
}
|
|
143
|
-
};
|
|
144
|
-
|
|
145
|
-
/**
|
|
146
|
-
* Deletes a tool from an agent
|
|
147
|
-
*/
|
|
148
|
-
export const elevenlabs_delete_tool = {
|
|
149
|
-
name: "elevenlabs_delete_tool",
|
|
150
|
-
description: `Remove a webhook tool from an agent.
|
|
151
|
-
|
|
152
|
-
This tool permanently deletes a webhook tool from an agent's configuration. The agent will no longer be able to invoke this tool in conversations. This action cannot be undone.
|
|
153
|
-
|
|
154
|
-
Args:
|
|
155
|
-
- agent_id (string): Agent identifier
|
|
156
|
-
- tool_name (string): Name of the tool to delete
|
|
157
|
-
|
|
158
|
-
Returns:
|
|
159
|
-
Confirmation message indicating successful deletion.
|
|
160
|
-
|
|
161
|
-
Examples:
|
|
162
|
-
- Use when: "Remove the order_status tool from the agent"
|
|
163
|
-
- Use when: "Delete the deprecated webhook tool"
|
|
164
|
-
- Don't use when: You want to modify the tool (delete and recreate instead)
|
|
165
|
-
|
|
166
|
-
Error Handling:
|
|
167
|
-
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
168
|
-
- Returns "Error: Tool not found" if tool_name doesn't exist`,
|
|
169
|
-
|
|
170
|
-
zodSchema: DeleteToolSchema,
|
|
171
|
-
|
|
172
|
-
annotations: {
|
|
173
|
-
readOnlyHint: false,
|
|
174
|
-
destructiveHint: true,
|
|
175
|
-
idempotentHint: true,
|
|
176
|
-
openWorldHint: true
|
|
177
|
-
},
|
|
178
|
-
|
|
179
|
-
handler: async (args: unknown) => {
|
|
180
|
-
const parsed = DeleteToolSchema.parse(args);
|
|
181
|
-
|
|
182
|
-
await deleteRequest(
|
|
183
|
-
`/convai/agents/${parsed.agent_id}/tools/${parsed.tool_name}`
|
|
184
|
-
);
|
|
185
|
-
|
|
186
|
-
return {
|
|
187
|
-
content: [
|
|
188
|
-
{
|
|
189
|
-
type: "text",
|
|
190
|
-
text: `Successfully deleted tool "${parsed.tool_name}" from agent ${parsed.agent_id}`
|
|
191
|
-
}
|
|
192
|
-
]
|
|
193
|
-
};
|
|
194
|
-
}
|
|
195
|
-
};
|
|
@@ -1,147 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Utility tools
|
|
3
|
-
*
|
|
4
|
-
* MCP tools for widget generation, voice browsing, and other utilities.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { getRequest } from "../services/elevenlabs-api.js";
|
|
8
|
-
import { formatResponse, formatWidgetCode } from "../services/formatters.js";
|
|
9
|
-
import { Voice } from "../types.js";
|
|
10
|
-
import {
|
|
11
|
-
GenerateWidgetCodeSchema,
|
|
12
|
-
ListVoicesSchema
|
|
13
|
-
} from "../schemas/tool-schemas.js";
|
|
14
|
-
|
|
15
|
-
/**
|
|
16
|
-
* Generates widget embed code for testing an agent
|
|
17
|
-
*/
|
|
18
|
-
export const elevenlabs_generate_widget_code = {
|
|
19
|
-
name: "elevenlabs_generate_widget_code",
|
|
20
|
-
description: `Generate HTML embed code to test a voice agent on a webpage.
|
|
21
|
-
|
|
22
|
-
This tool creates ready-to-use HTML code that embeds a voice agent widget on any webpage. The widget appears as a floating button that users can click to start a voice conversation with the agent. Perfect for testing agents or deploying them on websites.
|
|
23
|
-
|
|
24
|
-
Args:
|
|
25
|
-
- agent_id (string): Agent to generate widget code for
|
|
26
|
-
- color (string): Optional widget color in hex format (e.g., "#FF5733")
|
|
27
|
-
- avatar_url (string): Optional avatar image URL for the widget
|
|
28
|
-
|
|
29
|
-
Returns:
|
|
30
|
-
HTML code snippet with <script> tags ready to paste into a webpage.
|
|
31
|
-
|
|
32
|
-
Examples:
|
|
33
|
-
- Use when: "Generate embed code to test this agent"
|
|
34
|
-
- Use when: "Create a widget for agent ag_abc123"
|
|
35
|
-
- Use when: "I want to add this agent to my website"
|
|
36
|
-
- Don't use when: You want to create a new agent (use elevenlabs_create_agent)
|
|
37
|
-
|
|
38
|
-
Error Handling:
|
|
39
|
-
- Returns "Error: Agent not found" if agent_id doesn't exist
|
|
40
|
-
- Returns "Error: Invalid color format" if color is not valid hex`,
|
|
41
|
-
|
|
42
|
-
zodSchema: GenerateWidgetCodeSchema,
|
|
43
|
-
|
|
44
|
-
annotations: {
|
|
45
|
-
readOnlyHint: true,
|
|
46
|
-
destructiveHint: false,
|
|
47
|
-
idempotentHint: true,
|
|
48
|
-
openWorldHint: true
|
|
49
|
-
},
|
|
50
|
-
|
|
51
|
-
handler: async (args: unknown) => {
|
|
52
|
-
const parsed = GenerateWidgetCodeSchema.parse(args);
|
|
53
|
-
|
|
54
|
-
// Verify agent exists
|
|
55
|
-
await getRequest(`/convai/agents/${parsed.agent_id}`);
|
|
56
|
-
|
|
57
|
-
const widgetCode = formatWidgetCode(
|
|
58
|
-
parsed.agent_id,
|
|
59
|
-
parsed.color,
|
|
60
|
-
parsed.avatar_url
|
|
61
|
-
);
|
|
62
|
-
|
|
63
|
-
return {
|
|
64
|
-
content: [
|
|
65
|
-
{
|
|
66
|
-
type: "text",
|
|
67
|
-
text: widgetCode
|
|
68
|
-
}
|
|
69
|
-
]
|
|
70
|
-
};
|
|
71
|
-
}
|
|
72
|
-
};
|
|
73
|
-
|
|
74
|
-
/**
|
|
75
|
-
* Lists available voices with filtering
|
|
76
|
-
*/
|
|
77
|
-
export const elevenlabs_list_voices = {
|
|
78
|
-
name: "elevenlabs_list_voices",
|
|
79
|
-
description: `Browse available ElevenLabs voices with optional filtering.
|
|
80
|
-
|
|
81
|
-
This tool retrieves voices you can use for your agents. Filter by language, gender, or age to find the perfect voice. Each voice includes a preview URL so you can listen before choosing.
|
|
82
|
-
|
|
83
|
-
Args:
|
|
84
|
-
- language (string): Optional - filter by language code (e.g., 'en', 'es', 'fr')
|
|
85
|
-
- gender ('male' | 'female'): Optional - filter by gender
|
|
86
|
-
- age ('young' | 'middle_aged' | 'old'): Optional - filter by age category
|
|
87
|
-
- limit (number): Maximum voices to return (1-100, default: 20)
|
|
88
|
-
- response_format ('markdown' | 'json'): Output format
|
|
89
|
-
|
|
90
|
-
Returns:
|
|
91
|
-
List of voices with:
|
|
92
|
-
- Voice ID (for use in agent configuration)
|
|
93
|
-
- Voice name and description
|
|
94
|
-
- Labels (gender, age, accent, use case)
|
|
95
|
-
- Preview URL to listen to the voice
|
|
96
|
-
|
|
97
|
-
Examples:
|
|
98
|
-
- Use when: "Show me all female voices"
|
|
99
|
-
- Use when: "Find voices suitable for customer service"
|
|
100
|
-
- Use when: "List English voices with British accents"
|
|
101
|
-
- Use when: "I need to choose a voice for my agent"
|
|
102
|
-
- Don't use when: You already know the voice_id you want to use
|
|
103
|
-
|
|
104
|
-
Error Handling:
|
|
105
|
-
- Returns empty list if no voices match filters
|
|
106
|
-
- Returns "Error: Invalid API key" if authentication fails`,
|
|
107
|
-
|
|
108
|
-
zodSchema: ListVoicesSchema,
|
|
109
|
-
|
|
110
|
-
annotations: {
|
|
111
|
-
readOnlyHint: true,
|
|
112
|
-
destructiveHint: false,
|
|
113
|
-
idempotentHint: true,
|
|
114
|
-
openWorldHint: true
|
|
115
|
-
},
|
|
116
|
-
|
|
117
|
-
handler: async (args: unknown) => {
|
|
118
|
-
const parsed = ListVoicesSchema.parse(args);
|
|
119
|
-
|
|
120
|
-
const params: Record<string, unknown> = {};
|
|
121
|
-
|
|
122
|
-
if (parsed.language) {
|
|
123
|
-
params.language = parsed.language;
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
if (parsed.gender) {
|
|
127
|
-
params.gender = parsed.gender;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
if (parsed.age) {
|
|
131
|
-
params.age = parsed.age;
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
const response = await getRequest<{ voices: Voice[] }>("/voices", params);
|
|
135
|
-
|
|
136
|
-
const voices = (response.voices || []).slice(0, parsed.limit);
|
|
137
|
-
|
|
138
|
-
return {
|
|
139
|
-
content: [
|
|
140
|
-
{
|
|
141
|
-
type: "text",
|
|
142
|
-
text: formatResponse(voices, parsed.response_format, "voice_list")
|
|
143
|
-
}
|
|
144
|
-
]
|
|
145
|
-
};
|
|
146
|
-
}
|
|
147
|
-
};
|
package/src/types.ts
DELETED
|
@@ -1,327 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* TypeScript type definitions for ElevenLabs Voice Agent API
|
|
3
|
-
*
|
|
4
|
-
* Defines interfaces for agents, conversations, tools, and API responses.
|
|
5
|
-
*/
|
|
6
|
-
|
|
7
|
-
import { SUPPORTED_LLMS, SUPPORTED_VOICE_MODELS, SUPPORTED_LANGUAGES, AUTH_TYPES } from "./constants.js";
|
|
8
|
-
|
|
9
|
-
// Enums
|
|
10
|
-
export enum ResponseFormat {
|
|
11
|
-
MARKDOWN = "markdown",
|
|
12
|
-
JSON = "json"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
export type LLMModel = typeof SUPPORTED_LLMS[number];
|
|
16
|
-
export type VoiceModel = typeof SUPPORTED_VOICE_MODELS[number];
|
|
17
|
-
export type Language = typeof SUPPORTED_LANGUAGES[number];
|
|
18
|
-
export type AuthType = typeof AUTH_TYPES[number];
|
|
19
|
-
|
|
20
|
-
// Agent Configuration
|
|
21
|
-
export interface AgentPromptConfig {
|
|
22
|
-
prompt: string;
|
|
23
|
-
llm: LLMModel;
|
|
24
|
-
temperature?: number;
|
|
25
|
-
max_tokens?: number;
|
|
26
|
-
tools?: ToolConfig[];
|
|
27
|
-
knowledge_base?: string[];
|
|
28
|
-
}
|
|
29
|
-
|
|
30
|
-
export interface TTSConfig {
|
|
31
|
-
voice_id: string;
|
|
32
|
-
model_id: VoiceModel;
|
|
33
|
-
optimize_streaming_latency?: number;
|
|
34
|
-
stability?: number;
|
|
35
|
-
similarity_boost?: number;
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
export interface ASRConfig {
|
|
39
|
-
quality?: "low" | "medium" | "high";
|
|
40
|
-
user_input_audio_format?: "pcm_16000" | "pcm_22050" | "pcm_44100";
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
export interface ConversationConfig {
|
|
44
|
-
agent: {
|
|
45
|
-
prompt: AgentPromptConfig;
|
|
46
|
-
first_message?: string;
|
|
47
|
-
language: Language;
|
|
48
|
-
};
|
|
49
|
-
tts: TTSConfig;
|
|
50
|
-
asr?: ASRConfig;
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export interface PlatformSettings {
|
|
54
|
-
widget?: {
|
|
55
|
-
color?: string;
|
|
56
|
-
avatar_url?: string;
|
|
57
|
-
};
|
|
58
|
-
auth?: {
|
|
59
|
-
type: AuthType;
|
|
60
|
-
open_auth_allowed?: boolean;
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
|
|
64
|
-
export interface Agent {
|
|
65
|
-
agent_id: string;
|
|
66
|
-
name: string;
|
|
67
|
-
conversation_config: ConversationConfig;
|
|
68
|
-
platform_settings?: PlatformSettings;
|
|
69
|
-
created_at: string;
|
|
70
|
-
updated_at?: string;
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// Tool Configuration
|
|
74
|
-
export interface ToolParameter {
|
|
75
|
-
name: string;
|
|
76
|
-
type: "string" | "number" | "boolean" | "object" | "array";
|
|
77
|
-
description: string;
|
|
78
|
-
required: boolean;
|
|
79
|
-
enum?: string[];
|
|
80
|
-
}
|
|
81
|
-
|
|
82
|
-
export interface ToolConfig {
|
|
83
|
-
name: string;
|
|
84
|
-
description: string;
|
|
85
|
-
type: "webhook" | "client";
|
|
86
|
-
url?: string;
|
|
87
|
-
method?: "GET" | "POST" | "PUT" | "PATCH" | "DELETE";
|
|
88
|
-
headers?: Record<string, string>;
|
|
89
|
-
parameters: ToolParameter[];
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
// Conversation
|
|
93
|
-
export interface ConversationMetadata {
|
|
94
|
-
conversation_id: string;
|
|
95
|
-
agent_id: string;
|
|
96
|
-
status: "in_progress" | "completed" | "failed";
|
|
97
|
-
started_at: string;
|
|
98
|
-
ended_at?: string;
|
|
99
|
-
duration_seconds?: number;
|
|
100
|
-
transcript?: TranscriptEntry[];
|
|
101
|
-
analysis?: ConversationAnalysis;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
export interface TranscriptEntry {
|
|
105
|
-
role: "agent" | "user";
|
|
106
|
-
message: string;
|
|
107
|
-
timestamp: string;
|
|
108
|
-
tool_calls?: ToolCall[];
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
export interface ToolCall {
|
|
112
|
-
tool_name: string;
|
|
113
|
-
parameters: Record<string, unknown>;
|
|
114
|
-
result?: unknown;
|
|
115
|
-
error?: string;
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
export interface ConversationAnalysis {
|
|
119
|
-
user_sentiment?: "positive" | "neutral" | "negative";
|
|
120
|
-
agent_performance?: number;
|
|
121
|
-
key_topics?: string[];
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Voice
|
|
125
|
-
export interface Voice {
|
|
126
|
-
voice_id: string;
|
|
127
|
-
name: string;
|
|
128
|
-
category?: string;
|
|
129
|
-
description?: string;
|
|
130
|
-
preview_url?: string;
|
|
131
|
-
labels?: {
|
|
132
|
-
accent?: string;
|
|
133
|
-
description?: string;
|
|
134
|
-
age?: string;
|
|
135
|
-
gender?: string;
|
|
136
|
-
use_case?: string;
|
|
137
|
-
};
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// Pagination
|
|
141
|
-
export interface PaginatedResponse<T> {
|
|
142
|
-
total: number;
|
|
143
|
-
count: number;
|
|
144
|
-
offset: number;
|
|
145
|
-
items: T[];
|
|
146
|
-
has_more: boolean;
|
|
147
|
-
next_offset?: number;
|
|
148
|
-
}
|
|
149
|
-
|
|
150
|
-
// API Response wrappers
|
|
151
|
-
export interface APIResponse<T> {
|
|
152
|
-
success: boolean;
|
|
153
|
-
data?: T;
|
|
154
|
-
error?: string;
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
// Knowledge Base
|
|
158
|
-
export interface KnowledgeBaseDocument {
|
|
159
|
-
type: "text" | "url" | "file";
|
|
160
|
-
content: string;
|
|
161
|
-
metadata?: Record<string, string>;
|
|
162
|
-
}
|
|
163
|
-
|
|
164
|
-
// Widget Configuration
|
|
165
|
-
export interface WidgetConfig {
|
|
166
|
-
agent_id: string;
|
|
167
|
-
color?: string;
|
|
168
|
-
avatar_url?: string;
|
|
169
|
-
}
|
|
170
|
-
|
|
171
|
-
// Outbound Calling
|
|
172
|
-
export interface OutboundCallRequest {
|
|
173
|
-
agent_id: string;
|
|
174
|
-
agent_phone_number_id: string;
|
|
175
|
-
to_number: string;
|
|
176
|
-
/**
|
|
177
|
-
* Conversation initiation data for personalization
|
|
178
|
-
* @example
|
|
179
|
-
* {
|
|
180
|
-
* dynamic_variables: {
|
|
181
|
-
* customer_name: "John Smith",
|
|
182
|
-
* account_id: "12345"
|
|
183
|
-
* },
|
|
184
|
-
* conversation_config_override: {
|
|
185
|
-
* agent: {
|
|
186
|
-
* first_message: "Custom greeting"
|
|
187
|
-
* }
|
|
188
|
-
* }
|
|
189
|
-
* }
|
|
190
|
-
*/
|
|
191
|
-
conversation_initiation_client_data?: Record<string, unknown> | null;
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
export interface OutboundCallResponse {
|
|
195
|
-
success: boolean;
|
|
196
|
-
message: string;
|
|
197
|
-
conversation_id: string | null;
|
|
198
|
-
callSid: string | null;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// Batch Calling
|
|
202
|
-
export type BatchStatus = "pending" | "in_progress" | "completed" | "failed" | "cancelled";
|
|
203
|
-
export type RecipientStatus = BatchStatus | "initiated" | "voicemail";
|
|
204
|
-
export type PhoneProvider = "twilio" | "sip_trunk";
|
|
205
|
-
|
|
206
|
-
export interface OutboundCallRecipient {
|
|
207
|
-
id?: string;
|
|
208
|
-
phone_number?: string;
|
|
209
|
-
whatsapp_user_id?: string;
|
|
210
|
-
/**
|
|
211
|
-
* Conversation initiation data for personalization
|
|
212
|
-
* @example
|
|
213
|
-
* {
|
|
214
|
-
* dynamic_variables: {
|
|
215
|
-
* name: "Alice Johnson",
|
|
216
|
-
* account_id: "A123"
|
|
217
|
-
* }
|
|
218
|
-
* }
|
|
219
|
-
*/
|
|
220
|
-
conversation_initiation_client_data?: Record<string, unknown>;
|
|
221
|
-
}
|
|
222
|
-
|
|
223
|
-
export interface BatchCallRequest {
|
|
224
|
-
call_name: string;
|
|
225
|
-
agent_id: string;
|
|
226
|
-
recipients: OutboundCallRecipient[];
|
|
227
|
-
scheduled_time_unix?: number | null;
|
|
228
|
-
agent_phone_number_id?: string | null;
|
|
229
|
-
}
|
|
230
|
-
|
|
231
|
-
export interface BatchCallResponse {
|
|
232
|
-
id: string;
|
|
233
|
-
name: string;
|
|
234
|
-
agent_id: string;
|
|
235
|
-
agent_name: string;
|
|
236
|
-
status: BatchStatus;
|
|
237
|
-
created_at_unix: number;
|
|
238
|
-
scheduled_time_unix: number;
|
|
239
|
-
last_updated_at_unix: number;
|
|
240
|
-
total_calls_dispatched: number;
|
|
241
|
-
total_calls_scheduled: number;
|
|
242
|
-
phone_number_id: string | null;
|
|
243
|
-
phone_provider: PhoneProvider | null;
|
|
244
|
-
}
|
|
245
|
-
|
|
246
|
-
export interface BatchCallRecipient {
|
|
247
|
-
id: string;
|
|
248
|
-
phone_number?: string;
|
|
249
|
-
whatsapp_user_id?: string;
|
|
250
|
-
status: RecipientStatus;
|
|
251
|
-
conversation_id: string;
|
|
252
|
-
created_at_unix: number;
|
|
253
|
-
updated_at_unix: number;
|
|
254
|
-
/**
|
|
255
|
-
* Conversation initiation data for personalization
|
|
256
|
-
* @example
|
|
257
|
-
* {
|
|
258
|
-
* dynamic_variables: {
|
|
259
|
-
* name: "Bob Wilson",
|
|
260
|
-
* appointment_time: "3pm"
|
|
261
|
-
* }
|
|
262
|
-
* }
|
|
263
|
-
*/
|
|
264
|
-
conversation_initiation_client_data?: Record<string, unknown>;
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
export interface BatchCallDetailedResponse extends BatchCallResponse {
|
|
268
|
-
recipients: BatchCallRecipient[];
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
export interface WorkspaceBatchCallsResponse {
|
|
272
|
-
batch_calls: BatchCallResponse[];
|
|
273
|
-
next_doc: string | null;
|
|
274
|
-
has_more: boolean;
|
|
275
|
-
}
|
|
276
|
-
|
|
277
|
-
// Phone Number Management
|
|
278
|
-
export interface TwilioPhoneNumber {
|
|
279
|
-
phone_number: string;
|
|
280
|
-
label: string;
|
|
281
|
-
phone_number_id: string;
|
|
282
|
-
supports_inbound: boolean;
|
|
283
|
-
supports_outbound: boolean;
|
|
284
|
-
provider: "twilio";
|
|
285
|
-
assigned_agent: {
|
|
286
|
-
agent_id: string;
|
|
287
|
-
agent_name: string;
|
|
288
|
-
} | null;
|
|
289
|
-
}
|
|
290
|
-
|
|
291
|
-
export interface SIPTrunkPhoneNumber {
|
|
292
|
-
phone_number: string;
|
|
293
|
-
label: string;
|
|
294
|
-
phone_number_id: string;
|
|
295
|
-
supports_inbound: boolean;
|
|
296
|
-
supports_outbound: boolean;
|
|
297
|
-
provider: "sip_trunk";
|
|
298
|
-
livekit_stack: "standard" | "static";
|
|
299
|
-
assigned_agent: {
|
|
300
|
-
agent_id: string;
|
|
301
|
-
agent_name: string;
|
|
302
|
-
} | null;
|
|
303
|
-
outbound_trunk?: Record<string, unknown> | null;
|
|
304
|
-
inbound_trunk?: Record<string, unknown> | null;
|
|
305
|
-
provider_config?: Record<string, unknown> | null;
|
|
306
|
-
}
|
|
307
|
-
|
|
308
|
-
export type PhoneNumber = TwilioPhoneNumber | SIPTrunkPhoneNumber;
|
|
309
|
-
|
|
310
|
-
export interface ImportPhoneNumberRequest {
|
|
311
|
-
phone_number: string;
|
|
312
|
-
label: string;
|
|
313
|
-
sid: string;
|
|
314
|
-
token: string;
|
|
315
|
-
provider: "twilio";
|
|
316
|
-
supports_inbound?: boolean;
|
|
317
|
-
supports_outbound?: boolean;
|
|
318
|
-
region_config?: {
|
|
319
|
-
region_id: "us1" | "ie1" | "au1";
|
|
320
|
-
token: string;
|
|
321
|
-
edge_location: "ashburn" | "dublin" | "frankfurt" | "sao-paulo" | "singapore" | "sydney" | "tokyo" | "umatilla" | "roaming";
|
|
322
|
-
};
|
|
323
|
-
}
|
|
324
|
-
|
|
325
|
-
export interface ImportPhoneNumberResponse {
|
|
326
|
-
phone_number_id: string;
|
|
327
|
-
}
|