Voice Broadcast API
Quick Start: C#
There are three steps to integrating the Voice Broadcast API into your Visual Studio C# project.
1. Create an account.
Sign up for an account. When you register you will receive a license key to send messages from. You will need this to use the API.
2. Add a web service reference to your project.
In order to call the Phone Notify! API, you will need to create a project with a web service reference.
Start by creating a new Console App project in Visual Studio. Then, in the Solution Explorer, right click on your project and select Add > Service Reference….
Visual Studio will open an “Add service reference” dialog. Select WCF Web Service and click the Next button.
In the URI field, type in the URL for the Voice Broadcast API service description file: https://ws.esendex.us/notifyws/phonenotify.asmx?wsdl. Then click the Go button.
Once the wizard has successfully contacted the API, the service will be shown below the URL.
Change the Namespace to something appropriate for your project. Let’s call it WSDL.
Click the Next button. Visual Studio will offer some options for customizing the service, but you can leave these as default.
The wizard will add the service to your project’s service references (as shown).
3. Send a test phone call.
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.
using WSDL;
var client = new PhoneNotifySoapClient(PhoneNotifySoapClient.EndpointConfiguration.PhoneNotifySoap);
var phoneNumberToDial = "7575559999";
var textToSay = "Hello, this is a test call.";
var callerId = "";
var callerIdName = "Test Caller";
var voiceId = "0";
var licenseKey = "00000000-0000-0000-0000-000000000000";
var response = await client.NotifyPhoneBasicAsync(
phoneNumberToDial, textToSay, callerId, callerIdName, voiceId, licenseKey);
Console.WriteLine(
"QueueID: " + response.QueueID + Environment.NewLine +
"Response Code: " + response.ResponseCode + Environment.NewLine +
"Response Text: " + response.ResponseText
);
Run the project. Visual Studio will open a debug console. If the response is Queued, the call has been successfully scheduled. You will receive the phone call shortly.
QueueID: 4093249
Response Code: 0
Response Text: Queued
Let’s start sending, together.