Loading...
Loading...
Collect DTMF input and speech from callers using standard gather or AI-powered gather. Build interactive voice menus and AI voice assistants. This skill provides JavaScript SDK examples.
npx skill4agent add team-telnyx/telnyx-ext-agent-skills telnyx-voice-gather-javascriptnpm install telnyximport Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});clientPOST /calls/{call_control_id}/actions/ai_assistant_add_messagesconst response = await client.calls.actions.addAIAssistantMessages('call_control_id');
console.log(response.data);POST /calls/{call_control_id}/actions/ai_assistant_startconst response = await client.calls.actions.startAIAssistant('call_control_id');
console.log(response.data);POST /calls/{call_control_id}/actions/ai_assistant_stopconst response = await client.calls.actions.stopAIAssistant('call_control_id');
console.log(response.data);POST /calls/{call_control_id}/actions/gather_stopconst response = await client.calls.actions.stopGather('call_control_id');
console.log(response.data);POST /calls/{call_control_id}/actions/gather_using_aiparametersconst response = await client.calls.actions.gatherUsingAI('call_control_id', {
parameters: {
properties: 'bar',
required: 'bar',
type: 'bar',
},
});
console.log(response.data);POST /calls/{call_control_id}/actions/gather_using_audioconst response = await client.calls.actions.gatherUsingAudio('call_control_id');
console.log(response.data);POST /calls/{call_control_id}/actions/gather_using_speakvoicepayloadconst response = await client.calls.actions.gatherUsingSpeak('call_control_id', {
payload: 'say this on call',
voice: 'male',
});
console.log(response.data);POST /calls/{call_control_id}/actions/gatherconst response = await client.calls.actions.gather('call_control_id');
console.log(response.data);telnyx-timestamptelnyx-signature-ed25519| Event | Description |
|---|---|
| Call Gather Ended |
| Call AI Gather Ended |
| Call AI Gather Message History Updated |
| Call AI Gather Partial Results |
| Call Conversation Ended |
| Call Playback Started |
| Call Playback Ended |
| Call Dtmf Received |