pollax 1.0.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.
- package/README.md +234 -0
- package/dist/index.d.mts +795 -0
- package/dist/index.d.ts +795 -0
- package/dist/index.js +907 -0
- package/dist/index.mjs +856 -0
- package/package.json +60 -0
package/dist/index.d.mts
ADDED
|
@@ -0,0 +1,795 @@
|
|
|
1
|
+
import { AxiosRequestConfig } from 'axios';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Agent configuration and types
|
|
5
|
+
*/
|
|
6
|
+
interface Agent {
|
|
7
|
+
id: string;
|
|
8
|
+
name: string;
|
|
9
|
+
description?: string;
|
|
10
|
+
system_prompt: string;
|
|
11
|
+
provider: 'openai' | 'anthropic' | 'ollama';
|
|
12
|
+
model: string;
|
|
13
|
+
voice_provider?: 'elevenlabs' | 'openai' | 'google';
|
|
14
|
+
voice_id?: string;
|
|
15
|
+
stt_provider?: 'deepgram' | 'whisper' | 'google';
|
|
16
|
+
temperature?: number;
|
|
17
|
+
max_tokens?: number;
|
|
18
|
+
is_active: boolean;
|
|
19
|
+
tenant_id: string;
|
|
20
|
+
config?: Record<string, any>;
|
|
21
|
+
created_at: string;
|
|
22
|
+
updated_at: string;
|
|
23
|
+
calls_count?: number;
|
|
24
|
+
success_rate?: string;
|
|
25
|
+
avg_duration?: string;
|
|
26
|
+
}
|
|
27
|
+
interface CreateAgentParams {
|
|
28
|
+
name: string;
|
|
29
|
+
system_prompt: string;
|
|
30
|
+
description?: string;
|
|
31
|
+
provider?: 'openai' | 'anthropic' | 'ollama';
|
|
32
|
+
model?: string;
|
|
33
|
+
voice_provider?: 'elevenlabs' | 'openai' | 'google';
|
|
34
|
+
voice_id?: string;
|
|
35
|
+
stt_provider?: 'deepgram' | 'whisper' | 'google';
|
|
36
|
+
temperature?: number;
|
|
37
|
+
max_tokens?: number;
|
|
38
|
+
config?: Record<string, any>;
|
|
39
|
+
}
|
|
40
|
+
interface UpdateAgentParams {
|
|
41
|
+
name?: string;
|
|
42
|
+
description?: string;
|
|
43
|
+
system_prompt?: string;
|
|
44
|
+
provider?: 'openai' | 'anthropic' | 'ollama';
|
|
45
|
+
model?: string;
|
|
46
|
+
voice_provider?: 'elevenlabs' | 'openai' | 'google';
|
|
47
|
+
voice_id?: string;
|
|
48
|
+
is_active?: boolean;
|
|
49
|
+
config?: Record<string, any>;
|
|
50
|
+
}
|
|
51
|
+
interface ListAgentsParams {
|
|
52
|
+
is_active?: boolean;
|
|
53
|
+
skip?: number;
|
|
54
|
+
limit?: number;
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Call types
|
|
58
|
+
*/
|
|
59
|
+
interface Call {
|
|
60
|
+
call_sid: string;
|
|
61
|
+
agent_id: string;
|
|
62
|
+
to_number: string;
|
|
63
|
+
from_number?: string;
|
|
64
|
+
status: 'queued' | 'ringing' | 'in-progress' | 'completed' | 'failed' | 'busy' | 'no-answer';
|
|
65
|
+
direction: 'inbound' | 'outbound';
|
|
66
|
+
duration?: number;
|
|
67
|
+
start_time?: string;
|
|
68
|
+
end_time?: string;
|
|
69
|
+
recording_url?: string;
|
|
70
|
+
transcript?: string;
|
|
71
|
+
metadata?: Record<string, any>;
|
|
72
|
+
created_at: string;
|
|
73
|
+
agent_name?: string;
|
|
74
|
+
}
|
|
75
|
+
interface CreateCallParams {
|
|
76
|
+
agent_id: string;
|
|
77
|
+
to_number: string;
|
|
78
|
+
from_number?: string;
|
|
79
|
+
metadata?: Record<string, any>;
|
|
80
|
+
}
|
|
81
|
+
interface ListCallsParams {
|
|
82
|
+
agent_id?: string;
|
|
83
|
+
status?: string;
|
|
84
|
+
skip?: number;
|
|
85
|
+
limit?: number;
|
|
86
|
+
}
|
|
87
|
+
/**
|
|
88
|
+
* Campaign types
|
|
89
|
+
*/
|
|
90
|
+
interface Campaign {
|
|
91
|
+
id: string;
|
|
92
|
+
name: string;
|
|
93
|
+
agent_id?: string;
|
|
94
|
+
agent_name?: string;
|
|
95
|
+
status: 'draft' | 'scheduled' | 'running' | 'paused' | 'completed' | 'cancelled';
|
|
96
|
+
scheduled_time?: string;
|
|
97
|
+
contacts: Array<{
|
|
98
|
+
name?: string;
|
|
99
|
+
phone: string;
|
|
100
|
+
email?: string;
|
|
101
|
+
metadata?: Record<string, any>;
|
|
102
|
+
}>;
|
|
103
|
+
total_contacts: number;
|
|
104
|
+
completed_calls: number;
|
|
105
|
+
successful_calls: number;
|
|
106
|
+
failed_calls: number;
|
|
107
|
+
tenant_id: string;
|
|
108
|
+
created_at: string;
|
|
109
|
+
updated_at: string;
|
|
110
|
+
}
|
|
111
|
+
interface CreateCampaignParams {
|
|
112
|
+
name: string;
|
|
113
|
+
agent_id?: string;
|
|
114
|
+
scheduled_time?: string;
|
|
115
|
+
contacts?: Array<{
|
|
116
|
+
name?: string;
|
|
117
|
+
phone: string;
|
|
118
|
+
email?: string;
|
|
119
|
+
metadata?: Record<string, any>;
|
|
120
|
+
}>;
|
|
121
|
+
}
|
|
122
|
+
interface UpdateCampaignParams {
|
|
123
|
+
name?: string;
|
|
124
|
+
agent_id?: string;
|
|
125
|
+
status?: 'draft' | 'scheduled' | 'running' | 'paused' | 'completed' | 'cancelled';
|
|
126
|
+
scheduled_time?: string;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Knowledge Base types
|
|
130
|
+
*/
|
|
131
|
+
interface KnowledgeDocument {
|
|
132
|
+
id: string;
|
|
133
|
+
name: string;
|
|
134
|
+
type: 'pdf' | 'txt' | 'docx' | 'url';
|
|
135
|
+
content?: string;
|
|
136
|
+
url?: string;
|
|
137
|
+
chunks_count: number;
|
|
138
|
+
status: 'processing' | 'ready' | 'failed';
|
|
139
|
+
tenant_id: string;
|
|
140
|
+
created_at: string;
|
|
141
|
+
}
|
|
142
|
+
interface UploadDocumentParams {
|
|
143
|
+
name: string;
|
|
144
|
+
file?: File | Buffer;
|
|
145
|
+
content?: string;
|
|
146
|
+
url?: string;
|
|
147
|
+
type?: 'pdf' | 'txt' | 'docx' | 'url';
|
|
148
|
+
}
|
|
149
|
+
/**
|
|
150
|
+
* Analytics types
|
|
151
|
+
*/
|
|
152
|
+
interface DashboardStats {
|
|
153
|
+
total_calls: number;
|
|
154
|
+
active_agents: number;
|
|
155
|
+
success_rate: string;
|
|
156
|
+
avg_duration: string;
|
|
157
|
+
calls_by_status: Record<string, number>;
|
|
158
|
+
}
|
|
159
|
+
interface CallVolumeData {
|
|
160
|
+
period: string;
|
|
161
|
+
data: Array<{
|
|
162
|
+
timestamp: string;
|
|
163
|
+
count: number;
|
|
164
|
+
}>;
|
|
165
|
+
}
|
|
166
|
+
/**
|
|
167
|
+
* Integration types
|
|
168
|
+
*/
|
|
169
|
+
interface Integration {
|
|
170
|
+
id: string;
|
|
171
|
+
name: string;
|
|
172
|
+
type: 'twilio' | 'salesforce' | 'hubspot' | 'slack' | 'zapier' | 'webhook';
|
|
173
|
+
config: Record<string, any>;
|
|
174
|
+
is_active: boolean;
|
|
175
|
+
tenant_id: string;
|
|
176
|
+
created_at: string;
|
|
177
|
+
updated_at: string;
|
|
178
|
+
}
|
|
179
|
+
interface CreateIntegrationParams {
|
|
180
|
+
name: string;
|
|
181
|
+
type: 'twilio' | 'salesforce' | 'hubspot' | 'slack' | 'zapier' | 'webhook';
|
|
182
|
+
config: Record<string, any>;
|
|
183
|
+
}
|
|
184
|
+
/**
|
|
185
|
+
* Phone Number types
|
|
186
|
+
*/
|
|
187
|
+
interface PhoneNumber {
|
|
188
|
+
id: string;
|
|
189
|
+
phone_number: string;
|
|
190
|
+
country_code: string;
|
|
191
|
+
capabilities: {
|
|
192
|
+
voice: boolean;
|
|
193
|
+
sms: boolean;
|
|
194
|
+
};
|
|
195
|
+
is_active: boolean;
|
|
196
|
+
tenant_id: string;
|
|
197
|
+
created_at: string;
|
|
198
|
+
}
|
|
199
|
+
interface SearchPhoneNumbersParams {
|
|
200
|
+
country_code?: string;
|
|
201
|
+
area_code?: string;
|
|
202
|
+
contains?: string;
|
|
203
|
+
limit?: number;
|
|
204
|
+
}
|
|
205
|
+
/**
|
|
206
|
+
* API Key types
|
|
207
|
+
*/
|
|
208
|
+
interface ApiKey {
|
|
209
|
+
id: string;
|
|
210
|
+
name: string;
|
|
211
|
+
key_prefix: string;
|
|
212
|
+
last_used_at?: string;
|
|
213
|
+
is_active: boolean;
|
|
214
|
+
created_at: string;
|
|
215
|
+
}
|
|
216
|
+
interface CreateApiKeyParams {
|
|
217
|
+
name: string;
|
|
218
|
+
permissions?: string[];
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Voice Cloning types
|
|
222
|
+
*/
|
|
223
|
+
interface VoiceProfile {
|
|
224
|
+
id: string;
|
|
225
|
+
name: string;
|
|
226
|
+
description?: string;
|
|
227
|
+
voice_id: string;
|
|
228
|
+
provider: 'elevenlabs' | 'openai';
|
|
229
|
+
status: 'training' | 'ready' | 'failed';
|
|
230
|
+
tenant_id: string;
|
|
231
|
+
created_at: string;
|
|
232
|
+
}
|
|
233
|
+
interface CreateVoiceProfileParams {
|
|
234
|
+
name: string;
|
|
235
|
+
description?: string;
|
|
236
|
+
audio_files: File[] | Buffer[];
|
|
237
|
+
provider?: 'elevenlabs' | 'openai';
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
declare class Agents {
|
|
241
|
+
private request;
|
|
242
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
243
|
+
/**
|
|
244
|
+
* Create a new AI agent
|
|
245
|
+
*
|
|
246
|
+
* @example
|
|
247
|
+
* const agent = await pollax.agents.create({
|
|
248
|
+
* name: 'Customer Support Agent',
|
|
249
|
+
* system_prompt: 'You are a helpful customer support agent.',
|
|
250
|
+
* voice_id: 'alloy',
|
|
251
|
+
* model: 'gpt-4',
|
|
252
|
+
* });
|
|
253
|
+
*/
|
|
254
|
+
create(params: CreateAgentParams): Promise<Agent>;
|
|
255
|
+
/**
|
|
256
|
+
* List all agents
|
|
257
|
+
*
|
|
258
|
+
* @example
|
|
259
|
+
* const agents = await pollax.agents.list({ is_active: true });
|
|
260
|
+
*/
|
|
261
|
+
list(params?: ListAgentsParams): Promise<Agent[]>;
|
|
262
|
+
/**
|
|
263
|
+
* Get a single agent by ID
|
|
264
|
+
*
|
|
265
|
+
* @example
|
|
266
|
+
* const agent = await pollax.agents.retrieve('agent_123');
|
|
267
|
+
*/
|
|
268
|
+
retrieve(agentId: string): Promise<Agent>;
|
|
269
|
+
/**
|
|
270
|
+
* Update an agent
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* const agent = await pollax.agents.update('agent_123', {
|
|
274
|
+
* name: 'Updated Agent Name',
|
|
275
|
+
* is_active: false,
|
|
276
|
+
* });
|
|
277
|
+
*/
|
|
278
|
+
update(agentId: string, params: UpdateAgentParams): Promise<Agent>;
|
|
279
|
+
/**
|
|
280
|
+
* Delete an agent
|
|
281
|
+
*
|
|
282
|
+
* @example
|
|
283
|
+
* await pollax.agents.delete('agent_123');
|
|
284
|
+
*/
|
|
285
|
+
delete(agentId: string): Promise<{
|
|
286
|
+
success: boolean;
|
|
287
|
+
}>;
|
|
288
|
+
/**
|
|
289
|
+
* Test an agent with a sample prompt
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* const response = await pollax.agents.test('agent_123', {
|
|
293
|
+
* message: 'Hello, how can you help me?',
|
|
294
|
+
* });
|
|
295
|
+
*/
|
|
296
|
+
test(agentId: string, params: {
|
|
297
|
+
message: string;
|
|
298
|
+
}): Promise<{
|
|
299
|
+
response: string;
|
|
300
|
+
}>;
|
|
301
|
+
}
|
|
302
|
+
|
|
303
|
+
declare class Calls {
|
|
304
|
+
private request;
|
|
305
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
306
|
+
/**
|
|
307
|
+
* Create a new voice call
|
|
308
|
+
*
|
|
309
|
+
* @example
|
|
310
|
+
* const call = await pollax.calls.create({
|
|
311
|
+
* agent_id: 'agent_123',
|
|
312
|
+
* to_number: '+1234567890',
|
|
313
|
+
* });
|
|
314
|
+
*/
|
|
315
|
+
create(params: CreateCallParams): Promise<Call>;
|
|
316
|
+
/**
|
|
317
|
+
* List all calls
|
|
318
|
+
*
|
|
319
|
+
* @example
|
|
320
|
+
* const calls = await pollax.calls.list({
|
|
321
|
+
* agent_id: 'agent_123',
|
|
322
|
+
* status: 'completed',
|
|
323
|
+
* });
|
|
324
|
+
*/
|
|
325
|
+
list(params?: ListCallsParams): Promise<Call[]>;
|
|
326
|
+
/**
|
|
327
|
+
* Get a single call by SID
|
|
328
|
+
*
|
|
329
|
+
* @example
|
|
330
|
+
* const call = await pollax.calls.retrieve('CA123456789');
|
|
331
|
+
*/
|
|
332
|
+
retrieve(callSid: string): Promise<Call>;
|
|
333
|
+
/**
|
|
334
|
+
* End an active call
|
|
335
|
+
*
|
|
336
|
+
* @example
|
|
337
|
+
* await pollax.calls.end('CA123456789');
|
|
338
|
+
*/
|
|
339
|
+
end(callSid: string): Promise<Call>;
|
|
340
|
+
/**
|
|
341
|
+
* Transfer a call to another number
|
|
342
|
+
*
|
|
343
|
+
* @example
|
|
344
|
+
* await pollax.calls.transfer('CA123456789', {
|
|
345
|
+
* to_number: '+1234567890',
|
|
346
|
+
* });
|
|
347
|
+
*/
|
|
348
|
+
transfer(callSid: string, params: {
|
|
349
|
+
to_number: string;
|
|
350
|
+
}): Promise<Call>;
|
|
351
|
+
/**
|
|
352
|
+
* Get call transcript
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* const transcript = await pollax.calls.getTranscript('CA123456789');
|
|
356
|
+
*/
|
|
357
|
+
getTranscript(callSid: string): Promise<{
|
|
358
|
+
transcript: string;
|
|
359
|
+
messages: any[];
|
|
360
|
+
}>;
|
|
361
|
+
/**
|
|
362
|
+
* Get call recording URL
|
|
363
|
+
*
|
|
364
|
+
* @example
|
|
365
|
+
* const recording = await pollax.calls.getRecording('CA123456789');
|
|
366
|
+
*/
|
|
367
|
+
getRecording(callSid: string): Promise<{
|
|
368
|
+
url: string;
|
|
369
|
+
}>;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
declare class Campaigns {
|
|
373
|
+
private request;
|
|
374
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
375
|
+
/**
|
|
376
|
+
* Create a new campaign
|
|
377
|
+
*
|
|
378
|
+
* @example
|
|
379
|
+
* const campaign = await pollax.campaigns.create({
|
|
380
|
+
* name: 'Q1 Outreach Campaign',
|
|
381
|
+
* agent_id: 'agent_123',
|
|
382
|
+
* contacts: [
|
|
383
|
+
* { name: 'John Doe', phone: '+1234567890' },
|
|
384
|
+
* { name: 'Jane Smith', phone: '+0987654321' },
|
|
385
|
+
* ],
|
|
386
|
+
* });
|
|
387
|
+
*/
|
|
388
|
+
create(params: CreateCampaignParams): Promise<Campaign>;
|
|
389
|
+
/**
|
|
390
|
+
* List all campaigns
|
|
391
|
+
*
|
|
392
|
+
* @example
|
|
393
|
+
* const campaigns = await pollax.campaigns.list();
|
|
394
|
+
*/
|
|
395
|
+
list(): Promise<Campaign[]>;
|
|
396
|
+
/**
|
|
397
|
+
* Get a single campaign by ID
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* const campaign = await pollax.campaigns.retrieve('campaign_123');
|
|
401
|
+
*/
|
|
402
|
+
retrieve(campaignId: string): Promise<Campaign>;
|
|
403
|
+
/**
|
|
404
|
+
* Update a campaign
|
|
405
|
+
*
|
|
406
|
+
* @example
|
|
407
|
+
* const campaign = await pollax.campaigns.update('campaign_123', {
|
|
408
|
+
* status: 'paused',
|
|
409
|
+
* });
|
|
410
|
+
*/
|
|
411
|
+
update(campaignId: string, params: UpdateCampaignParams): Promise<Campaign>;
|
|
412
|
+
/**
|
|
413
|
+
* Delete a campaign
|
|
414
|
+
*
|
|
415
|
+
* @example
|
|
416
|
+
* await pollax.campaigns.delete('campaign_123');
|
|
417
|
+
*/
|
|
418
|
+
delete(campaignId: string): Promise<{
|
|
419
|
+
success: boolean;
|
|
420
|
+
}>;
|
|
421
|
+
/**
|
|
422
|
+
* Start a campaign
|
|
423
|
+
*
|
|
424
|
+
* @example
|
|
425
|
+
* await pollax.campaigns.start('campaign_123');
|
|
426
|
+
*/
|
|
427
|
+
start(campaignId: string): Promise<Campaign>;
|
|
428
|
+
/**
|
|
429
|
+
* Pause a running campaign
|
|
430
|
+
*
|
|
431
|
+
* @example
|
|
432
|
+
* await pollax.campaigns.pause('campaign_123');
|
|
433
|
+
*/
|
|
434
|
+
pause(campaignId: string): Promise<Campaign>;
|
|
435
|
+
/**
|
|
436
|
+
* Upload contacts to a campaign via CSV
|
|
437
|
+
*
|
|
438
|
+
* @example
|
|
439
|
+
* const campaign = await pollax.campaigns.uploadContacts('campaign_123', csvFile);
|
|
440
|
+
*/
|
|
441
|
+
uploadContacts(campaignId: string, file: File | Buffer): Promise<Campaign>;
|
|
442
|
+
/**
|
|
443
|
+
* Get campaign statistics
|
|
444
|
+
*
|
|
445
|
+
* @example
|
|
446
|
+
* const stats = await pollax.campaigns.getStats('campaign_123');
|
|
447
|
+
*/
|
|
448
|
+
getStats(campaignId: string): Promise<{
|
|
449
|
+
total_contacts: number;
|
|
450
|
+
completed_calls: number;
|
|
451
|
+
successful_calls: number;
|
|
452
|
+
failed_calls: number;
|
|
453
|
+
success_rate: string;
|
|
454
|
+
}>;
|
|
455
|
+
}
|
|
456
|
+
|
|
457
|
+
declare class Knowledge {
|
|
458
|
+
private request;
|
|
459
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
460
|
+
/**
|
|
461
|
+
* Upload a document to the knowledge base
|
|
462
|
+
*
|
|
463
|
+
* @example
|
|
464
|
+
* const doc = await pollax.knowledge.upload({
|
|
465
|
+
* name: 'Product Manual',
|
|
466
|
+
* file: pdfFile,
|
|
467
|
+
* type: 'pdf',
|
|
468
|
+
* });
|
|
469
|
+
*/
|
|
470
|
+
upload(params: UploadDocumentParams): Promise<KnowledgeDocument>;
|
|
471
|
+
/**
|
|
472
|
+
* List all knowledge documents
|
|
473
|
+
*
|
|
474
|
+
* @example
|
|
475
|
+
* const documents = await pollax.knowledge.list();
|
|
476
|
+
*/
|
|
477
|
+
list(): Promise<KnowledgeDocument[]>;
|
|
478
|
+
/**
|
|
479
|
+
* Get a single document by ID
|
|
480
|
+
*
|
|
481
|
+
* @example
|
|
482
|
+
* const doc = await pollax.knowledge.retrieve('doc_123');
|
|
483
|
+
*/
|
|
484
|
+
retrieve(documentId: string): Promise<KnowledgeDocument>;
|
|
485
|
+
/**
|
|
486
|
+
* Delete a document
|
|
487
|
+
*
|
|
488
|
+
* @example
|
|
489
|
+
* await pollax.knowledge.delete('doc_123');
|
|
490
|
+
*/
|
|
491
|
+
delete(documentId: string): Promise<{
|
|
492
|
+
success: boolean;
|
|
493
|
+
}>;
|
|
494
|
+
/**
|
|
495
|
+
* Search the knowledge base
|
|
496
|
+
*
|
|
497
|
+
* @example
|
|
498
|
+
* const results = await pollax.knowledge.search({
|
|
499
|
+
* query: 'How do I reset my password?',
|
|
500
|
+
* limit: 5,
|
|
501
|
+
* });
|
|
502
|
+
*/
|
|
503
|
+
search(params: {
|
|
504
|
+
query: string;
|
|
505
|
+
limit?: number;
|
|
506
|
+
}): Promise<{
|
|
507
|
+
results: Array<{
|
|
508
|
+
document_id: string;
|
|
509
|
+
content: string;
|
|
510
|
+
score: number;
|
|
511
|
+
}>;
|
|
512
|
+
}>;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
declare class Analytics {
|
|
516
|
+
private request;
|
|
517
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
518
|
+
/**
|
|
519
|
+
* Get dashboard statistics
|
|
520
|
+
*
|
|
521
|
+
* @example
|
|
522
|
+
* const stats = await pollax.analytics.getStats();
|
|
523
|
+
*/
|
|
524
|
+
getStats(): Promise<DashboardStats>;
|
|
525
|
+
/**
|
|
526
|
+
* Get call volume over time
|
|
527
|
+
*
|
|
528
|
+
* @example
|
|
529
|
+
* const volume = await pollax.analytics.getCallVolume({ period: '7d' });
|
|
530
|
+
*/
|
|
531
|
+
getCallVolume(params?: {
|
|
532
|
+
period?: '24h' | '7d' | '30d';
|
|
533
|
+
}): Promise<CallVolumeData>;
|
|
534
|
+
/**
|
|
535
|
+
* Get agent performance metrics
|
|
536
|
+
*
|
|
537
|
+
* @example
|
|
538
|
+
* const performance = await pollax.analytics.getAgentPerformance('agent_123');
|
|
539
|
+
*/
|
|
540
|
+
getAgentPerformance(agentId: string): Promise<{
|
|
541
|
+
total_calls: number;
|
|
542
|
+
success_rate: string;
|
|
543
|
+
avg_duration: string;
|
|
544
|
+
total_minutes: number;
|
|
545
|
+
}>;
|
|
546
|
+
/**
|
|
547
|
+
* Export analytics data
|
|
548
|
+
*
|
|
549
|
+
* @example
|
|
550
|
+
* const csvData = await pollax.analytics.export({
|
|
551
|
+
* start_date: '2024-01-01',
|
|
552
|
+
* end_date: '2024-01-31',
|
|
553
|
+
* format: 'csv',
|
|
554
|
+
* });
|
|
555
|
+
*/
|
|
556
|
+
export(params: {
|
|
557
|
+
start_date: string;
|
|
558
|
+
end_date: string;
|
|
559
|
+
format?: 'csv' | 'json';
|
|
560
|
+
}): Promise<string | object>;
|
|
561
|
+
}
|
|
562
|
+
|
|
563
|
+
declare class Integrations {
|
|
564
|
+
private request;
|
|
565
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
566
|
+
/**
|
|
567
|
+
* Create a new integration
|
|
568
|
+
*
|
|
569
|
+
* @example
|
|
570
|
+
* const integration = await pollax.integrations.create({
|
|
571
|
+
* name: 'Salesforce CRM',
|
|
572
|
+
* type: 'salesforce',
|
|
573
|
+
* config: {
|
|
574
|
+
* client_id: '...',
|
|
575
|
+
* client_secret: '...',
|
|
576
|
+
* },
|
|
577
|
+
* });
|
|
578
|
+
*/
|
|
579
|
+
create(params: CreateIntegrationParams): Promise<Integration>;
|
|
580
|
+
/**
|
|
581
|
+
* List all integrations
|
|
582
|
+
*
|
|
583
|
+
* @example
|
|
584
|
+
* const integrations = await pollax.integrations.list();
|
|
585
|
+
*/
|
|
586
|
+
list(): Promise<Integration[]>;
|
|
587
|
+
/**
|
|
588
|
+
* Get a single integration by ID
|
|
589
|
+
*
|
|
590
|
+
* @example
|
|
591
|
+
* const integration = await pollax.integrations.retrieve('int_123');
|
|
592
|
+
*/
|
|
593
|
+
retrieve(integrationId: string): Promise<Integration>;
|
|
594
|
+
/**
|
|
595
|
+
* Delete an integration
|
|
596
|
+
*
|
|
597
|
+
* @example
|
|
598
|
+
* await pollax.integrations.delete('int_123');
|
|
599
|
+
*/
|
|
600
|
+
delete(integrationId: string): Promise<{
|
|
601
|
+
success: boolean;
|
|
602
|
+
}>;
|
|
603
|
+
}
|
|
604
|
+
|
|
605
|
+
declare class PhoneNumbers {
|
|
606
|
+
private request;
|
|
607
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
608
|
+
/**
|
|
609
|
+
* List all phone numbers
|
|
610
|
+
*
|
|
611
|
+
* @example
|
|
612
|
+
* const numbers = await pollax.phoneNumbers.list();
|
|
613
|
+
*/
|
|
614
|
+
list(): Promise<PhoneNumber[]>;
|
|
615
|
+
/**
|
|
616
|
+
* Search available phone numbers
|
|
617
|
+
*
|
|
618
|
+
* @example
|
|
619
|
+
* const numbers = await pollax.phoneNumbers.search({
|
|
620
|
+
* country_code: 'US',
|
|
621
|
+
* area_code: '415',
|
|
622
|
+
* });
|
|
623
|
+
*/
|
|
624
|
+
search(params: SearchPhoneNumbersParams): Promise<PhoneNumber[]>;
|
|
625
|
+
/**
|
|
626
|
+
* Purchase a phone number
|
|
627
|
+
*
|
|
628
|
+
* @example
|
|
629
|
+
* const number = await pollax.phoneNumbers.purchase('+14155551234');
|
|
630
|
+
*/
|
|
631
|
+
purchase(phoneNumber: string): Promise<PhoneNumber>;
|
|
632
|
+
/**
|
|
633
|
+
* Release a phone number
|
|
634
|
+
*
|
|
635
|
+
* @example
|
|
636
|
+
* await pollax.phoneNumbers.release('num_123');
|
|
637
|
+
*/
|
|
638
|
+
release(numberId: string): Promise<{
|
|
639
|
+
success: boolean;
|
|
640
|
+
}>;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
declare class ApiKeys {
|
|
644
|
+
private request;
|
|
645
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
646
|
+
/**
|
|
647
|
+
* Create a new API key
|
|
648
|
+
*
|
|
649
|
+
* @example
|
|
650
|
+
* const apiKey = await pollax.apiKeys.create({
|
|
651
|
+
* name: 'Production Key',
|
|
652
|
+
* permissions: ['read', 'write'],
|
|
653
|
+
* });
|
|
654
|
+
*/
|
|
655
|
+
create(params: CreateApiKeyParams): Promise<ApiKey & {
|
|
656
|
+
key: string;
|
|
657
|
+
}>;
|
|
658
|
+
/**
|
|
659
|
+
* List all API keys
|
|
660
|
+
*
|
|
661
|
+
* @example
|
|
662
|
+
* const keys = await pollax.apiKeys.list();
|
|
663
|
+
*/
|
|
664
|
+
list(): Promise<ApiKey[]>;
|
|
665
|
+
/**
|
|
666
|
+
* Revoke an API key
|
|
667
|
+
*
|
|
668
|
+
* @example
|
|
669
|
+
* await pollax.apiKeys.revoke('key_123');
|
|
670
|
+
*/
|
|
671
|
+
revoke(keyId: string): Promise<{
|
|
672
|
+
success: boolean;
|
|
673
|
+
}>;
|
|
674
|
+
}
|
|
675
|
+
|
|
676
|
+
declare class VoiceCloning {
|
|
677
|
+
private request;
|
|
678
|
+
constructor(request: <T = any>(config: AxiosRequestConfig) => Promise<T>);
|
|
679
|
+
/**
|
|
680
|
+
* Create a new voice profile
|
|
681
|
+
*
|
|
682
|
+
* @example
|
|
683
|
+
* const voice = await pollax.voiceCloning.create({
|
|
684
|
+
* name: 'Custom Voice',
|
|
685
|
+
* description: 'My custom voice profile',
|
|
686
|
+
* audio_files: [audioFile1, audioFile2],
|
|
687
|
+
* });
|
|
688
|
+
*/
|
|
689
|
+
create(params: CreateVoiceProfileParams): Promise<VoiceProfile>;
|
|
690
|
+
/**
|
|
691
|
+
* List all voice profiles
|
|
692
|
+
*
|
|
693
|
+
* @example
|
|
694
|
+
* const voices = await pollax.voiceCloning.list();
|
|
695
|
+
*/
|
|
696
|
+
list(): Promise<VoiceProfile[]>;
|
|
697
|
+
/**
|
|
698
|
+
* Get a single voice profile by ID
|
|
699
|
+
*
|
|
700
|
+
* @example
|
|
701
|
+
* const voice = await pollax.voiceCloning.retrieve('voice_123');
|
|
702
|
+
*/
|
|
703
|
+
retrieve(voiceId: string): Promise<VoiceProfile>;
|
|
704
|
+
/**
|
|
705
|
+
* Delete a voice profile
|
|
706
|
+
*
|
|
707
|
+
* @example
|
|
708
|
+
* await pollax.voiceCloning.delete('voice_123');
|
|
709
|
+
*/
|
|
710
|
+
delete(voiceId: string): Promise<{
|
|
711
|
+
success: boolean;
|
|
712
|
+
}>;
|
|
713
|
+
}
|
|
714
|
+
|
|
715
|
+
interface PollaxConfig {
|
|
716
|
+
/**
|
|
717
|
+
* Your Pollax API key (required)
|
|
718
|
+
* Get it from https://pollax.ai/settings/api-keys
|
|
719
|
+
*/
|
|
720
|
+
apiKey: string;
|
|
721
|
+
/**
|
|
722
|
+
* Base URL for the Pollax API
|
|
723
|
+
* @default 'https://api.pollax.ai'
|
|
724
|
+
*/
|
|
725
|
+
baseURL?: string;
|
|
726
|
+
/**
|
|
727
|
+
* Request timeout in milliseconds
|
|
728
|
+
* @default 30000
|
|
729
|
+
*/
|
|
730
|
+
timeout?: number;
|
|
731
|
+
/**
|
|
732
|
+
* Maximum number of retry attempts
|
|
733
|
+
* @default 3
|
|
734
|
+
*/
|
|
735
|
+
maxRetries?: number;
|
|
736
|
+
/**
|
|
737
|
+
* Organization/tenant ID (optional)
|
|
738
|
+
* If provided, all requests will be scoped to this organization
|
|
739
|
+
*/
|
|
740
|
+
tenantId?: string;
|
|
741
|
+
}
|
|
742
|
+
declare class Pollax {
|
|
743
|
+
private client;
|
|
744
|
+
private maxRetries;
|
|
745
|
+
readonly agents: Agents;
|
|
746
|
+
readonly calls: Calls;
|
|
747
|
+
readonly campaigns: Campaigns;
|
|
748
|
+
readonly knowledge: Knowledge;
|
|
749
|
+
readonly analytics: Analytics;
|
|
750
|
+
readonly integrations: Integrations;
|
|
751
|
+
readonly phoneNumbers: PhoneNumbers;
|
|
752
|
+
readonly apiKeys: ApiKeys;
|
|
753
|
+
readonly voiceCloning: VoiceCloning;
|
|
754
|
+
constructor(config: PollaxConfig);
|
|
755
|
+
/**
|
|
756
|
+
* Make an HTTP request with automatic retries
|
|
757
|
+
*/
|
|
758
|
+
request<T = any>(config: AxiosRequestConfig, retries?: number): Promise<T>;
|
|
759
|
+
private sleep;
|
|
760
|
+
}
|
|
761
|
+
|
|
762
|
+
/**
|
|
763
|
+
* Custom error class for Pollax API errors
|
|
764
|
+
*/
|
|
765
|
+
declare class PollaxError extends Error {
|
|
766
|
+
readonly statusCode: number;
|
|
767
|
+
readonly response?: any;
|
|
768
|
+
constructor(message: string, statusCode?: number, response?: any);
|
|
769
|
+
}
|
|
770
|
+
/**
|
|
771
|
+
* Error thrown when authentication fails
|
|
772
|
+
*/
|
|
773
|
+
declare class AuthenticationError extends PollaxError {
|
|
774
|
+
constructor(message?: string, response?: any);
|
|
775
|
+
}
|
|
776
|
+
/**
|
|
777
|
+
* Error thrown when a requested resource is not found
|
|
778
|
+
*/
|
|
779
|
+
declare class NotFoundError extends PollaxError {
|
|
780
|
+
constructor(message?: string, response?: any);
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Error thrown when rate limit is exceeded
|
|
784
|
+
*/
|
|
785
|
+
declare class RateLimitError extends PollaxError {
|
|
786
|
+
constructor(message?: string, response?: any);
|
|
787
|
+
}
|
|
788
|
+
/**
|
|
789
|
+
* Error thrown for validation errors
|
|
790
|
+
*/
|
|
791
|
+
declare class ValidationError extends PollaxError {
|
|
792
|
+
constructor(message?: string, response?: any);
|
|
793
|
+
}
|
|
794
|
+
|
|
795
|
+
export { type Agent, Agents, Analytics, type ApiKey, ApiKeys, AuthenticationError, type Call, type CallVolumeData, Calls, type Campaign, Campaigns, type CreateAgentParams, type CreateApiKeyParams, type CreateCallParams, type CreateCampaignParams, type CreateIntegrationParams, type CreateVoiceProfileParams, type DashboardStats, type Integration, Integrations, Knowledge, type KnowledgeDocument, type ListAgentsParams, type ListCallsParams, NotFoundError, type PhoneNumber, PhoneNumbers, Pollax, type PollaxConfig, PollaxError, RateLimitError, type SearchPhoneNumbersParams, type UpdateAgentParams, type UpdateCampaignParams, type UploadDocumentParams, ValidationError, VoiceCloning, type VoiceProfile, Pollax as default };
|