Send Voice
Make voice calls with text-to-speech for OTP delivery and transactional notifications.
Basic Voice Call
send-voice.ts
import { YourSend } from 'yoursend';
const ys = new YourSend('ys_live_...');
await ys.send({
channel: 'voice',
to: '+14155551234',
body: 'Hello, this is a notification from YourApp. Your appointment is confirmed for tomorrow at 3 PM.',
});OTP via Voice
Voice OTP is ideal for users who cannot receive SMS. The code is spoken aloud and repeated.
otp-voice.ts
const { data } = await ys.send({
channel: 'voice',
to: '+14155551234',
otp: true,
});
// The user receives a call reading: "Your verification code is 1. 2. 3. 4. 5. 6."
// Verify with:
const { data: result } = await ys.check({
message_id: data.message_id,
code: '123456',
});Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| channel | string | Yes | "voice" |
| to | string | Yes | Phone number in E.164 format |
| body | string | Yes* | Text-to-speech content |
| otp | boolean | No | Set to true for voice OTP |