Voice Broadcast API

Voice API
Quick Start Guides
Methods
Types
FAQ

Quick Start: JavaScript

There are three steps to integrating the Voice Broadcast API into your Node.js project.

1. Create an account.

Sign up for an Esendex account. When you register you will receive a license key. You will need this to use the API.

2. Install Node.js.

Install Node.js if it is not on your computer already. To check, run this command in your terminal: node -v

PS C:\> node -v
v18.16.0

3. Send a test phone call.

Install a SOAP client for Node.js. Run this command in your terminal: npm install soap

Create a new JavaScript module file. Let’s call it demo.mjs.

You can use the NotifyPhoneBasic method to send a phone call. Add the displayed code to your new file.

Replace the PhoneNumberToDial value with your own phone number.

Replace the LicenseKey value with your account’s license key.

import soap from 'soap';

const url = 'https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl';
const args = {
    'PhoneNumberToDial': '4028899251',
    'TextToSay': "Hello, this call was sent with JavaScript.",
    'CallerID': "",
    'CallerIDname': "Test Caller",
    'VoiceID': 0,
    'LicenseKey': "00000000-0000-0000-0000-000000000000"
};

const client = await soap.createClientAsync(url);
const result = await client.NotifyPhoneBasicAsync(args);
console.log(result[0]);

Run the project in your terminal with this command: node demo.mjs. If the response is Queued, the call has been successfully scheduled. You will receive the phone call shortly.

PS C:\JsDemo> node demo.mjs
Queued

Let’s start sending, together.