@carefully-built/elevenlabs
v0.1.7
Published
Typed, fetch-only client for ElevenLabs Agents (outbound calls, phone numbers, conversations) and post-call webhook verification.
Maintainers
Readme
@carefully-built/elevenlabs
Client minimale per ElevenLabs Agents, solo fetch: funziona in Node, edge e
nelle action di Convex. Niente SDK, niente dipendenze.
Cosa include
createElevenLabsClient({ apiKey }):agents.create/update/remove,phoneNumbers.list/importTwilio/assignAgent,calls.outbound(Twilio o SIP trunk, con variabili dinamiche e rilevamento segreteria),batchCalls.submit,conversations.get/audio.buildOutboundAgentConfig(...): configurazione di un agente per chiamate in uscita in italiano, con strumentiend_call,voicemail_detectionetransfer_to_number, regole fisse accodate al prompt dell'host,data_collectionper l'esito e webhook post-chiamata.verifyElevenLabsWebhook({ secret, signatureHeader, rawBody }): verifica HMAC (t=…,v0=…) e restituisce l'evento tipizzato (post_call_transcriptioncon trascrizione, metadati e analisi normalizzati, oppurepost_call_audiocon l'MP3 in base64).
Esempio
import { createElevenLabsClient, verifyElevenLabsWebhook } from '@carefully-built/elevenlabs';
const client = createElevenLabsClient({ apiKey: process.env.ELEVENLABS_API_KEY ?? '' });
const call = await client.calls.outbound({
provider: 'twilio',
agentId,
agentPhoneNumberId,
toNumber: '+393331234567',
dynamicVariables: { contact_name: 'Giulia Bianchi' },
hangUpOnMachine: true,
});
// Nell'endpoint del webhook:
const event = await verifyElevenLabsWebhook({ secret, signatureHeader, rawBody });
if (event.type === 'post_call_transcription') {
event.conversation.analysis.dataCollection.outcome;
}