Building an automated voice notification system: a step by step guide

TechTalks Leveraging Voice APIs for Efficient Communication - A Guide for CTOs and Developers
Share with

Voice broadcasting is an evolution in the field of telemarketing to reach a large audience. With its roots in radio programming during the early part of the 19th century for political campaigns, it now has a wide range of applications.  

Using Voice APIs, voice broadcasting can today be widely used across healthcare, finance, education, and many other industries across marketing and sales, customer service, among other use cases. A business can leverage voice API to send out many messages quickly and reach a wide range of customers and prospects. 

From delivering OTP via voice to sharing promotional messages, voice broadcasting can play an important role in managing a modern business. With EnableX CPaaS, customers can also combine voice broadcasting with powerful SMS API and Video API solutions to offer a full range of services using different channels in tandem. 

What is Voice Broadcasting? 

Voice broadcasting is a communications solution which sends out voice messages to the masses at once through outbound phone calls. These messages can be customized easily and quickly to meet the business requirements.

Voice Broadcasting API structure 

 
 

Exploring the Benefits of Voice Broadcast for Businesses 

Businesses can use voice broadcasting to quickly and effectively broadcast important messages to multiple cohorts, delivering time and money savings, while increasing customer satisfaction. Additionally, users can benefit from a convenient, efficient and personalized communication experience. They can schedule and customize voice broadcasting to meet specific communication needs, allowing them to reach their audience at the right time, and in the right way. These messages can also carry personalized data and information including notifications or reminders for appointments etc.  

How to build voice broadcasting system using API 

EnableX Voice Broadcast is one of the most advanced and reliable Voice Broadcast APIs in the market. It provides a platform for businesses to easily set up and send voice messages to their customers. With its powerful features, it can be used to increase customer engagement, reach out to potential customers, and keep existing customers informed about the latest offers or services. Additionally, it is easy to integrate with marketing automation platforms, which makes it even more useful for businesses. 

How to configure voice message Broadcast into your application 

EnableX Offers this voice notification services. To configure Voice notification service with EnableX, you need to 

  1. Sign-Up for an account with EnableX
  2. Create a project with voice service
  3. Get API access credentials
  4. Configure voice service
  5. Configure phone number
  6. Configure voice prompts
  7. Add Voice Prompt to Configured Number 

How to create an account on EnableX 

  • Login to EnableX Portal  
  • Navigate to Projects Menu, Select Create New Project 
  • Enable Voice to include voice capabilities to your project 

How to setup a project with voice service 

  • Click the project name to which you wish to add voice service 
  • Navigate to SERVICE SUBSCRIBED 
  • Enable VOICE SERVICE 
  • Click on SAVE 

 How to access API Credentials 

Once you successfully created a voice project: 

  • You will receive credential details (APP-ID & APP-KEY) on your registered email address. OR 
  • You can get your project credentials by: 
  • Navigate to My Project  
  • Select Project from the list of projects 
  • Click on PROJECT CREDENTIAL 
  • Click on SEND APP CREDENTIAL to get the APP-ID and APP-KEY for the project on the registered email address. 

How to create app for voice notifications

How to configure your phone number for personalised voice notifications
To use any voice service (Inbound or Outbound), you must have a phone number associated with your project. 
EnableX offers a variety of phone numbers for your application, country regulations and use case.  

  • Navigate to the Project 
  • Click on BUY NUMBERS 
  • Select Country, Services, Type and Numbers 
  • Click on PLACE ORDER 

Once you buy a phone number, add it to your project 

  • Select PHONE NUMBERS 
  • Select Outbound direction 
  • Click on ADD PHONE TO PROJECT 

Add Phone Number for voice api

How to configure voice prompts
To configure voice prompts, 

  • Navigate to the Voice Project with which you wish to configure Voice prompts 
  • Go to Preferences 
  • Select from the existing Voice Prompts or Click on ADD NEW PROMPT FILE 
  • Open Add New Voice Prompt form  
  • Enter required details 

Configure Voice Prompts for voice notification service

  •  Select Voice Prompt Type1. Text-to-Speech 
  • Select Text-to-Speech, if you wish to use written text as a voice prompt 
  • Select Language, Welcome Text, and Voice Type 

Text-to-Speech Voice Prompt 

       2. Upload Audio File 

  • Select Upload Audio File, if you wish to use pre-recorded audio as a voice Prompt  
  • Click on Choose File and select required file 

How to use voice api for notification system

  • Click on the Submit Request 
  • The system will return a unique identification to play the prompt through the API Play Prompt. 

Add Voice Prompt to Configured Number 

  • Navigate to the Project 
  • Go to Voice Settings 
  • Click on VOICE PROMPTS 
  • Select Number from the dropdown menu 
  • Enter Event URL 
  • Select Voice Prompt Template from the dropdown menu 
  • Click on Save 

You have successfully Added a voice prompt to your configured Phone Number. 

Once the service is setup, you need to create a JSON structure with all the desired phone numbers, stringifying them to pass them in API, creating an application instance using API, passing all required parameters, registering webhooks, and taking control of the call leg. 

