From 5e8c8689c990e3af1918e31b492ebc2796cf5622 Mon Sep 17 00:00:00 2001 From: TechWithTy Date: Mon, 26 May 2025 17:35:19 -0600 Subject: [PATCH] cach cleanup --- api/__pycache__/_generated.cpython-312.pyc | Bin 4281 -> 0 bytes api/__pycache__/_schema.cpython-312.pyc | Bin 309 -> 0 bytes api/__pycache__/_types.cpython-312.pyc | Bin 30322 -> 0 bytes sdk/__pycache__/client.cpython-312.pyc | Bin 0 -> 936 bytes .../__pycache__/delete.cpython-312.pyc | Bin 0 -> 1105 bytes sdk/client.py | 6 +- typescript/api/_analytics/index.ts | 76 ------ typescript/api/_server/test.ts | 43 --- typescript/api/assistants/create.ts | 185 ------------- typescript/api/assistants/delete.ts | 27 -- typescript/api/assistants/get.ts | 73 ------ typescript/api/assistants/list.ts | 124 --------- typescript/api/assistants/update.ts | 77 ------ typescript/api/calls/create.ts | 247 ------------------ typescript/api/calls/delete.ts | 52 ---- typescript/api/calls/get.ts | 161 ------------ typescript/api/calls/list.ts | 107 -------- typescript/api/calls/update.ts | 74 ------ typescript/api/phoneNumbers/create.ts | 93 ------- typescript/api/phoneNumbers/delete.ts | 67 ----- typescript/api/phoneNumbers/get.ts | 64 ----- typescript/api/phoneNumbers/list.ts | 107 -------- typescript/api/phoneNumbers/update.ts | 92 ------- typescript/api/squad/create.ts | 189 -------------- typescript/api/squad/delete.ts | 75 ------ typescript/api/squad/get.ts | 53 ---- typescript/api/squad/list.ts | 70 ----- typescript/api/squad/update.ts | 113 -------- typescript/api/tools/create.ts | 104 -------- typescript/api/tools/delete.ts | 28 -- typescript/api/tools/get.ts | 77 ------ typescript/api/tools/list.ts | 59 ----- typescript/api/tools/update.ts | 77 ------ typescript/index.ts | 82 ------ typescript/syncCustomerVoice.ts | 42 --- typescript/utils/createSalesScript.ts | 25 -- 36 files changed, 4 insertions(+), 2665 deletions(-) delete mode 100644 api/__pycache__/_generated.cpython-312.pyc delete mode 100644 api/__pycache__/_schema.cpython-312.pyc delete mode 100644 api/__pycache__/_types.cpython-312.pyc create mode 100644 sdk/__pycache__/client.cpython-312.pyc create mode 100644 sdk/assistants/__pycache__/delete.cpython-312.pyc delete mode 100644 typescript/api/_analytics/index.ts delete mode 100644 typescript/api/_server/test.ts delete mode 100644 typescript/api/assistants/create.ts delete mode 100644 typescript/api/assistants/delete.ts delete mode 100644 typescript/api/assistants/get.ts delete mode 100644 typescript/api/assistants/list.ts delete mode 100644 typescript/api/assistants/update.ts delete mode 100644 typescript/api/calls/create.ts delete mode 100644 typescript/api/calls/delete.ts delete mode 100644 typescript/api/calls/get.ts delete mode 100644 typescript/api/calls/list.ts delete mode 100644 typescript/api/calls/update.ts delete mode 100644 typescript/api/phoneNumbers/create.ts delete mode 100644 typescript/api/phoneNumbers/delete.ts delete mode 100644 typescript/api/phoneNumbers/get.ts delete mode 100644 typescript/api/phoneNumbers/list.ts delete mode 100644 typescript/api/phoneNumbers/update.ts delete mode 100644 typescript/api/squad/create.ts delete mode 100644 typescript/api/squad/delete.ts delete mode 100644 typescript/api/squad/get.ts delete mode 100644 typescript/api/squad/list.ts delete mode 100644 typescript/api/squad/update.ts delete mode 100644 typescript/api/tools/create.ts delete mode 100644 typescript/api/tools/delete.ts delete mode 100644 typescript/api/tools/get.ts delete mode 100644 typescript/api/tools/list.ts delete mode 100644 typescript/api/tools/update.ts delete mode 100644 typescript/index.ts delete mode 100644 typescript/syncCustomerVoice.ts delete mode 100644 typescript/utils/createSalesScript.ts diff --git a/api/__pycache__/_generated.cpython-312.pyc b/api/__pycache__/_generated.cpython-312.pyc deleted file mode 100644 index 291c3ac67e951ca7a6a4f9d8bc90bb34aa86cc78..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 4281 zcmb7HZ%kX)6~FI2|Nl#D42F>K2sD5b+^{TZAW%xM69`Gj2!!B}d5+%$Z2WKUJqPTX zg>IEbRHhJh8j-q4srI3+(rJ;l4}6TeRExAPc3`vnO1D+bq~#kVk+P;=cJ8wu_L^1d zuJ!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r}-yKVJ|x*inIG9yK=$~=;Q?iBiVSpDVndF+iB|K81S@b8HuO!W7sl?wuPdx1in&MVk@lgQ5jEVSgso5 z;8C;+tEQ%qRe-Ljs220K-%QTyMs}JmZTv>O#O;OhopR1sZ1%Im_{m4M|2(#nVE+P8 CmRe^3 diff --git a/api/__pycache__/_types.cpython-312.pyc b/api/__pycache__/_types.cpython-312.pyc deleted file mode 100644 index 26e578f03cff8b97d9c275797e0f3d222d727c64..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 30322 zcmcgV%Z?mJa>Iv2ijUzud)_Z{_!vGVQIfT?*Ne4m>}9@+0fUp8=U=IsNL}o<3dxjS;7GhUKWMpJyWMpP!WX^xy zzI|f`{`aT~=HD*8nz=mltC`-V-_GYRnxioijH!DL9qc4KIV!GfXqZc@}|D4JD@U|GMeCgbezEGye$h!ksHsjM!V z$$;9u>Z98Ha6m0y$w%#RU5(3b)~$1?vfZRX^MhvT7K`>zBz%s!=lU+<(Rf9%E z+cfC*xE!67qdxZAQQ60;K#yllHy=P>IwH&qTYl7B$Lr3vgxAg7WZdOTMzhynBNEKk8)-{uj}A)9CD7 zQPZH=Gc?^n37s9b&#J`;YMQ@qahNo1HOz`pZ(NmNH_+mGqO5AiP#u*uj3li_G8nHd z$5nNbf!<*RL%SO4j8#*f&`0H5dO&{d~JU4!c&+J_N%RGm*RLMV!T z5~EJ3I4VO-*#|MMafNQiNJSe_@tUFr&2ZP4F18FwRF`>{8Lf_dHTLe~m@tGL=H(#k z6>UNNjkK1jjPrgu%G;uco@-oiRnsg;JOb4#(h0qZ3H-MBFuPLP$OYx7=>=* zp(+_7l~1;NlVpkz24XbhqUav`UA?br3XvI1gZ&Ap0fn7aRHEd0>pLsSL3LaZIF1R; zTX)c#RYymn##`V9Kn!s0q(AuzO?AWI-juB>lfg_v1rJilkk9O4B|Zx4+=1`otebXl zvwqJXp1~63xEd81v`V}0M?Nq+0@1LwFa#QKn6hG64=BOww-fSM8;EPlG4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LJuMVXWVU5;>GIw?wC@4Y)O-#RVdJ+IFGm}m_&G^O_es_2(FP@FlN zxqnueKQC8%jpRVH6ql1H2qMw;J+6e~O5_;%VVskVsJEX`O31}pD29Z%YRo5;8xy-K zJns0U>(VFurc9_m6xOBdYY@U;!2Ah{7t^;7*N?V7ZJo|7e4l=J3aS?+y_fIj5HyZA XBu{93-W;f@Un;<zLF~F3Lxrw z8=#M|&N{JjNZL+a8W| zN_dU>ZW|{?lPp#7+gTH46{G?0oF?}#!9_SH!T(!x$qWD4Uj%Pp!t(|=0l1zVo&@yZ zlETwTjFm;@1$e0>*$~VCtS%{!l)BpbF2DuwK%D^#Fqe85Wsq2TQX!lm$48xqp&Il2 z65?foZableZseziGjZ|+EwQoKlck*kp#&OYoaV;RO;L0ukAh-c-pN2bKsdgsjdVTM z?H{m2^E=pc`P~)}B`gelMo^Ik)fjN%+7;v#5v#c_VXRoIoI%rpPf#Gp(glx^;h3H1 znd0GxhbJiwXzOD6q7I!gG@a9^6g$dvHd&;%C`ReY2QG*o)}!8*Yj+N5pWr7S z$fkr@2F zPdCmtPHglHe>To;n)`k?HF2=ZvI6hPsUgrvPo&j%JrgPQeM%E9m2)_qGa{YWL!ma6 z3eg^EVxd(rAW=$oH|7=@Nq1j^9gzfRuQ0pD#cF_S6*5i_ictP>*acylDui$g^lyQq sP2GgqS0hazK8?}0`Pbt+(*1E9WU|i&mi2F4{cHJ8UB@09^nj@R12d{7IsgCw literal 0 HcmV?d00001 diff --git a/sdk/client.py b/sdk/client.py index d83854d..5cf0246 100644 --- a/sdk/client.py +++ b/sdk/client.py @@ -1,3 +1,5 @@ +import asyncio + from vapi import AsyncVapi import os @@ -8,10 +10,10 @@ def initialize_client(token: str) -> None: global _client - _client = Vapi(token=token) + _client = AsyncVapi(token=token) -def get_client() -> Vapi: +def get_client() -> AsyncVapi: global _client if _client is None: if VAPI_PRIVATE_TOKEN is None: diff --git a/typescript/api/_analytics/index.ts b/typescript/api/_analytics/index.ts deleted file mode 100644 index 07163a6..0000000 --- a/typescript/api/_analytics/index.ts +++ /dev/null @@ -1,76 +0,0 @@ -import { AnalyticsResponse } from '@/types/vapiAi/api/_analytics'; - -const options = { - method: 'POST', - headers: { - Authorization: 'Bearer ', - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - queries: [ - { - table: 'call', - groupBy: ['assistantId', 'endedReason'], - name: 'callAnalyticsQuery', - timeRange: { - step: 'day', - start: '2023-01-01T00:00:00Z', - end: '2023-01-31T23:59:59Z', - timezone: 'UTC' - }, - operations: [ - { operation: 'sum', column: 'duration', alias: 'sumDuration' }, - { operation: 'avg', column: 'cost', alias: 'avgCost' } - ] - } - ] - }) -}; - -fetch('https://api.vapi.ai/analytics', options) - .then((response) => response.json()) - .then((data: AnalyticsResponse) => { - console.log(data); - data.data.forEach((queryResult) => { - console.log('Query Name:', queryResult.name); - console.log('Time Range:', queryResult.timeRange); - queryResult.result.forEach((result) => { - console.log('Date:', result.date); - console.log('Assistant ID:', result.assistantId); - console.log('Ended Reason:', result.endedReason); - console.log('Sum Duration:', result.sumDuration); - console.log('Avg Cost:', result.avgCost); - }); - }); - }) - .catch((err) => console.error(err)); - -export const exampleAnalyticsQuery = { - data: [ - { - name: 'callAnalyticsQuery', - timeRange: { - step: 'day', - start: '2023-01-01T00:00:00Z', - end: '2023-01-31T23:59:59Z', - timezone: 'UTC' - }, - result: [ - { - date: '2023-01-01', - assistantId: '123', - endedReason: 'customer-ended-call', - sumDuration: 120, - avgCost: 10.5 - }, - { - date: '2023-01-02', - assistantId: '123', - endedReason: 'customer-did-not-give-microphone-permission', - sumDuration: 0, - avgCost: 0 - } - ] - } - ] -}; diff --git a/typescript/api/_server/test.ts b/typescript/api/_server/test.ts deleted file mode 100644 index e8fe570..0000000 --- a/typescript/api/_server/test.ts +++ /dev/null @@ -1,43 +0,0 @@ -const options = { - method: 'POST', - headers: { - Authorization: 'Bearer ', - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - message: { - type: 'assistant-request', - assistant: { - // Fill in the relevant assistant details here - id: 'assistant-123', - name: 'Assistant Name' - }, - phoneNumber: { - // Fill in the relevant phone number details here - id: 'phone-123', - number: '+14155551234' - }, - customer: { - // Fill in the relevant customer details here - id: 'customer-123', - name: 'John Doe' - }, - call: { - // Fill in the call object details here - id: 'call-123', - status: 'in-progress' - }, - artifact: { - // Add live artifacts of the call here (transcriptions, recordings, etc.) - recording: 'https://example.com/recording.mp3', - transcription: 'Hello, how can I help you?' - }, - timestamp: new Date().toISOString() // Current timestamp - } - }) -}; - -fetch('https://your-server-url.com/vapi/message', options) - .then((response) => response.json()) - .then((data) => console.log('Server response:', data)) - .catch((error) => console.error('Error:', error)); diff --git a/typescript/api/assistants/create.ts b/typescript/api/assistants/create.ts deleted file mode 100644 index 3ec910e..0000000 --- a/typescript/api/assistants/create.ts +++ /dev/null @@ -1,185 +0,0 @@ -import fetch from 'node-fetch'; - -const VAPI_URL = 'https://api.vapi.ai/assistant'; -const VAPI_API_KEY = ''; // Replace with your actual API key - -// Function to create an assistant -async function createAssistant(payload: CreateAssistantRequest): Promise { - const response = await fetch(VAPI_URL, { - method: 'POST', - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(payload) - }); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error creating assistant: ${error}`); - } - - return await response.json(); -} - -// Example payload to create an assistant -export const exampleCreateAssistantPayload: CreateAssistantRequest = { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: false, - keywords: ['example', 'test'], - endpointing: 255 - }, - model: { - messages: [ - { - content: 'Hello, how may I assist you today?', - role: 'assistant' // Role is required here - } - ], - tools: [ - { - async: false, - messages: [ - { - type: 'request-start', - content: 'Starting tool...', - role: 'assistant', // Add the role to avoid TypeScript errors - conditions: [ - { - value: 'start', - operator: 'eq', - param: 'status' - } - ] - } - ], - type: 'dtmf', - function: { - name: 'ProcessPayment', - description: 'This function processes payments.', - parameters: { - type: 'object', - properties: {}, - required: ['amount'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://example.com/process-payment', - secret: 'my-secret' - } - } - ], - toolIds: ['tool-123'], - provider: 'anyscale', - model: 'gpt-3', - temperature: 1, - knowledgeBase: { - provider: 'canonical', - topK: 5, - fileIds: ['file-123'] - }, - maxTokens: 500, - emotionRecognitionEnabled: true, - numFastTurns: 1 - }, - voice: { - fillerInjectionEnabled: false, - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - chunkPlan: { - enabled: true, - minCharacters: 30, - punctuationBoundaries: ['.', '!', '?'], - formatPlan: { - enabled: true, - numberToDigitsCutoff: 2025 - } - } - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - clientMessages: ['conversation-update', 'function-call'], - serverMessages: ['conversation-update', 'end-of-call-report'], - silenceTimeoutSeconds: 30, - maxDurationSeconds: 600, - backgroundSound: 'office', - backchannelingEnabled: false, - backgroundDenoisingEnabled: false, - modelOutputInMessagesEnabled: false, - transportConfigurations: [ - { - provider: 'twilio', - timeout: 60, - record: false, - recordingChannels: 'mono' - } - ], - name: 'Test Assistant', - firstMessage: 'Hello! How can I assist you today?', - voicemailDetection: { - provider: 'twilio', - voicemailDetectionTypes: ['machine_end_beep'], - enabled: true, - machineDetectionTimeout: 31, - machineDetectionSpeechThreshold: 3500, - machineDetectionSpeechEndThreshold: 2750, - machineDetectionSilenceTimeout: 6000 - }, - voicemailMessage: 'Please leave a message after the beep.', - endCallMessage: 'Thank you for calling, goodbye!', - endCallPhrases: ['goodbye', 'bye'], - metadata: {}, - serverUrl: 'https://example.com/server-url', - serverUrlSecret: 'my-server-secret', - analysisPlan: { - summaryPrompt: 'Summarize the conversation.', - summaryRequestTimeoutSeconds: 10, - structuredDataRequestTimeoutSeconds: 10, - successEvaluationPrompt: 'Was this successful?', - successEvaluationRubric: 'NumericScale', - successEvaluationRequestTimeoutSeconds: 10, - structuredDataPrompt: 'Provide structured data.', - structuredDataSchema: { - type: 'string', - items: {}, - properties: {}, - description: 'Schema description', - required: ['requiredField'] - } - }, - artifactPlan: { - videoRecordingEnabled: true, - recordingS3PathPrefix: 's3://my-recordings/' - }, - messagePlan: { - idleMessages: ['Please hold.'], - idleMessageMaxSpokenCount: 5, - idleTimeoutSeconds: 20 - }, - startSpeakingPlan: { - waitSeconds: 0.4, - smartEndpointingEnabled: false, - transcriptionEndpointingPlan: { - onPunctuationSeconds: 0.1, - onNoPunctuationSeconds: 1.5, - onNumberSeconds: 0.5 - } - }, - stopSpeakingPlan: { - numWords: 0, - voiceSeconds: 0.2, - backoffSeconds: 1 - }, - credentialIds: ['credential-123'] -}; - -// // Call the function to create the assistant -// createAssistant(exampleCreateAssistantPayload) -// .then((response) => console.log('Assistant Created:', response)) -// .catch((error) => console.error('Error:', error)); diff --git a/typescript/api/assistants/delete.ts b/typescript/api/assistants/delete.ts deleted file mode 100644 index dc60758..0000000 --- a/typescript/api/assistants/delete.ts +++ /dev/null @@ -1,27 +0,0 @@ -import fetch from 'node-fetch'; - -// Function to delete an assistant by ID -async function deleteAssistantById(assistantId: string): Promise { - const VAPI_URL = `https://api.vapi.ai/assistant/${assistantId}`; - const VAPI_API_KEY = ''; // Replace with your actual API key - - const response = await fetch(VAPI_URL, { - method: 'DELETE', - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - } - }); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error deleting assistant: ${error}`); - } - - console.log(`Assistant with ID ${assistantId} deleted successfully.`); -} - -// Example usage -deleteAssistantById('assistant-id-123') - .then(() => console.log('Delete complete')) - .catch((error) => console.error('Error:', error)); diff --git a/typescript/api/assistants/get.ts b/typescript/api/assistants/get.ts deleted file mode 100644 index dc272b0..0000000 --- a/typescript/api/assistants/get.ts +++ /dev/null @@ -1,73 +0,0 @@ -import { AssistantResponse } from '@/types/vapiAi/api/assistant/get'; - -// Function to get an assistant by ID -async function getAssistantById( - assistantId: string -): Promise { - const VAPI_URL = `https://api.vapi.ai/assistant/${assistantId}`; - const VAPI_API_KEY = ''; // Replace with your actual API key - - const response = await fetch(VAPI_URL, { - method: 'GET', - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - } - }); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error fetching assistant: ${error}`); - } - - const assistant: AssistantResponse = await response.json(); - return assistant; -} - -// Example usage -getAssistantById('assistant-id-123') - .then((assistant) => console.log('Assistant fetched:', assistant)) - .catch((error) => console.error('Error:', error)); - -export const exampleGetResponseData = { - id: 'assistant-id-123', - name: 'Customer Support Assistant', - status: 'active', - createdAt: '2023-01-01T12:00:00Z', - updatedAt: '2023-09-01T15:00:00Z', - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: true, - keywords: ['support', 'account'], - endpointing: 250 - }, - model: { - provider: 'openai', - model: 'gpt-4', - temperature: 0.8, - maxTokens: 1024, - emotionRecognitionEnabled: true, - numFastTurns: 2 - }, - voice: { - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - fillerInjectionEnabled: false - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - backgroundSound: 'office', - backchannelingEnabled: false, - silenceTimeoutSeconds: 30, - maxDurationSeconds: 3600, - assistantOverrides: { - model: { - temperature: 0.7, - maxTokens: 512 - } - } -}; diff --git a/typescript/api/assistants/list.ts b/typescript/api/assistants/list.ts deleted file mode 100644 index 0af1ee6..0000000 --- a/typescript/api/assistants/list.ts +++ /dev/null @@ -1,124 +0,0 @@ -import fetch from 'node-fetch'; -import { ListAssistantsResponse } from '@/types/vapiAi/api/assistant/list'; - -// Function to list assistants with optional query parameters -async function listAssistants( - limit: number = 100, // Default limit - createdAtGt?: string, // Optional: created after this date - createdAtLt?: string, // Optional: created before this date - updatedAtGt?: string, // Optional: updated after this date - updatedAtLt?: string // Optional: updated before this date -): Promise { - const VAPI_URL = 'https://api.vapi.ai/assistant'; - const VAPI_API_KEY = ''; // Replace with your actual API key - - // Construct query parameters - const queryParams = new URLSearchParams(); - queryParams.append('limit', limit.toString()); - if (createdAtGt) queryParams.append('createdAtGt', createdAtGt); - if (createdAtLt) queryParams.append('createdAtLt', createdAtLt); - if (updatedAtGt) queryParams.append('updatedAtGt', updatedAtGt); - if (updatedAtLt) queryParams.append('updatedAtLt', updatedAtLt); - - const response = await fetch(`${VAPI_URL}?${queryParams.toString()}`, { - method: 'GET', - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - } - }); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error listing assistants: ${error}`); - } - - // Cast the result of json() to ListAssistantsResponse - const assistantsList = (await response.json()) as ListAssistantsResponse; - - return assistantsList; -} - -// Example usage -listAssistants(50, '2023-01-01T00:00:00Z', undefined, '2023-12-31T23:59:59Z') - .then((response) => console.log('Assistants:', response)) - .catch((error) => console.error('Error:', error)); - -export const exampleListAssistantsResponse = { - assistants: [ - { - id: 'assistant-id-001', - name: 'Customer Support Assistant', - status: 'active', - createdAt: '2023-01-01T12:00:00Z', - updatedAt: '2023-06-01T15:00:00Z', - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: true, - keywords: ['support', 'account'], - endpointing: 250 - }, - model: { - provider: 'openai', - model: 'gpt-4', - temperature: 0.8, - maxTokens: 1024, - emotionRecognitionEnabled: true, - numFastTurns: 2 - }, - voice: { - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - fillerInjectionEnabled: false - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - backgroundSound: 'office', - backchannelingEnabled: false, - silenceTimeoutSeconds: 30, - maxDurationSeconds: 3600 - }, - { - id: 'assistant-id-002', - name: 'Technical Support Bot', - status: 'inactive', - createdAt: '2023-02-15T12:00:00Z', - updatedAt: '2023-07-01T15:00:00Z', - transcriber: { - provider: 'azure', - model: 'neural-en', - language: 'en', - smartFormat: false, - keywords: ['error', 'bug'], - endpointing: 200 - }, - model: { - provider: 'azure', - model: 'gpt-3', - temperature: 0.7, - maxTokens: 800, - emotionRecognitionEnabled: false, - numFastTurns: 1 - }, - voice: { - provider: 'google', - voiceId: 'samantha', - speed: 1.0, - fillerInjectionEnabled: true - }, - firstMessageMode: 'assistant-waits-for-user', - recordingEnabled: false, - hipaaEnabled: true, - backgroundSound: 'off', - backchannelingEnabled: true, - silenceTimeoutSeconds: 60, - maxDurationSeconds: 1800 - } - // More assistant objects... - ], - totalCount: 2 -}; diff --git a/typescript/api/assistants/update.ts b/typescript/api/assistants/update.ts deleted file mode 100644 index b43069c..0000000 --- a/typescript/api/assistants/update.ts +++ /dev/null @@ -1,77 +0,0 @@ -import fetch from 'node-fetch'; // Or node-fetch version 3, or axios if preferred -import { UpdateAssistantRequest } from '@/types/vapiAi/api/assistant/update'; // The extended type - -// Function to update an assistant by ID -async function updateAssistantById( - assistantId: string, - updateData: UpdateAssistantRequest -): Promise { - const VAPI_URL = `https://api.vapi.ai/assistant/${assistantId}`; - const VAPI_API_KEY = ''; // Replace with your actual API key - - const response = await fetch(VAPI_URL, { - method: 'PATCH', - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(updateData) - }); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error updating assistant: ${error}`); - } - - const updatedAssistant = await response.json(); - console.log('Assistant updated successfully:', updatedAssistant); -} - -// Example usage -const updateData: UpdateAssistantRequest = { - name: 'Updated Assistant Name', - model: { - temperature: 0.8 // Updating just the temperature field - } -}; - -updateAssistantById('assistant-id-123', updateData) - .then(() => console.log('Update complete')) - .catch((error) => console.error('Error:', error)); - -export const exampleUpdatedAssistantResponse = { - id: 'assistant-id-123', - name: 'Updated Assistant Name', - status: 'active', - createdAt: '2023-01-01T12:00:00Z', - updatedAt: '2023-09-08T10:00:00Z', - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: true, - keywords: ['support', 'account'], - endpointing: 250 - }, - model: { - provider: 'openai', - model: 'gpt-4', - temperature: 0.8, // Updated field - maxTokens: 1024, - emotionRecognitionEnabled: true, - numFastTurns: 2 - }, - voice: { - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - fillerInjectionEnabled: false - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - backgroundSound: 'office', - backchannelingEnabled: false, - silenceTimeoutSeconds: 30, - maxDurationSeconds: 3600 -}; diff --git a/typescript/api/calls/create.ts b/typescript/api/calls/create.ts deleted file mode 100644 index 05f5a1e..0000000 --- a/typescript/api/calls/create.ts +++ /dev/null @@ -1,247 +0,0 @@ -import { - CreateCallRequest, - MessageRole, - ToolMessageType -} from '@/types/vapiAi/api/calls/create'; - -// API call to create a call -async function createCall( - apiUrl: string, - apiKey: string, - callRequestData: CreateCallRequest -) { - const options = { - method: 'POST', - headers: { - Authorization: `Bearer ${apiKey}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(callRequestData) - }; - - try { - const response = await fetch(apiUrl, options); - - if (!response.ok) { - // Handle non-200 responses - const errorText = await response.text(); - throw new Error(`Error creating call: ${errorText}`); - } - - // Parse the JSON response - const responseData = await response.json(); - console.log('Call created successfully:', responseData); - - return responseData; // Return the response data if needed - } catch (error) { - console.error('Error:', error); - throw error; // Re-throw the error if needed for further handling - } -} - -// Example usage of the createCall function -const apiUrl = 'https://api.vapi.ai/call'; -const apiKey = ''; // Replace with your actual API key - -const callRequestData: CreateCallRequest = { - name: 'Test Call', - assistantId: 'assistant-123', - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'bg', - smartFormat: false, - keywords: ['test'], - endpointing: 255 - }, - model: { - messages: [ - { - role: 'user', - message: 'Hello, how can I help?', - time: Date.now(), - secondsFromStart: 5, - endTime: Date.now() + 1000, - duration: 1 - } - ], - tools: [ - { - async: false, - messages: [ - { - type: ToolMessageType.ToolMessageStart, - content: 'Processing your request, please wait...', - role: MessageRole.Assistant - } - ], - type: 'dtmf', - function: { - name: 'DTMF Tool', - description: 'Tool for DTMF detection', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://tool.server.url', - secret: 'secretKey' - } - } - ], - toolIds: ['tool-1'], - provider: 'anyscale', - model: 'model-1', - temperature: 1, - maxTokens: 525, - emotionRecognitionEnabled: true, - numFastTurns: 1 - }, - voice: { - fillerInjectionEnabled: false, - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - chunkPlan: { - enabled: true, - minCharacters: 30, - punctuationBoundaries: ['.', ',', '!', '?'], - formatPlan: { - enabled: true, - numberToDigitsCutoff: 2025 - } - } - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - clientMessages: ['conversation-update', 'function-call'], - serverMessages: ['conversation-update', 'end-of-call-report'], - silenceTimeoutSeconds: 30, - maxDurationSeconds: 600, - backgroundSound: 'office', - backchannelingEnabled: false, - backgroundDenoisingEnabled: false - }, - phoneNumberId: 'phone-number-123', - customerId: 'customer-123' -}; - -// Call the function -createCall(apiUrl, apiKey, callRequestData) - .then((response) => console.log('Call Response:', response)) - .catch((error) => console.error('Call Error:', error)); - -export const exampleCreateCallResponse = { - id: 'call-id-001', // Unique identifier for the call - name: 'Test Call', - assistantId: 'assistant-123', - squadId: null, - phoneNumberId: 'phone-number-123', - customerId: 'customer-123', - status: 'queued', // Initial status of the call - endedReason: null, // Not ended yet - type: 'outboundPhoneCall', - phoneCallProvider: 'twilio', - phoneCallTransport: 'pstn', - createdAt: '2024-09-08T12:00:00Z', - updatedAt: '2024-09-08T12:01:00Z', - startedAt: null, // Call hasn't started yet - endedAt: null, // Call hasn't ended yet - cost: 0.0, // Cost will be calculated after the call - messages: [ - { - content: 'Hello!', - role: 'assistant' // Initial assistant message - } - ], - recordingUrl: null, // Recording will be available after the call - stereoRecordingUrl: null, - transcript: null, // Transcript will be generated after the call - artifact: { - videoRecordingEnabled: true, - recordingS3PathPrefix: 's3://recordings/call-id-001' - }, - analysis: { - summary: null, - structuredData: {}, - successEvaluation: null - }, - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'bg', - smartFormat: false, - keywords: ['test'], - endpointing: 255 - }, - model: { - messages: [{ content: 'Hello!', role: 'assistant' }], - tools: [ - { - async: false, - messages: [ - { - type: 'request-start', - content: 'Tool started', - role: 'assistant', - conditions: [{ value: 'start', operator: 'eq', param: 'trigger' }] - } - ], - type: 'dtmf', - function: { - name: 'DTMF Tool', - description: 'Tool for DTMF detection', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://tool.server.url', - secret: 'secretKey' - } - } - ], - toolIds: ['tool-1'], - provider: 'anyscale', - model: 'model-1', - temperature: 1, - maxTokens: 525, - emotionRecognitionEnabled: true, - numFastTurns: 1 - }, - voice: { - fillerInjectionEnabled: false, - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - chunkPlan: { - enabled: true, - minCharacters: 30, - punctuationBoundaries: ['.', ',', '!', '?'], - formatPlan: { - enabled: true, - numberToDigitsCutoff: 2025 - } - } - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - clientMessages: ['conversation-update', 'function-call'], - serverMessages: ['conversation-update', 'end-of-call-report'], - silenceTimeoutSeconds: 30, - maxDurationSeconds: 600, - backgroundSound: 'office', - backchannelingEnabled: false, - backgroundDenoisingEnabled: false - } -}; diff --git a/typescript/api/calls/delete.ts b/typescript/api/calls/delete.ts deleted file mode 100644 index bdb6a80..0000000 --- a/typescript/api/calls/delete.ts +++ /dev/null @@ -1,52 +0,0 @@ -// Import necessary types -import { DeleteCallResponse } from '@/types/vapiAi/api/calls/delete'; - -// Function to delete a call by ID -async function deleteCallById( - callId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/call/${callId}`; - - const options = { - method: 'DELETE', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error deleting call: ${error}`); - } - - const deleteCallData: DeleteCallResponse = await response.json(); - return deleteCallData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -const callId = 'call-id-123'; - -deleteCallById(callId, token) - .then((deletedCall) => console.log('Deleted Call:', deletedCall)) - .catch((err) => console.error('Error deleting call:', err)); - -export const exampleDeleteResponse = { - id: 'call-id-123', - status: 'ended', - endedReason: 'manually-canceled', - type: 'inboundPhoneCall', - phoneCallProvider: 'twilio', - messages: [], - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:30:00Z' -}; diff --git a/typescript/api/calls/get.ts b/typescript/api/calls/get.ts deleted file mode 100644 index 51058f2..0000000 --- a/typescript/api/calls/get.ts +++ /dev/null @@ -1,161 +0,0 @@ -// Import or declare types -import { GetCallResponse } from '@/types/vapiAi/api/calls/get'; - -// Function to fetch call details by ID -async function getCallById( - callId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/call/${callId}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error fetching call: ${error}`); - } - - const callData: GetCallResponse = await response.json(); - return callData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -getCallById('call-id-123', token) - .then((call) => console.log('Call details:', call)) - .catch((err) => console.error('Error fetching call:', err)); - -// Example payload -export const exampleCallResponse: GetCallResponse = { - id: 'call-id-123', - orgId: 'org-id-456', - type: 'inboundPhoneCall', - phoneCallProvider: 'twilio', - phoneCallTransport: 'sip', - status: 'ended', - endedReason: 'assistant-error', - monitor: { - listenUrl: 'https://example.com/listen', - controlUrl: 'https://example.com/control' - }, - messages: [ - { - role: 'user', - message: 'Hello, how can I help?', - time: Date.now(), - secondsFromStart: 5, - endTime: Date.now() + 1000, - duration: 1 - } - ], - destination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+1234567890', - extension: '123', - message: 'Transfer to support', - description: 'Call transferred to support team' - }, - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:05:00Z', - startedAt: '2023-09-07T12:01:00Z', - endedAt: '2023-09-07T12:04:30Z', - cost: 5.0, - costBreakdown: { - transport: 1.5, - stt: 1.0, - llm: 0.5, - tts: 0.8, - vapi: 1.2, - total: 5.0, - llmPromptTokens: 100, - llmCompletionTokens: 80, - ttsCharacters: 500 - }, - transcript: 'Transcript of the call goes here...', - recordingUrl: 'https://example.com/recording.mp3', - stereoRecordingUrl: 'https://example.com/stereo-recording.mp3', - artifact: { - videoRecordingEnabled: true, - recordingS3PathPrefix: 's3://recordings/call-id-123' - }, - analysis: { - summary: 'The call ended abruptly due to an error.', - structuredData: {}, - successEvaluation: 'unsuccessful' - }, - assistantId: 'assistant-id-789', - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: false, - keywords: ['support', 'account'], - endpointing: 255 - }, - model: { - messages: [ - { - role: 'user', - message: 'Hello, how can I help?', - time: Date.now(), - secondsFromStart: 5, - endTime: Date.now() + 1000, - duration: 1 - } - ], - tools: [], - toolIds: [], - provider: 'anyscale', - model: 'gpt-4', - temperature: 0.8, - knowledgeBase: { - provider: 'canonical', - topK: 5, - fileIds: ['file-id-001'] - }, - maxTokens: 500, - emotionRecognitionEnabled: true, - numFastTurns: 2 - }, - voice: { - fillerInjectionEnabled: false, - provider: 'azure', - voiceId: 'andrew', - speed: 1.25, - chunkPlan: { - enabled: true, - minCharacters: 30, - punctuationBoundaries: ['.', '?', '!'], - formatPlan: { - enabled: true, - numberToDigitsCutoff: 2025 - } - } - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - clientMessages: ['conversation-update', 'function-call'], - serverMessages: ['conversation-update', 'end-of-call-report'], - silenceTimeoutSeconds: 30, - maxDurationSeconds: 600, - backgroundSound: 'office', - backchannelingEnabled: false, - backgroundDenoisingEnabled: true - } -}; diff --git a/typescript/api/calls/list.ts b/typescript/api/calls/list.ts deleted file mode 100644 index a1723ea..0000000 --- a/typescript/api/calls/list.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { - ListCallsQueryParams, - ListCallsResponse -} from '@/types/vapiAi/api/calls/list'; - -// Function to fetch list of calls with query parameters -async function listCalls( - token: string, - params: ListCallsQueryParams = {} -): Promise { - const queryParams = new URLSearchParams(params as any).toString(); // Convert params to query string - const url = `https://api.vapi.ai/call?${queryParams}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error fetching call list: ${error}`); - } - - const callListData: ListCallsResponse = await response.json(); - return callListData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -const queryParams: ListCallsQueryParams = { - limit: 10, - assistantId: 'assistant-id-123', - createdAtGt: '2023-01-01T00:00:00Z' -}; - -listCalls(token, queryParams) - .then((callList) => console.log('Call list:', callList)) - .catch((err) => console.error('Error fetching call list:', err)); - -export const exampleListCallsResponse: ListCallsResponse = { - calls: [ - { - id: 'call-id-001', - orgId: 'org-id-001', - type: 'inboundPhoneCall', - monitor: { - listenUrl: 'https://example.com/listen', - controlUrl: 'https://example.com/control' - }, - phoneCallProvider: 'twilio', - phoneCallTransport: 'sip', - status: 'ended', - endedReason: 'assistant-error', - messages: [ - { - role: 'user', - message: 'Hello, how can I help?', - time: Date.now(), - secondsFromStart: 5, - endTime: Date.now() + 1000, - duration: 1 - } - ], - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:05:00Z', - startedAt: '2023-09-07T12:01:00Z', - endedAt: '2023-09-07T12:04:30Z', - cost: 5.0, - costBreakdown: { - transport: 1.5, - stt: 1.0, - llm: 0.5, - tts: 0.8, - vapi: 1.2, - total: 5.0, - llmPromptTokens: 100, - llmCompletionTokens: 80, - ttsCharacters: 500 - }, - transcript: 'Transcript of the call goes here...', - recordingUrl: 'https://example.com/recording.mp3', - stereoRecordingUrl: 'https://example.com/stereo-recording.mp3', - artifact: { - videoRecordingEnabled: true, - recordingS3PathPrefix: 's3://recordings/call-id-001' - }, - analysis: { - summary: 'The call ended due to an error.', - structuredData: {}, - successEvaluation: 'unsuccessful' - }, - assistantId: 'assistant-id-001' - } - // More calls... - ], - totalCount: 20 // Optional total count of calls -}; diff --git a/typescript/api/calls/update.ts b/typescript/api/calls/update.ts deleted file mode 100644 index e55dcf0..0000000 --- a/typescript/api/calls/update.ts +++ /dev/null @@ -1,74 +0,0 @@ -import { - UpdateCallRequestBody, - UpdateCallResponse -} from '@/types/vapiAi/api/calls/update'; - -// Function to update the call by ID -async function updateCall( - callId: string, - token: string, - requestBody: UpdateCallRequestBody -): Promise { - const url = `https://api.vapi.ai/call/${callId}`; - - const options = { - method: 'PATCH', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(requestBody) - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error updating call: ${error}`); - } - - const updatedCallData: UpdateCallResponse = await response.json(); - return updatedCallData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -const callId = 'call-id-123'; // The ID of the call to update -const requestBody: UpdateCallRequestBody = { - name: 'Updated Call Name' // Updating the name of the call -}; - -updateCall(callId, token, requestBody) - .then((updatedCall) => console.log('Updated call:', updatedCall)) - .catch((err) => console.error('Error updating call:', err)); - -export const exampleUpdateCallResponse = { - id: 'call-id-123', - orgId: 'org-id-456', - type: 'outboundPhoneCall', - messages: [ - { - content: 'Hello, how can I help you?', - role: 'assistant' - }, - { - content: 'I need help with my account.', - role: 'user' - } - ], - status: 'ended', - endedReason: 'assistant-ended-call', - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:05:00Z', - startedAt: '2023-09-07T12:01:00Z', - endedAt: '2023-09-07T12:04:30Z', - cost: 5.0, - transcript: 'Transcript of the call goes here...', - recordingUrl: 'https://example.com/recording.mp3', - assistantId: 'assistant-id-001' -}; diff --git a/typescript/api/phoneNumbers/create.ts b/typescript/api/phoneNumbers/create.ts deleted file mode 100644 index aab919b..0000000 --- a/typescript/api/phoneNumbers/create.ts +++ /dev/null @@ -1,93 +0,0 @@ -import { - CreatePhoneNumberRequest, - CreatePhoneNumberResponse, - PhoneNumberProvider -} from '@/types/vapiAi/api/phoneNumbers/create'; -import fetch from 'node-fetch'; - -// API call to create a phone number -async function createPhoneNumber( - apiUrl: string, - apiKey: string, - phoneNumberRequestData: CreatePhoneNumberRequest -): Promise { - const options = { - method: 'POST', - headers: { - Authorization: `Bearer ${apiKey}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(phoneNumberRequestData) - }; - - try { - const response = await fetch(apiUrl, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error creating phone number: ${errorText}`); - } - - // Cast the JSON response to the expected type - const responseData = (await response.json()) as CreatePhoneNumberResponse; - console.log('Phone number created successfully:', responseData); - - return responseData; // Return the response data if needed - } catch (error) { - console.error('Error:', error); - throw error; // Re-throw the error if needed for further handling - } -} - -// Example usage of the createPhoneNumber function -const apiUrl = 'https://api.vapi.ai/phone-number'; -const apiKey = ''; // Replace with your actual API key - -const phoneNumberRequestData: CreatePhoneNumberRequest = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '123', - message: 'This is a fallback message.', - description: 'Fallback description.' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - number: '+14155551234', - credentialId: 'credential-id-123', - name: 'Test Phone Number', - assistantId: 'assistant-id-123', - squadId: 'squad-id-123', - serverUrl: 'https://server.url', - serverUrlSecret: 'server-secret-123' -}; - -// Call the function -createPhoneNumber(apiUrl, apiKey, phoneNumberRequestData) - .then((response) => console.log('Phone Number Response:', response)) - .catch((error) => console.error('Phone Number Error:', error)); - -export const exampleCreatePhoneNumberResponse: CreatePhoneNumberResponse = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '123', - message: 'This is a fallback message.', - description: 'Fallback description.' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-id-123', - orgId: 'org-id-123', - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:30:00Z', - name: 'Test Phone Number', - assistantId: 'assistant-id-123', - squadId: 'squad-id-123', - serverUrl: 'https://server.url', - serverUrlSecret: 'server-secret-123', - number: '+14155551234', - credentialId: 'credential-id-123' -}; diff --git a/typescript/api/phoneNumbers/delete.ts b/typescript/api/phoneNumbers/delete.ts deleted file mode 100644 index ab08579..0000000 --- a/typescript/api/phoneNumbers/delete.ts +++ /dev/null @@ -1,67 +0,0 @@ -import { PhoneNumberProvider } from '@/types/vapiAi/api/phoneNumbers/create'; -import { DeletePhoneNumberResponse } from '@/types/vapiAi/api/phoneNumbers/delete'; - -// Function to delete a phone number by ID -async function deletePhoneNumberById( - phoneNumberId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/phone-number/${phoneNumberId}`; - - const options = { - method: 'DELETE', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error deleting phone number: ${errorText}`); - } - - // Parse and return the response data - const responseData: DeletePhoneNumberResponse = - (await response.json()) as DeletePhoneNumberResponse; - return responseData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -deletePhoneNumberById('phone-number-id-123', token) - .then((deletedPhoneNumber) => - console.log('Deleted Phone Number:', deletedPhoneNumber) - ) - .catch((err) => console.error('Error deleting phone number:', err)); - -export const exampleDeletePhoneNumberResponse: DeletePhoneNumberResponse = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '123', - message: 'Backup destination in case of failure', - description: 'Test description for the fallback' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-id-123', - orgId: 'org-id-456', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - name: 'Main Office Line', - assistantId: 'assistant-id-789', - squadId: 'squad-id-321', - serverUrl: 'https://example.com/server-url', - serverUrlSecret: 'secret-key', - number: '+14155551234', - credentialId: 'credential-id-654' -}; diff --git a/typescript/api/phoneNumbers/get.ts b/typescript/api/phoneNumbers/get.ts deleted file mode 100644 index c8784d8..0000000 --- a/typescript/api/phoneNumbers/get.ts +++ /dev/null @@ -1,64 +0,0 @@ -import { PhoneNumberProvider } from '@/types/vapiAi/api/phoneNumbers/create'; -import { GetPhoneNumberResponse } from '@/types/vapiAi/api/phoneNumbers/get'; -import fetch from 'node-fetch'; - -// Function to fetch phone number details by ID -async function getPhoneNumberById( - phoneNumberId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/phone-number/${phoneNumberId}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error fetching phone number: ${errorText}`); - } - - const responseData = (await response.json()) as GetPhoneNumberResponse; // Type casting here - return responseData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -getPhoneNumberById('phone-number-id-123', token) - .then((phoneNumber) => console.log('Phone Number:', phoneNumber)) - .catch((error) => console.error('Error:', error)); - -export const exampleGetPhoneNumberResponse: GetPhoneNumberResponse = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '123', - message: 'Fallback message in case of failure.', - description: 'Fallback for missed calls.' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-id-123', - orgId: 'org-id-456', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - name: 'Test Phone Number', - assistantId: 'assistant-id-789', - squadId: 'squad-id-1011', - serverUrl: 'https://example.server.url', - serverUrlSecret: 'server-secret-123', - number: '+14155551234', - credentialId: 'credential-id-456' -}; diff --git a/typescript/api/phoneNumbers/list.ts b/typescript/api/phoneNumbers/list.ts deleted file mode 100644 index ce13d39..0000000 --- a/typescript/api/phoneNumbers/list.ts +++ /dev/null @@ -1,107 +0,0 @@ -import { PhoneNumberProvider } from '@/types/vapiAi/api/phoneNumbers/create'; -import { ListPhoneNumbersResponse } from '@/types/vapiAi/api/phoneNumbers/list'; -import fetch from 'node-fetch'; // Or node-fetch v3 or axios if preferred - -// Function to list phone numbers with optional query parameters -async function listPhoneNumbers( - token: string, - limit: number = 100, - createdAtGt?: string, - createdAtLt?: string, - updatedAtGt?: string, - updatedAtLt?: string -): Promise { - const url = new URL('https://api.vapi.ai/phone-number'); - - // Add query parameters if provided - url.searchParams.append('limit', limit.toString()); - if (createdAtGt) url.searchParams.append('createdAtGt', createdAtGt); - if (createdAtLt) url.searchParams.append('createdAtLt', createdAtLt); - if (updatedAtGt) url.searchParams.append('updatedAtGt', updatedAtGt); - if (updatedAtLt) url.searchParams.append('updatedAtLt', updatedAtLt); - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url.toString(), options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error listing phone numbers: ${errorText}`); - } - - // Cast the response to ListPhoneNumbersResponse - const responseData = (await response.json()) as ListPhoneNumbersResponse; - return responseData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -listPhoneNumbers( - token, - 50, - '2023-01-01T00:00:00Z', - undefined, - '2023-12-31T23:59:59Z' -) - .then((response) => console.log('Phone Numbers:', response)) - .catch((error) => console.error('Error:', error)); - -export const exampleListPhoneNumbersResponse: ListPhoneNumbersResponse = [ - { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '1234', - message: 'Fallback message', - description: 'Fallback description' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-123', - orgId: 'org-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - name: 'Test Phone Number', - assistantId: 'assistant-123', - squadId: 'squad-123', - serverUrl: 'https://my-server-url.com', - serverUrlSecret: 'my-server-secret', - number: '+14155551234', - credentialId: 'credential-123' - }, - { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155554321', - extension: '5678', - message: 'Fallback message', - description: 'Fallback description' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-456', - orgId: 'org-123', - createdAt: '2023-11-06T12:00:00Z', - updatedAt: '2023-11-06T12:30:00Z', - name: 'Secondary Phone Number', - assistantId: 'assistant-456', - squadId: 'squad-456', - serverUrl: 'https://my-other-server-url.com', - serverUrlSecret: 'my-other-server-secret', - number: '+14155554321', - credentialId: 'credential-456' - } -]; diff --git a/typescript/api/phoneNumbers/update.ts b/typescript/api/phoneNumbers/update.ts deleted file mode 100644 index 107fca3..0000000 --- a/typescript/api/phoneNumbers/update.ts +++ /dev/null @@ -1,92 +0,0 @@ -import { - CreatePhoneNumberRequest, - CreatePhoneNumberResponse, - PhoneNumberProvider -} from '@/types/vapiAi/api/phoneNumbers/create'; -import { UpdatePhoneNumberResponse } from '@/types/vapiAi/api/phoneNumbers/update'; - -// Function to create a phone number -async function createPhoneNumber( - token: string, - phoneNumberData: CreatePhoneNumberRequest -): Promise { - const url = `https://api.vapi.ai/phone-number`; - - const options = { - method: 'POST', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(phoneNumberData) - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error creating phone number: ${errorText}`); - } - - // Explicitly cast the response to CreatePhoneNumberResponse - const responseData: CreatePhoneNumberResponse = - (await response.json()) as CreatePhoneNumberResponse; - console.log('Phone number created successfully:', responseData); - - return responseData; - } catch (err) { - console.error('Error:', err); - throw err; - } -} - -// Example usage -const token = ''; -const phoneNumberData: CreatePhoneNumberRequest = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '123', - message: 'Test message', - description: 'Test description' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - number: '+14155551234', - credentialId: 'credential-123', - name: 'Test Phone Number', - assistantId: 'assistant-123', - squadId: 'squad-123', - serverUrl: 'https://example.com/server', - serverUrlSecret: 'server-secret' -}; - -createPhoneNumber(token, phoneNumberData) - .then((response) => console.log('Phone number response:', response)) - .catch((error) => console.error('Error:', error)); - -export const exampleUpdatePhoneNumberResponse: UpdatePhoneNumberResponse = { - fallbackDestination: { - type: 'number', - numberE164CheckEnabled: true, - number: '+14155551234', - extension: '1234', - message: 'Fallback message', - description: 'Fallback description' - }, - provider: PhoneNumberProvider.ByoPhoneNumber, // Correct - numberE164CheckEnabled: true, - id: 'phone-number-123', - orgId: 'org-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-08T05:31:56Z', // The updated timestamp - name: 'Updated Phone Number', - assistantId: 'assistant-123', - squadId: 'squad-123', - serverUrl: 'https://updated-server-url.com', - serverUrlSecret: 'updated-secret-key', - number: '+14155551234', - credentialId: 'credential-123' -}; diff --git a/typescript/api/squad/create.ts b/typescript/api/squad/create.ts deleted file mode 100644 index da58940..0000000 --- a/typescript/api/squad/create.ts +++ /dev/null @@ -1,189 +0,0 @@ -import { ToolMessageType, MessageRole } from '@/types/vapiAi/api/calls/create'; -import { CreateSquadRequest } from '@/types/vapiAi/api/squad/create'; - -async function createSquad( - apiUrl: string, - apiKey: string, - squadData: CreateSquadRequest -) { - const options = { - method: 'POST', - headers: { - Authorization: `Bearer ${apiKey}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(squadData) - }; - - try { - const response = await fetch(apiUrl, options); - - if (!response.ok) { - const error = await response.text(); - throw new Error(`Error creating squad: ${error}`); - } - - const createdSquad = await response.json(); - console.log('Squad created successfully:', createdSquad); - return createdSquad; - } catch (error) { - console.error('Error:', error); - throw error; - } -} - -// Example usage -const apiUrl = 'https://api.vapi.ai/squad'; -const apiKey = ''; // Replace with actual API key - -const squadData: CreateSquadRequest = { - name: 'My Squad', - members: [ - { - assistantId: 'assistant-123', - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en', - smartFormat: false, - keywords: ['support', 'help'], - endpointing: 255 - }, - model: { - messages: [ - { content: 'Hello, how can I assist you?', role: 'assistant' } - ], - tools: [ - { - async: false, - messages: [ - { - type: ToolMessageType.ToolMessageStart, - content: 'Processing your request, please wait...', - role: MessageRole.Assistant - } - ], - type: 'dtmf', - function: { - name: 'DTMF Tool', - description: 'Tool for DTMF detection', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://my-tool-url.com', - secret: 'mySecretKey' - } - } - ], - toolIds: ['tool-1'], - provider: 'anyscale', - model: 'gpt-4', - temperature: 0.7, - maxTokens: 1000, - emotionRecognitionEnabled: true, - numFastTurns: 1 - }, - voice: { - provider: 'azure', - voiceId: 'en-US-GuyNeural', - speed: 1.2, - chunkPlan: { - enabled: true, - minCharacters: 30, - punctuationBoundaries: ['.', ',', '?', '!', ';'], - formatPlan: { enabled: true, numberToDigitsCutoff: 2025 } - } - }, - firstMessageMode: 'assistant-speaks-first', - recordingEnabled: true, - hipaaEnabled: false, - clientMessages: ['conversation-update', 'function-call', 'transcript'], - serverMessages: ['conversation-update', 'end-of-call-report'], - silenceTimeoutSeconds: 30, - maxDurationSeconds: 600, - backgroundSound: 'office', - backchannelingEnabled: false, - backgroundDenoisingEnabled: true, - modelOutputInMessagesEnabled: false, - transportConfigurations: [ - { - provider: 'twilio', - timeout: 60, - record: false, - recordingChannels: 'mono' - } - ], - voicemailDetection: { - provider: 'twilio', - voicemailDetectionTypes: ['machine_end_beep', 'machine_end_silence'], - enabled: true, - machineDetectionTimeout: 30, // Timeout in seconds - machineDetectionSpeechThreshold: 3000, // Threshold in milliseconds - machineDetectionSpeechEndThreshold: 2500, // Added this field - machineDetectionSilenceTimeout: 5000 // Timeout in milliseconds - }, - voicemailMessage: - 'You have reached our voicemail, please leave a message after the beep.', - endCallMessage: 'Thank you for calling. Goodbye!', - endCallPhrases: ['Goodbye', 'Take care'], - serverUrl: 'https://my-server-url.com', - serverUrlSecret: 'serverSecret', - analysisPlan: { - summaryPrompt: 'Summarize the call in a few sentences.', - successEvaluationPrompt: 'Did the call meet the customer’s needs?', - successEvaluationRubric: 'NumericScale', // Could also be 'PassFail' - summaryRequestTimeoutSeconds: 10, // Timeout for summary request - structuredDataRequestTimeoutSeconds: 10, // Timeout for structured data request - successEvaluationRequestTimeoutSeconds: 10, // Timeout for success evaluation request - structuredDataPrompt: 'Provide structured data from the call.', // Missing structured data prompt - structuredDataSchema: { - type: 'object', - properties: {}, // Define the properties for structured data here - required: ['field1'] // Example required fields - } - }, - artifactPlan: { - videoRecordingEnabled: true, - recordingS3PathPrefix: 's3://my-bucket/recordings/' - }, - messagePlan: { - idleMessages: ['Are you still there?'], - idleMessageMaxSpokenCount: 3, - idleTimeoutSeconds: 20 - }, - startSpeakingPlan: { - waitSeconds: 1, - smartEndpointingEnabled: true, - transcriptionEndpointingPlan: { - onPunctuationSeconds: 0.1, - onNoPunctuationSeconds: 1.5, - onNumberSeconds: 0.5 - } - }, - stopSpeakingPlan: { numWords: 50, voiceSeconds: 1, backoffSeconds: 1 }, - credentialIds: ['credential-1'] - } - } - ], - membersOverrides: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'bg', - smartFormat: true, - keywords: ['override'], - endpointing: 300 - } - } -}; - -// Create the squad -createSquad(apiUrl, apiKey, squadData) - .then((response) => console.log('Squad Response:', response)) - .catch((error) => console.error('Error:', error)); diff --git a/typescript/api/squad/delete.ts b/typescript/api/squad/delete.ts deleted file mode 100644 index 3c71808..0000000 --- a/typescript/api/squad/delete.ts +++ /dev/null @@ -1,75 +0,0 @@ -// api/squads.ts -import { DeleteSquadResponse } from '@/types/vapiAi/api/squad/delete'; - -// Function to delete a squad by ID -export async function deleteSquadById( - squadId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/squad/${squadId}`; - - const options = { - method: 'DELETE', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error deleting squad: ${errorText}`); - } - - // Cast the response to DeleteSquadResponse type - const responseData: DeleteSquadResponse = await response.json(); - return responseData; - } catch (error) { - console.error('Failed to delete squad:', error); - throw error; - } -} - -// Example usage -const token = ''; -const squadId = 'squad-id-123'; // The ID of the squad to delete - -deleteSquadById(squadId, token) - .then((response) => console.log('Deleted Squad:', response)) - .catch((error) => console.error('Error deleting squad:', error)); - -export const exampleDeleteSquadResponse: DeleteSquadResponse = { - id: 'squad-id-123', - name: 'Example Squad', - members: [ - { - assistantId: 'assistant-id-001', - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en' - }, - model: { - messages: [ - { content: 'Hello, how can I help you?', role: 'assistant' } - ], - provider: 'anyscale', - temperature: 0.7 - } - } - } - ], - membersOverrides: { - transcriber: { - provider: 'deepgram', - model: 'nova-2' - } - }, - orgId: 'org-id-001', - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:30:00Z' -}; diff --git a/typescript/api/squad/get.ts b/typescript/api/squad/get.ts deleted file mode 100644 index d6b84c2..0000000 --- a/typescript/api/squad/get.ts +++ /dev/null @@ -1,53 +0,0 @@ -import { GetSquadResponse } from '@/types/vapiAi/api/squad/get'; - -// Function to fetch a squad by ID -async function getSquadById( - squadId: string, - token: string -): Promise { - const url = `https://api.vapi.ai/squad/${squadId}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error fetching squad: ${errorText}`); - } - - const squadData: GetSquadResponse = await response.json(); // Cast response to GetSquadResponse type - return squadData; - } catch (error) { - console.error('Error fetching squad:', error); - throw error; - } -} - -// Example usage: -const token = ''; -const squadId = 'squad-id-123'; - -getSquadById(squadId, token) - .then((squad) => console.log('Squad details:', squad)) - .catch((error) => console.error('Error:', error)); - -export const exampleGetSquateResponse = { - id: 'squad-id-123', - name: 'Support Team', - members: [ - { - assistantId: 'assistant-id-001', - name: 'Support Assistant' - } - ], - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:30:00Z' -}; diff --git a/typescript/api/squad/list.ts b/typescript/api/squad/list.ts deleted file mode 100644 index a61cb2c..0000000 --- a/typescript/api/squad/list.ts +++ /dev/null @@ -1,70 +0,0 @@ -// api/squads.ts - -import { - ListSquadsQueryParams, - ListSquadsResponse -} from '@/types/vapiAi/api/squad/list'; // Ensure correct path - -// Function to list squads with optional query parameters -export async function listSquads( - token: string, // API token for authorization - queryParams: ListSquadsQueryParams = {} // Optional query parameters -): Promise { - const baseUrl = 'https://api.vapi.ai/squad'; - - // Construct query string from queryParams object - const queryString = new URLSearchParams( - queryParams as Record - ).toString(); - const url = `${baseUrl}?${queryString}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - throw new Error(`Error fetching squads: ${response.statusText}`); - } - - // Cast the response to ListSquadsResponse - const data: ListSquadsResponse = await response.json(); - return data; - } catch (error) { - console.error('Failed to fetch squads:', error); - throw error; - } -} - -// Example usage: -const token = ''; -listSquads(token, { limit: 50, createdAtGt: '2023-01-01T00:00:00Z' }) - .then((squads) => console.log('Squads:', squads)) - .catch((error) => console.error('Error:', error)); - -// Example response -export const exampleListSquadsResponse: ListSquadsResponse = { - squads: [ - { - id: 'squad-001', - name: 'Support Squad', - members: [ - { - assistantId: 'assistant-001', - assistant: { transcriber: { provider: 'deepgram', model: 'nova' } } - } - ], - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:10:00Z', - membersOverrides: { - assistant: { voice: { provider: 'azure', voiceId: 'andrew' } } - } - } - ] -}; diff --git a/typescript/api/squad/update.ts b/typescript/api/squad/update.ts deleted file mode 100644 index a06d159..0000000 --- a/typescript/api/squad/update.ts +++ /dev/null @@ -1,113 +0,0 @@ -// api/squads.ts -import { - UpdateSquadRequest, - UpdateSquadResponse -} from '@/types/vapiAi/api/squad/update'; - -// Function to update a squad by ID -export async function updateSquad( - squadId: string, // ID of the squad to update - token: string, // API token for authorization - updateData: UpdateSquadRequest // Data for the update -): Promise { - const url = `https://api.vapi.ai/squad/${squadId}`; - - const options = { - method: 'PATCH', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(updateData) // Send the updated squad data - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error updating squad: ${errorText}`); - } - - const updatedSquad: UpdateSquadResponse = await response.json(); - return updatedSquad; - } catch (error) { - console.error('Failed to update squad:', error); - throw error; - } -} - -// Example usage -const token = ''; -const squadId = 'squad-id-123'; // The ID of the squad to update - -const updateData: UpdateSquadRequest = { - name: 'New Squad Name', - members: [ - { - assistantId: 'assistant-id-001', - assistant: { - transcriber: { - provider: 'deepgram', - model: 'nova-2', - language: 'en' - }, - model: { - messages: [{ content: 'Welcome to the call.', role: 'assistant' }], - provider: 'anyscale', - temperature: 0.7 - }, - voice: { - provider: 'azure', - voiceId: 'andrew', - speed: 1.25 - } - }, - assistantOverrides: { - voice: { - speed: 1.1 - } - } - } - ], - membersOverrides: { - assistant: { - transcriber: { provider: 'deepgram', model: 'nova-2' } - } - } -}; - -updateSquad(squadId, token, updateData) - .then((updatedSquad) => console.log('Updated Squad:', updatedSquad)) - .catch((error) => console.error('Error updating squad:', error)); - -// Example response after successful update -export const exampleUpdateSquadResponse: UpdateSquadResponse = { - id: 'squad-id-123', - name: 'New Squad Name', - members: [ - { - assistantId: 'assistant-id-001', - assistant: { - transcriber: { provider: 'deepgram', model: 'nova-2', language: 'en' }, - model: { - messages: [{ content: 'Welcome to the call.', role: 'assistant' }], - provider: 'anyscale', - temperature: 0.7 - }, - voice: { provider: 'azure', voiceId: 'andrew', speed: 1.25 } - }, - assistantOverrides: { - voice: { speed: 1.1 } - } - } - ], - membersOverrides: { - assistant: { - transcriber: { provider: 'deepgram', model: 'nova-2' } - } - }, - orgId: 'org-id-001', - createdAt: '2023-09-07T12:00:00Z', - updatedAt: '2023-09-07T12:30:00Z' -}; diff --git a/typescript/api/tools/create.ts b/typescript/api/tools/create.ts deleted file mode 100644 index d819897..0000000 --- a/typescript/api/tools/create.ts +++ /dev/null @@ -1,104 +0,0 @@ -// api/tools.ts - -import { ToolMessageType, MessageRole } from '@/types/vapiAi/api/calls/create'; -import { - CreateToolRequest, - ConditionOperator, - ToolType, - CreateToolResponse -} from '@/types/vapiAi/api/tools/create'; - -// Function to create a tool -export async function createTool(token: string, toolData: CreateToolRequest) { - const url = 'https://api.vapi.ai/tool'; - - const options = { - method: 'POST', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - }, - body: JSON.stringify(toolData) - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error creating tool: ${errorText}`); - } - - const responseData = await response.json(); - console.log('Tool created successfully:', responseData); - return responseData; - } catch (error) { - console.error('Error creating tool:', error); - throw error; - } -} - -// Example usage -const token = ''; -const toolData: CreateToolRequest = { - async: false, - messages: [ - { - type: ToolMessageType.ToolMessageStart, - content: 'Processing your request, please wait...', - role: MessageRole.Assistant - } - ], - type: ToolType.DTMF, - function: { - name: 'DTMF Tool', - description: 'Tool for detecting DTMF tones', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://example.com/dtmf-tool', - secret: 'superSecret' - } -}; - -// Call the function -createTool(token, toolData) - .then((tool) => console.log('Tool Created:', tool)) - .catch((error) => console.error('Tool Creation Error:', error)); - -const exampleToolResponse: CreateToolResponse = { - async: false, - messages: [ - { - type: ToolMessageType.ToolMessageStart, - content: 'Processing your request, please wait...', - role: MessageRole.Assistant - } - ], - type: ToolType.DTMF, - id: 'tool-id-123', - orgId: 'org-id-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - function: { - name: 'DTMF Tool', - description: 'Tool for detecting DTMF tones', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://example.com/dtmf-tool', - secret: 'superSecret' - } -}; - -console.log(exampleToolResponse); diff --git a/typescript/api/tools/delete.ts b/typescript/api/tools/delete.ts deleted file mode 100644 index 7a2c628..0000000 --- a/typescript/api/tools/delete.ts +++ /dev/null @@ -1,28 +0,0 @@ -import { DeleteToolResponse } from '@/types/vapiAi/api/tools/delete'; - -const options = { - method: 'DELETE', - headers: { - Authorization: 'Bearer ' - } -}; - -// Perform the API call to delete a tool by ID -fetch('https://api.vapi.ai/tool/{id}', options) - .then((response) => { - if (!response.ok) { - throw new Error(`Error deleting tool: ${response.statusText}`); - } - return response.json(); - }) - .then((deleteResponse: DeleteToolResponse) => { - console.log('Tool deleted successfully:', deleteResponse); - }) - .catch((error) => console.error('Error:', error)); - -export const exampleToolDeleteResponse = { - id: 'tool-123', - status: 'deleted', - orgId: 'org-123', - deletedAt: '2023-11-07T05:45:00Z' -}; diff --git a/typescript/api/tools/get.ts b/typescript/api/tools/get.ts deleted file mode 100644 index 6c35f49..0000000 --- a/typescript/api/tools/get.ts +++ /dev/null @@ -1,77 +0,0 @@ -// api/tools.ts - -import { ToolMessageType, MessageRole } from '@/types/vapiAi/api/calls/create'; -import { ToolType } from '@/types/vapiAi/api/tools/create'; -import { GetToolResponse } from '@/types/vapiAi/api/tools/get'; - -// Function to get a tool by its ID -export async function getToolById( - token: string, - toolId: string -): Promise { - const url = `https://api.vapi.ai/tool/${toolId}`; - - const options = { - method: 'GET', - headers: { - Authorization: `Bearer ${token}`, - 'Content-Type': 'application/json' - } - }; - - try { - const response = await fetch(url, options); - - if (!response.ok) { - const errorText = await response.text(); - throw new Error(`Error fetching tool: ${errorText}`); - } - - const toolData: GetToolResponse = await response.json(); - console.log('Tool fetched successfully:', toolData); - return toolData; - } catch (error) { - console.error('Error fetching tool:', error); - throw error; - } -} - -// Example usage -const token = ''; -const toolId = 'tool-id-123'; - -getToolById(token, toolId) - .then((tool) => console.log('Tool Data:', tool)) - .catch((error) => console.error('Error fetching tool:', error)); - -const exampleToolResponse: GetToolResponse = { - id: '23423adasd', - async: false, - messages: [ - { - type: ToolMessageType.ToolMessageStart, - content: 'Processing your request, please wait...', - role: MessageRole.Assistant - } - ], - type: ToolType.DTMF, // Use enum value here instead of a string id: 'tool-id-123', - orgId: 'org-id-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - function: { - name: 'DTMF Tool', - description: 'Tool for detecting DTMF tones', - parameters: { - type: 'object', - properties: {}, - required: ['param1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://example.com/dtmf-tool', - secret: 'superSecret' - } -}; - -console.log(exampleToolResponse); diff --git a/typescript/api/tools/list.ts b/typescript/api/tools/list.ts deleted file mode 100644 index 35f78e2..0000000 --- a/typescript/api/tools/list.ts +++ /dev/null @@ -1,59 +0,0 @@ -import { ListToolsResponse } from '@/types/vapiAi/api/tools/list'; - -const options = { - method: 'GET', - headers: { - Authorization: 'Bearer ', - 'Content-Type': 'application/json' - } -}; - -// API call to list tools -fetch('https://api.vapi.ai/tool', options) - .then((response) => response.json()) - .then((data: ListToolsResponse) => { - console.log('Total tools:', data.totalCount); - console.log('Tools:', data.tools); - }) - .catch((error) => console.error('Error fetching tools:', error)); - -export const exampleToolListResponse = { - tools: [ - { - async: false, - messages: [ - { - type: 'request-start', - content: 'Starting the DTMF tool', - conditions: [ - { - value: 'start', - operator: 'eq', - param: 'trigger' - } - ] - } - ], - type: 'dtmf', - id: 'tool-123', - orgId: 'org-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:31:56Z', - function: { - name: 'DTMF Function', - description: 'Detect DTMF tones', - parameters: { - type: 'object', - properties: {}, - required: ['tones'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://server.url', - secret: 'superSecretKey' - } - } - ], - totalCount: 1 -}; diff --git a/typescript/api/tools/update.ts b/typescript/api/tools/update.ts deleted file mode 100644 index 7a398d1..0000000 --- a/typescript/api/tools/update.ts +++ /dev/null @@ -1,77 +0,0 @@ -import { UpdateToolResponse } from '@/types/vapiAi/api/tools/update'; - -const options = { - method: 'PATCH', - headers: { - Authorization: 'Bearer ', - 'Content-Type': 'application/json' - }, - body: JSON.stringify({ - async: false, - messages: [ - { - type: 'request-start', - content: 'Starting the tool', - conditions: [{ value: 'start', operator: 'eq', param: 'trigger' }] - } - ], - function: { - name: 'Custom Tool Function', - description: 'This is a custom tool function.', - parameters: { - type: 'object', - properties: {}, - required: ['parameter1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://custom-server.url', - secret: 'superSecretKey' - } - }) -}; - -// Perform the API call -fetch('https://api.vapi.ai/tool/{id}', options) - .then((response) => response.json()) - .then((updatedTool: UpdateToolResponse) => { - console.log('Updated Tool:', updatedTool); - }) - .catch((error) => console.error('Error updating tool:', error)); - -export const exampleToolUpdateResponse = { - async: false, - messages: [ - { - type: 'request-start', - content: 'Starting the tool', - conditions: [ - { - value: 'start', - operator: 'eq', - param: 'trigger' - } - ] - } - ], - type: 'dtmf', - id: 'tool-123', - orgId: 'org-123', - createdAt: '2023-11-07T05:31:56Z', - updatedAt: '2023-11-07T05:32:00Z', - function: { - name: 'Custom Tool Function', - description: 'This is a custom tool function.', - parameters: { - type: 'object', - properties: {}, - required: ['parameter1'] - } - }, - server: { - timeoutSeconds: 20, - url: 'https://custom-server.url', - secret: 'superSecretKey' - } -}; diff --git a/typescript/index.ts b/typescript/index.ts deleted file mode 100644 index 82ee6eb..0000000 --- a/typescript/index.ts +++ /dev/null @@ -1,82 +0,0 @@ -import axios from 'axios'; - -// Base URL for VAPI API (replace with actual URL from VAPI docs) -const VAPI_BASE_URL = 'https://api.vapi.ai'; - -// API key or token for VAPI API (replace with your actual API key/token) -const VAPI_API_KEY = 'YOUR_VAPI_API_KEY'; - -/** - * Sync a cloned voice with VAPI. - * @param customerId - The unique ID of the customer - * @param voiceId - The cloned voice ID from ElevenLabs - * @returns A promise that resolves when the sync is complete - */ -export const syncVoiceWithVAPI = async ( - customerId: string, - voiceId: string -): Promise => { - const url = `${VAPI_BASE_URL}/vapi/voices/sync`; - - const payload = { - customerId, - voiceId - }; - - try { - const response = await axios.post(url, payload, { - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - } - }); - - if (response.status === 200 || response.status === 201) { - console.log( - `Voice ID ${voiceId} synced successfully for customer ${customerId}` - ); - } else { - console.error( - `Failed to sync voice for customer ${customerId}: ${response.statusText}` - ); - throw new Error(`Failed to sync voice: ${response.statusText}`); - } - } catch (error) { - console.error('Error syncing voice with VAPI:', error); - throw new Error('Sync with VAPI failed.'); - } -}; - -/** - * Fetch all cloned voices for a specific customer from VAPI. - * @param customerId - The unique ID of the customer - * @returns A promise that resolves with an array of voices for the customer - */ -export const fetchCustomerVoices = async ( - customerId: string -): Promise => { - const url = `${VAPI_BASE_URL}/vapi/voices/customer/${customerId}`; - - try { - const response = await axios.get(url, { - headers: { - Authorization: `Bearer ${VAPI_API_KEY}`, - 'Content-Type': 'application/json' - } - }); - - if (response.status === 200) { - const voices = response.data.voices; - console.log(`Fetched ${voices.length} voices for customer ${customerId}`); - return voices; - } else { - console.error( - `Failed to fetch voices for customer ${customerId}: ${response.statusText}` - ); - throw new Error(`Failed to fetch voices: ${response.statusText}`); - } - } catch (error) { - console.error('Error fetching customer voices from VAPI:', error); - throw new Error('Fetch customer voices failed.'); - } -}; diff --git a/typescript/syncCustomerVoice.ts b/typescript/syncCustomerVoice.ts deleted file mode 100644 index 480ab79..0000000 --- a/typescript/syncCustomerVoice.ts +++ /dev/null @@ -1,42 +0,0 @@ -import { fetchCustomerVoices, syncVoiceWithVAPI } from '.'; - -/** - * Sync the cloned voice with VAPI for the given customer - * @param customerId - The unique ID of the customer - * @param voiceId - The cloned voice ID from ElevenLabs - */ -async function syncCustomerVoiceWithVAPI( - customerId: string, - voiceId: string -): Promise { - try { - // Sync the cloned voice with VAPI - await syncVoiceWithVAPI(customerId, voiceId); - console.log( - `Successfully synced voice ${voiceId} for customer ${customerId}` - ); - } catch (error) { - console.error( - `Error syncing voice ${voiceId} for customer ${customerId}:`, - error - ); - throw new Error('Failed to sync voice with VAPI'); - } -} - -/** - * Fetch only the voices for the authenticated customer from VAPI - * @param customerId - The unique ID of the customer - * @returns List of voice data for that customer - */ -async function getCustomerVoices(customerId: string): Promise { - try { - // Fetch voices for this customer from VAPI - const voices = await fetchCustomerVoices(customerId); - console.log(`Fetched ${voices.length} voices for customer ${customerId}`); - return voices; - } catch (error) { - console.error(`Error fetching voices for customer ${customerId}:`, error); - throw new Error('Failed to fetch customer voices'); - } -} diff --git a/typescript/utils/createSalesScript.ts b/typescript/utils/createSalesScript.ts deleted file mode 100644 index da557a7..0000000 --- a/typescript/utils/createSalesScript.ts +++ /dev/null @@ -1,25 +0,0 @@ -function createAssistantMessages(salesScript: string): Message[] { - const scriptLines = salesScript - .split('\n') - .filter((line) => line.trim() !== ''); - - const messages: Message[] = [ - { - role: 'system', - content: `You're a sales agent following this script: - ${scriptLines.join('\n')} - Follow this script while adapting to the conversation naturally.` - } - ]; - - // Add script lines as assistant messages - scriptLines.forEach((line, index) => { - messages.push({ - role: 'assistant', - content: line, - type: index === 0 ? 'request-start' : undefined - }); - }); - - return messages; -}