[docs]
https://dump.sahilsuman.me/emb5bcy8.py
https://dump.sahilsuman.me/h4lfncbn.md
[example]
You can integrate any transcriber, via the CustomTranscriber option. For more information, please visit
https://api.vapi.ai/api and search for the CustomTranscriber Schema.
Rough example to handle the CustomTranscriber data.
const WebSocket = require('ws');
const http = require('http');
const server = http.createServer(app);
const wss = new WebSocket.Server({ server });
wss.on('connection', (ws) => {
console.log('WebSocket client connected');
ws.on('message', (message, isBinary) => {
if (isBinary) {
console.log('Received binary message', message.length, 'bytes');
} else {
console.log('Received text message:', JSON.parse(message));
}
});
ws.on('close', () => {
clearInterval(intervalId);
console.log('WebSocket client disconnected');
});
// Send a transcription response every 5 seconds
const intervalId = setInterval(() => {
if (ws.readyState === WebSocket.OPEN) {
const message = {
type: 'transcriber-response',
transcription: 'hey',
channel: 'customer',
};
ws.send(JSON.stringify(message));
console.log('Sent transcription response:', message);
}
}, 5000);
});