Best practices for implementing Voice Broadcasting into your application 

  • Run the following command from your terminal or command prompt to create a new directory for your project files on your computer  
  • git clone https://github.com/EnableX/voice-outbound-text-to-speech.git 
  • cd voice-outbound-text-to-speech 
  • npm install 
  • Get your EnableX account credentials and save to .env file  
  • Setting up configurations using environment variable 
  • Secure Webhook 
  • Get SSL Certificate 
  • Start Client application Script 

 Configure your system to use the Voice API 

Using the enableX Voice API client, create a workflow that defines the prompts and values you want to use for each attribute in your system. You can define the prompts and values using JSON. 

Make a Voice Broadcast call to configured numbers 

During Voice API calls, the developer provides a CLI (Caller Line Identity) that will be used as an outbound number. The CLI is validated against the configured number. A call will fail if the number does not match. 

  • Select the outbound phone number 
  • Use the URL, Pass the Authorisation header and request Json body  
  • The API expects 2 callback URLs; 
  • An event URL to communicate the results and responses from the server 
  • A webhook URL to handle and process individual calls in the message broadcast set
const axios = require('axios'); 
const btoa = require('btoa'); 
require('dotenv').config(); 

const APP_ID = process.env.ENABLEX_APP_ID; 
const APP_KEY = process.env.ENABLEX_APP_KEY;  
const authKey = btoa(`${APP_ID}:${APP_KEY}`); 

const options = {  
  headers: {  
    "Authorization": `Basic ${authKey}`,  
    "Content-Type": "application/json"  
  } 
};
const URL = "https://api.enablex.io/voice/v1/broadcast"; 
const data = {
  "application_name": "TEST_APP",
  "owner_ref": "XYZ",
  "from" : "reqDetails.from",
  "broadcastnumbersjson" : "reqDetails.broadcast_numbers",
  "action_on_connect": {
    "play": {
      "text": "reqDetails.play_text",
      "voice": "reqDetails.play_voice",
      "language": "en-US",
      "prompt_ref": "1"
    }
  },
  "call_param" : {
    "interval_between_retries" : "reqDetails.interval_between_retries",
    "number_of_retries" : "reqDetails.number_of_retries"
  },
    "event_url": "${process.env.PUBLIC_WEBHOOK_URL}/event",
    "call_handler_url" : "${process.env.PUBLIC_CALL_HANDLER_URL}/event"
};

axios.post(URL, data, options) 
    .then((res) => { 
        console.log("RESPONSE ==== : ", res); 
    }) 
    .catch((err) => {  
        console.log ("ERROR: ====", err);
    })

How to test and validate voice broadcast call 

Testing and validating a Voice Broadcast Call API is a crucial step in ensuring that the system is functioning properly and delivering messages accurately as well as ensuring that it is secure and reliable. Enablex provides you with this mechanism to test and validate your voice broadcast call. 

  • Enter Call-id/voice-id of incoming call received via webhook 
  • Success and Error response for accept call API is available at broadcast call API response 

Some examples of responses are given below: 

// Success response when broadcast successfully initiated 
const successResponse = { 
  "app_instance": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", 
"application_name": "MessageBroadcast for sales", 
  "state": "initiated", 
  "timestamp": "2020-02-16T10:52:00Z" 
} 

// Error response 400 Bad request 
const failedResponse400 = { 
  "application_name": "MessageBroadCast Application Name", 
  "state": "failed", 
  "error_description": "CLI number is not assigned/wrong CLI number", 
  "timestamp": "2020-02-16T10:52:00Z" 
} 

// Error response 404 Not Found 
const failedResponse404 = { 
  "app_instance": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", 
  "state": "failed", 
  "error_description": "Application Not Found", 
  "timestamp": "2020-02-16T10:52:00Z" 
} 

// Error response 401 Unauthorized 
const failedResponse401 = { 
  "app_instance": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", 
  "state": "failed", 
  "error_description": "Not authorized", 
  "timestamp": "2020-02-16T10:52:00Z" 
} 

// Events: Webhook response once all the calls are disconnected 
const webhookResponse = { 
  "app_instance": "03847288-4586-43be-b834-e00204b86cc1", 
  "application_name": "MessageBroadcast for sales", 
  "resultset": { 
    "successfull_calls": 2, 
    "failed_calls": 3 
  }, 
  "timestamp": "2020-06-15T08:31:31.849Z" 
} 

You can also check your voice broadcast call status in-between with the API given below; 

var HttpVerb = "GET" 
var URL = "https://api.enablex.io/voice/v1/broadcast/{appInstance}";  
URL = URL.replace("{appInstance}", "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58") 
 
axios.get(URL, options)  
    .then((res) => {  
        console.log("RESPONSE ==== : ", res);  
    })  
    .catch((err) => {   
        console.log ("ERROR: ====", err); 
    }) 
 
const successResponse = { 
    "app_instance": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", 
    "application_name": "MessageBroadcast for sales", 
    "resultSet": [ 
      { 
        "dialed_number": "1234", 
        "state": "connected | ringing | disconnected", 
        "result": { 
          "code": "success | failed", 
          "reason": "success | AMD | Busy" 
        } 
      } 
    ], 
    "timestamp": "2020-02-16T10:52:00Z" 
  } 
