Voice Broadcast API

Voice API
Quick Start Guides
Methods
Types
FAQ

UploadSoundFile

This method uploads a sound file. Our system accepts WAV files (PCM, u-law, A-law, or MS ADPCM). To use the sound file in a message, put tildes (~) around it and start it with a caret (^). Example: Hello ~^soundfile~, you are great. (The message would say “Hello,” then play the sound file, and then say “you are great.”)

Syntax

UploadSoundFile(FileBinary, SoundFileID, LicenseKey)

Request Parameters

Parameter NameDescriptionData TypeRequiredSample Value
FileBinaryThe WAV file to upload. The minimum recommended sound quality is 16-bit mono PCM. The maximum file size allowed is 2 MB. Split your sound into multiple files if it is larger than 2 MB.Array of Byte valuesTrue
SoundFileIDThe ID to use for retrieving the sound file later on. The ID will be converted to lowercase.StringTruegreeting
LicenseKeyYour license key.StringTrue00000000-0000-0000-0000-000000000000

Response

Returns: UploadSoundFileResponse object

Code Samples

You can use any programming language you want with our API, as long as it can make a REST or SOAP call. Here are examples for some of the most common platforms.

C#

/* https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl was added as a Service Reference and given the name WSDL */

using WSDL;

var client = new PhoneNotifySoapClient(PhoneNotifySoapClient.EndpointConfiguration.PhoneNotifySoap);
var fileBinary = File.ReadAllBytes(@"C:\Users\Public\hello.wav");
var soundFileId = "hello";
var response = await client.UploadSoundFileAsync(fileBinary, soundFileId, YOUR_LICENSE_KEY);

Console.WriteLine("Sound file was uploaded: " + response.UploadSoundFileResult.UploadSuccessful);
Console.WriteLine("File length: " + response.UploadSoundFileResult.UploadedLengthInSeconds + " seconds");

Python

import zeep

with open(r"C:\Users\Public\sound.ulaw", "rb") as file:
    file_binary = file.read()

client = zeep.Client(wsdl="https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl")
sound_file_id = "greeting"
license_key = "00000000-0000-0000-0000-000000000000"

result = client.service.UploadSoundFile(file_binary, sound_file_id, license_key)

print(result)

GET Request

GET /NotifyWS/PhoneNotify.asmx/UploadSoundFile?FileBinary=string&FileBinary=string&SoundFileID=string&LicenseKey=string HTTP/1.1
Host: ws.esendex.us

POST Request

POST /NotifyWS/PhoneNotify.asmx/UploadSoundFile HTTP/1.1
Host: ws.esendex.us
Content-Type: application/x-www-form-urlencoded
Content-Length: length

FileBinary=string&FileBinary=string&SoundFileID=string&LicenseKey=string

SOAP 1.1 Request

POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "https://ws.esendex.us/NotifyWS/UploadSoundFile"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UploadSoundFile xmlns="https://ws.esendex.us/NotifyWS/">
      <FileBinary>base64Binary</FileBinary>
      <SoundFileID>string</SoundFileID>
      <LicenseKey>string</LicenseKey>
    </UploadSoundFile>
  </soap:Body>
</soap:Envelope>

SOAP 1.1 Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <UploadSoundFileResponse xmlns="https://ws.esendex.us/NotifyWS/">
      <UploadSoundFileResult>
        <UploadSuccessful>boolean</UploadSuccessful>
        <ErrorResponse>string</ErrorResponse>
        <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
      </UploadSoundFileResult>
    </UploadSoundFileResponse>
  </soap:Body>
</soap:Envelope>

SOAP 1.2 Request

POST /NotifyWS/PhoneNotify.asmx HTTP/1.1
Host: ws.esendex.us
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UploadSoundFile xmlns="https://ws.esendex.us/NotifyWS/">
      <FileBinary>base64Binary</FileBinary>
      <SoundFileID>string</SoundFileID>
      <LicenseKey>string</LicenseKey>
    </UploadSoundFile>
  </soap12:Body>
</soap12:Envelope>

SOAP 1.2 Response

HTTP/1.1 200 OK
Content-Type: application/soap+xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<soap12:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap12="http://www.w3.org/2003/05/soap-envelope">
  <soap12:Body>
    <UploadSoundFileResponse xmlns="https://ws.esendex.us/NotifyWS/">
      <UploadSoundFileResult>
        <UploadSuccessful>boolean</UploadSuccessful>
        <ErrorResponse>string</ErrorResponse>
        <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
      </UploadSoundFileResult>
    </UploadSoundFileResponse>
  </soap12:Body>
</soap12:Envelope>

XML Response

HTTP/1.1 200 OK
Content-Type: text/xml; charset=utf-8
Content-Length: length

<?xml version="1.0" encoding="utf-8"?>
<UploadFileResponse xmlns="https://ws.esendex.us/NotifyWS/">
  <UploadSuccessful>boolean</UploadSuccessful>
  <ErrorResponse>string</ErrorResponse>
  <UploadedLengthInSeconds>int</UploadedLengthInSeconds>
</UploadFileResponse>

Let’s start sending, together.