// NOTE: All error codes reference - https://www.enablex.io/developer/voice-api/error-codes/ 

Ending a Message Broadcast Early: How to Stop a Voice Broadcast Call in Progress

Stopping a message broadcast early is not a decision to be taken lightly, but in certain circumstances, it may be necessary to prevent further delivery of the message. By following the proper procedures and best practices for ending a voice broadcast call in progress, the sender can minimize the impact of the interruption and ensure that any issues are addressed promptly. 

With the API given below, you can initiate the ending message broadcast prematurely. 

// Stop the Message Broadcast prematurely 
const axios = require('axios');  
const btoa = require('btoa');  
require('dotenv').config();  
 
const APP_ID = process.env.ENABLEX_APP_ID;  
const APP_KEY = process.env.ENABLEX_APP_KEY;   
const authKey = btoa(`${APP_ID}:${APP_KEY}`);  
const options = {   
  headers: {   
    "Authorization": `Basic ${authKey}`,   
    "Content-Type": "application/json"   
  }  
}; 
var HttpVerb = "DELETE" 
var URL = "https://api.enablex.io/voice/v1/broadcast/{appInstance}";  
URL = URL.replace("{appInstance}", "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58") 
xios.delete(URL, options)  
    .then((res) => {  
        console.log("RESPONSE ==== : ", res);  
    })  
    .catch((err) => {   
        console.log ("ERROR: ====", err); 
    }) 
const successResponse = { 
    "appInstance": "f1aa71c0-8f2a-4fe8-b5ef-9a330454ef58", 
    "applicationName": "MessageBroadcast for sales", 
    "state": "success", 
    "timestamp": "2020-08-20T09:03:09.893Z" 
  } 
// NOTE: All error codes reference - https://www.enablex.io/developer/voice-api/error-codes/ 

You also have access to CDRs and detailed reporting in the EnableX portal for all the calls made.  

Use Cases of Voice Broadcasting with EnableX Voice APIs
A ringing phone is often harder to ignore compared to a text message. This serves well for emergencies and time-sensitive alerts where immediate attention is needed.

Emergency Notifications: Voice Broadcast can serve as an alert system in the event of natural disasters, severe weather conditions, and other situations that require immediate action.

Public Service Announcements: Voice Broadcasts can be used by government agencies to inform the public about emergency preparations, vaccination drives, upcoming elections, and other significant community events.

Customer Service: Voice Broadcasts can be used by businesses to deliver personalized messages to customers regarding order status updates, appointment reminders, and other customer service-related issues.

Marketing and Sales:
Voice Broadcasts can be used to deliver marketing messages to many customers or potential customers. For example, a company could use a voice broadcast to announce a sale or an exclusive offer.

Internal Communications: Voice broadcasts can be used to communicate valuable information to employees or team members within an organization. For example, a company can use a voice broadcast to notify employees about company-wide policy changes, upcoming meetings, or training sessions.  

What are the Benefits of Using EnableX Voice APIs for Voice Broadcast?
There are many benefits associated with EnableX Voice APIs: 

  • Provides access to phone numbers across 200+ countries from different vendors. 
  • Allows you to make jitter-free, clear voice calls to customers worldwide through apps, browsers, SIP-enabled devices, or traditional phones. 
  • Allows businesses to build voice broadcast applications that can be used to deliver voice messages using pre-recorded voice messages or real-time text-to-speech technology to hundreds of users at the same time.
  • Your application can also pass multiple webhook URLs to receive notifications on the status of the Voice Broadcast or the status of an individual call.  
  • You can customize or personalize the flow based on user input. This can be like IVR, DTMF, and Call Bridging using the well-defined EnableX Voice Broadcast APIs. 
  • Enablex voice API retries the call-in case of user is not available or not reachable. 
  • Call status updates are reported back to the application and dashboards, well-formed analytics business a comprehensive report on the broadcast status. 
  • Voice API also provides URL Play which can be played to the broadcasted phone numbers. 

Unlock the Potential of Your Business with EnableX Voice APIs for Voice Broadcast Solutions
If you would like to find out more about how voice broadcasting can help you save money, increase productivity, and reach more of your customers, sign up for a free account at EnableX .  Learn more: 

To learn more, access our voice API documentation:  https://www.enablex.io/developer/voice/voice-apps/message-broadcast/  

https://www.enablex.io/developer/voice/ 

The EnableX Voice Platform is built using the best-in-class technologies and infrastructure to deliver best possible customer experience. With the use of WebRTC and SIP as the underlying real-time communication frameworks, we ensure seamless communication across IP and PSTN networks, end points and mobile devices. We offer native APIs and SDK’s along with hybrid frameworks – both for web and mobile applications including ReactNative, Flutter and Cordova to enable quick integration by developers.

Are you looking for feature-rich APIs to build exciting solutions?
Sign up for free to begin!
Signup Cpaas API