ytel v3.1.2
Getting started
Ytel API version 3
How to Build
The generated SDK relies on Node Package Manager (NPM) being available to resolve dependencies. If you don't already have NPM installed, please go ahead and follow instructions to install NPM from here. The SDK also requires Node to be installed. If Node isn't already installed, please install it from here
NPM is installed by default when Node is installed
To check if node and npm have been successfully installed, write the following commands in command prompt:
node --version
npm -version
Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):
npm install
This will install all dependencies in the node_modules
folder.
Once dependencies are resolved, you will need to move the folder YtelAPIV3Lib
in to your node_modules
folder.
How to Use
The following section explains how to use the library in a new project.
1. Open Project Folder
Open an IDE/Text Editor for JavaScript like Sublime Text. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
Click on File
and select Open Folder
.
Select the folder of your SDK and click on Select Folder
to open it up in Sublime Text. The folder will become visible in the bar on the left.
2. Creating a Test File
Now right click on the folder name and select the New File
option to create a new test file. Save it as index.js
Now import the generated NodeJS library using the following lines of code:
var lib = require('lib');
Save changes.
3. Running The Test File
To run the index.js
file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:
node index.js
How to Test
These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run. Tests can be run in a number of ways:
Method 1 (Run all tests)
- Navigate to the root directory of the SDK folder from command prompt.
- Type
mocha --recursive
to run all the tests.
Method 2 (Run all tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha *
to run all the tests.
Method 3 (Run specific controller's tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha Ytel API V3Controller
to run all the tests in that controller file.
To increase mocha's default timeout, you can change the
TEST_TIMEOUT
parameter's value inTestBootstrap.js
.
Initialization
Authentication
In order to setup authentication in the API client, you need the following information.
Parameter | Description |
---|---|
basicAuthUserName | The username to use with basic authentication |
basicAuthPassword | The password to use with basic authentication |
API client can be initialized as following:
const lib = require('lib');
// Configuration parameters and credentials
lib.Configuration.basicAuthUserName = "basicAuthUserName"; // The username to use with basic authentication
lib.Configuration.basicAuthPassword = "basicAuthPassword"; // The password to use with basic authentication
Class Reference
List of Controllers
- ShortCodeController
- AreaMailController
- PostCardController
- LetterController
- CallController
- PhoneNumberController
- SMSController
- SharedShortCodeController
- ConferenceController
- CarrierController
- EmailController
- AccountController
- SubAccountController
- AddressController
- RecordingController
- TranscriptionController
- UsageController
ShortCodeController
Get singleton instance
The singleton instance of the ShortCodeController
class can be accessed from the API Client.
var controller = lib.ShortCodeController;
createListShortcodes
Retrieve a list of Short Code assignment associated with your Ytel account.
function createListShortcodes(shortcode, page, pagesize, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
shortcode | Optional | Only list Short Code Assignment sent from this Short Code |
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pagesize | Optional | The count of objects to return per page. |
Example Usage
var shortcode = 'Shortcode';
var page = 'page';
var pagesize = 'pagesize';
controller.createListShortcodes(shortcode, page, pagesize, function(error, response, context) {
});
createViewSMS
Retrieve a single Short Code object by its shortcode assignment.
function createViewSMS(shortcode, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
shortcode | Required | List of valid Dedicated Short Code to your Ytel account |
Example Usage
var shortcode = 'Shortcode';
controller.createViewSMS(shortcode, function(error, response, context) {
});
createViewSMS1
View a single Sms Short Code message.
function createViewSMS1(messageSid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
messageSid | Required | The unique identifier for the sms resource |
Example Usage
var messageSid = 'MessageSid';
controller.createViewSMS1(messageSid, function(error, response, context) {
});
createListSMS
Retrieve a list of Short Code messages.
function createListSMS(shortcode, to, dateSent, page, pageSize, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
shortcode | Optional | Only list messages sent from this Short Code |
to | Optional | Only list messages sent to this number |
dateSent | Optional | Only list messages sent with the specified date |
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pageSize | Optional | The count of objects to return per page. |
Example Usage
var shortcode = 'Shortcode';
var to = 'To';
var dateSent = 'DateSent';
var page = 16;
var pageSize = 16;
controller.createListSMS(shortcode, to, dateSent, page, pageSize, function(error, response, context) {
});
createSendSMS
Send Dedicated Shortcode
function createSendSMS(shortcode, to, body, method, messagestatuscallback, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
shortcode | Required | Your dedicated shortcode |
to | Required | The number to send your SMS to |
body | Required | The body of your message |
method | Optional | Specifies the HTTP method used to request the required URL once the Short Code message is sent.GET or POST |
messagestatuscallback | Optional | URL that can be requested to receive notification when Short Code message was sent. |
Example Usage
var shortcode = 16;
var to = 16.9939512629034;
var body = 'body';
var method = 'method';
var messagestatuscallback = 'messagestatuscallback';
controller.createSendSMS(shortcode, to, body, method, messagestatuscallback, function(error, response, context) {
});
createListInboundSMS
Retrive a list of inbound Sms Short Code messages associated with your Ytel account.
function createListInboundSMS(page, pagesize, from, shortcode, datecreated, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pagesize | Optional | Number of individual resources listed in the response per page |
from | Optional | Only list SMS messages sent from this number |
shortcode | Optional | Only list SMS messages sent to Shortcode |
datecreated | Optional | Only list SMS messages sent in the specified date MAKE REQUEST |
Example Usage
var page = 16;
var pagesize = 16;
var from = 'From';
var shortcode = 'Shortcode';
var datecreated = 'Datecreated';
controller.createListInboundSMS(page, pagesize, from, shortcode, datecreated, function(error, response, context) {
});
updateShortcode
Update a dedicated shortcode.
function updateShortcode(shortcode, friendlyName, callbackMethod, callbackUrl, fallbackMethod, fallbackUrl, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
shortcode | Required | List of valid dedicated shortcode to your Ytel account. |
friendlyName | Optional | User generated name of the dedicated shortcode. |
callbackMethod | Optional | Specifies the HTTP method used to request the required StatusCallBackUrl once call connects. |
callbackUrl | Optional | URL that can be requested to receive notification when call has ended. A set of default parameters will be sent here once the call is finished. |
fallbackMethod | Optional | Specifies the HTTP method used to request the required FallbackUrl once call connects. |
fallbackUrl | Optional | URL used if any errors occur during execution of InboundXML or at initial request of the required Url provided with the POST. |
Example Usage
var shortcode = 'Shortcode';
var friendlyName = 'FriendlyName';
var callbackMethod = 'CallbackMethod';
var callbackUrl = 'CallbackUrl';
var fallbackMethod = 'FallbackMethod';
var fallbackUrl = 'FallbackUrl';
controller.updateShortcode(shortcode, friendlyName, callbackMethod, callbackUrl, fallbackMethod, fallbackUrl, function(error, response, context) {
});
AreaMailController
Get singleton instance
The singleton instance of the AreaMailController
class can be accessed from the API Client.
var controller = lib.AreaMailController;
createDeleteAreaMail
Remove an AreaMail object by its AreaMailId.
function createDeleteAreaMail(areamailid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
areamailid | Required | The unique identifier for an AreaMail object. |
Example Usage
var areamailid = 'areamailid';
controller.createDeleteAreaMail(areamailid, function(error, response, context) {
});
createViewAreaMail
Retrieve an AreaMail object by its AreaMailId.
function createViewAreaMail(areamailid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
areamailid | Required | The unique identifier for an AreaMail object. |
Example Usage
var areamailid = 'areamailid';
controller.createViewAreaMail(areamailid, function(error, response, context) {
});
createListAreaMails
Retrieve a list of AreaMail objects.
function createListAreaMails(page, pagesize, areamailsid, dateCreated, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pagesize | Optional | The count of objects to return per page. |
areamailsid | Optional | The unique identifier for an AreaMail object. |
dateCreated | Optional | The date the AreaMail was created. |
Example Usage
var page = 16;
var pagesize = 16;
var areamailsid = 'areamailsid';
var dateCreated = 'dateCreated';
controller.createListAreaMails(page, pagesize, areamailsid, dateCreated, function(error, response, context) {
});
createAreaMail
Create a new AreaMail object.
function createAreaMail(routes, attachbyid, front, back, description, targettype, htmldata, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
routes | Required | List of routes that AreaMail should be delivered to. A single route can be either a zipcode or a carrier route.List of routes that AreaMail should be delivered to. A single route can be either a zipcode or a carrier route. A carrier route is in the form of 92610-C043 where the carrier route is composed of 5 numbers for zipcode, 1 letter for carrier route type, and 3 numbers for carrier route code. Delivery can be sent to mutliple routes by separating them with a commas. Valid Values: 92656, 92610-C043 |
attachbyid | Required | Set an existing areamail by attaching its AreamailId. |
front | Required | The front of the AreaMail item to be created. This can be a URL, local file, or an HTML string. Supported file types are PDF, PNG, and JPEG. Back required |
back | Required | The back of the AreaMail item to be created. This can be a URL, local file, or an HTML string. Supported file types are PDF, PNG, and JPEG. |
description | Optional | A string value to use as a description for this AreaMail item. |
targettype | Optional | The delivery location type. |
htmldata | Optional | A string value that contains HTML markup. |
Example Usage
var routes = 'routes';
var attachbyid = 'attachbyid';
var front = 'front';
var back = 'back';
var description = 'description';
var targettype = 'targettype';
var htmldata = 'htmldata';
controller.createAreaMail(routes, attachbyid, front, back, description, targettype, htmldata, function(error, response, context) {
});
PostCardController
Get singleton instance
The singleton instance of the PostCardController
class can be accessed from the API Client.
var controller = lib.PostCardController;
createDeletePostcard
Remove a postcard object.
function createDeletePostcard(postcardid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
postcardid | Required | The unique identifier of a postcard object. |
Example Usage
var postcardid = 'postcardid';
controller.createDeletePostcard(postcardid, function(error, response, context) {
});
createViewPostcard
Retrieve a postcard object by its PostcardId.
function createViewPostcard(postcardid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
postcardid | Required | The unique identifier for a postcard object. |
Example Usage
var postcardid = 'postcardid';
controller.createViewPostcard(postcardid, function(error, response, context) {
});
createPostcard
Create, print, and mail a postcard to an address. The postcard front must be supplied as a PDF, image, or an HTML string. The back can be a PDF, image, HTML string, or it can be automatically generated by supplying a custom message.
function createPostcard(to, from, attachbyid, front, back, message, setting, description, htmldata, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
to | Required | The AddressId or an object structured when creating an address by addresses/Create. |
from | Required | The AddressId or an object structured when creating an address by addresses/Create. |
attachbyid | Required | Set an existing postcard by attaching its PostcardId. |
front | Required | A 4.25"x6.25" or 6.25"x11.25" image to use as the front of the postcard. This can be a URL, local file, or an HTML string. Supported file types are PDF, PNG, and JPEG. |
back | Required | A 4.25"x6.25" or 6.25"x11.25" image to use as the back of the postcard, supplied as a URL, local file, or HTML string. This allows you to customize your back design, but we will still insert the recipient address for you. |
message | Required | The message for the back of the postcard with a maximum of 350 characters. |
setting | Required | Code for the dimensions of the media to be printed. |
description | Optional | A description for the postcard. |
htmldata | Optional | A string value that contains HTML markup. |
Example Usage
var to = 'to';
var from = 'from';
var attachbyid = 'attachbyid';
var front = 'front';
var back = 'back';
var message = 'message';
var setting = 'setting';
var description = 'description';
var htmldata = 'htmldata';
controller.createPostcard(to, from, attachbyid, front, back, message, setting, description, htmldata, function(error, response, context) {
});
createListPostcards
Retrieve a list of postcard objects. The postcards objects are sorted by creation date, with the most recently created postcards appearing first.
function createListPostcards(page, pagesize, postcardid, dateCreated, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pagesize | Optional | The count of objects to return per page. |
postcardid | Optional | The unique identifier for a postcard object. |
dateCreated | Optional | The date the postcard was created. |
Example Usage
var page = 16;
var pagesize = 16;
var postcardid = 'postcardid';
var dateCreated = 'dateCreated';
controller.createListPostcards(page, pagesize, postcardid, dateCreated, function(error, response, context) {
});
LetterController
Get singleton instance
The singleton instance of the LetterController
class can be accessed from the API Client.
var controller = lib.LetterController;
createDeleteLetter
Remove a letter object by its LetterId.
function createDeleteLetter(lettersid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
lettersid | Required | The unique identifier for a letter object. |
Example Usage
var lettersid = 'lettersid';
controller.createDeleteLetter(lettersid, function(error, response, context) {
});
createViewLetter
Retrieve a letter object by its LetterSid.
function createViewLetter(lettersid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
lettersid | Required | The unique identifier for a letter object. |
Example Usage
var lettersid = 'lettersid';
controller.createViewLetter(lettersid, function(error, response, context) {
});
createLetter
Create, print, and mail a letter to an address. The letter file must be supplied as a PDF or an HTML string.
function createLetter(to, from, attachbyid, file, color, description, extraservice, doublesided, template, htmldata, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
to | Required | The AddressId or an object structured when creating an address by addresses/Create. |
from | Required | The AddressId or an object structured when creating an address by addresses/Create. |
attachbyid | Required | Set an existing letter by attaching its LetterId. |
file | Required | File can be a 8.5"x11" PDF uploaded file or URL that links to a file. |
color | Required | Specify if letter should be printed in color. |
description | Optional | A description for the letter. |
extraservice | Optional | Add an extra service to your letter. Options are "certified" or "registered". Certified provides tracking and delivery confirmation for domestic destinations and is an additional $5.00. Registered provides tracking and confirmation for international addresses and is an additional $16.50. |
doublesided | Optional | Specify if letter should be printed on both sides. |
template | Optional | Boolean that defaults to true. When set to false, this specifies that your letter does not follow the m360 address template. In this case, a blank address page will be inserted at the beginning of your file and you will be charged for the extra page. |
htmldata | Optional | A string value that contains HTML markup. |
Example Usage
var to = 'to';
var from = 'from';
var attachbyid = 'attachbyid';
var file = 'file';
var color = 'color';
var description = 'description';
var extraservice = 'extraservice';
var doublesided = 'doublesided';
var template = 'template';
var htmldata = 'htmldata';
controller.createLetter(to, from, attachbyid, file, color, description, extraservice, doublesided, template, htmldata, function(error, response, context) {
});
createListLetters
Retrieve a list of letter objects. The letter objects are sorted by creation date, with the most recently created letters appearing first.
function createListLetters(page, pagesize, lettersid, dateCreated, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pagesize | Optional | The count of objects to return per page. |
lettersid | Optional | The unique identifier for a letter object. |
dateCreated | Optional | The date the letter was created. |
Example Usage
var page = 16;
var pagesize = 16;
var lettersid = 'lettersid';
var dateCreated = 'dateCreated';
controller.createListLetters(page, pagesize, lettersid, dateCreated, function(error, response, context) {
});
CallController
Get singleton instance
The singleton instance of the CallController
class can be accessed from the API Client.
var controller = lib.CallController;
createViewCall1
Retrieve a single voice call’s information by its CallSid.
function createViewCall1(callSid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier for the voice call. |
Example Usage
var callSid = 'callSid';
controller.createViewCall1(callSid, function(error, response, context) {
});
createViewCall
Retrieve a single voice call’s information by its CallSid.
function createViewCall(callsid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callsid | Required | The unique identifier for the voice call. |
Example Usage
var callsid = 'callsid';
controller.createViewCall(callsid, function(error, response, context) {
});
createPlayDTMF
Play Dtmf and send the Digit
function createPlayDTMF(callSid, playDtmf, playDtmfDirection, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier of each call resource |
playDtmf | Required | DTMF digits to play to the call. 0-9, #, *, W, or w |
playDtmfDirection | Optional | The leg of the call DTMF digits should be sent to |
Example Usage
var callSid = 'CallSid';
var playDtmf = 'PlayDtmf';
var playDtmfDirection = Object.keys(PlayDtmfDirection)[0];
controller.createPlayDTMF(callSid, playDtmf, playDtmfDirection, function(error, response, context) {
});
createMakeCall
You can experiment with initiating a call through Ytel and view the request response generated when doing so and get the response in json
function createMakeCall(from, to, url, method, statusCallBackUrl, statusCallBackMethod, fallBackUrl, fallBackMethod, heartBeatUrl, heartBeatMethod, timeout, playDtmf, hideCallerId, record, recordCallBackUrl, recordCallBackMethod, transcribe, transcribeCallBackUrl, ifMachine, ifMachineUrl, ifMachineMethod, feedback, surveyId, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
from | Required | A valid Ytel Voice enabled number (E.164 format) that will be initiating the phone call. |
to | Required | To number |
url | Required | URL requested once the call connects |
method | Optional | Specifies the HTTP method used to request the required URL once call connects. |
statusCallBackUrl | Optional | URL that can be requested to receive notification when call has ended. A set of default parameters will be sent here once the call is finished. |
statusCallBackMethod | Optional | Specifies the HTTP methodlinkclass used to request StatusCallbackUrl. |
fallBackUrl | Optional | URL requested if the initial Url parameter fails or encounters an error |
fallBackMethod | Optional | Specifies the HTTP method used to request the required FallbackUrl once call connects. |
heartBeatUrl | Optional | URL that can be requested every 60 seconds during the call to notify of elapsed tim |
heartBeatMethod | Optional | Specifies the HTTP method used to request HeartbeatUrl. |
timeout | Optional | Time (in seconds) Ytel should wait while the call is ringing before canceling the call |
playDtmf | Optional | DTMF Digits to play to the call once it connects. 0-9, #, or * |
hideCallerId | Optional | Specifies if the caller id will be hidden |
record | Optional | Specifies if the call should be recorded |
recordCallBackUrl | Optional | Recording parameters will be sent here upon completion |
recordCallBackMethod | Optional | Method used to request the RecordCallback URL. |
transcribe | Optional | Specifies if the call recording should be transcribed |
transcribeCallBackUrl | Optional | Transcription parameters will be sent here upon completion |
ifMachine | Optional | How Ytel should handle the receiving numbers voicemail machine |
ifMachineUrl | Optional | URL requested when IfMachine=continue |
ifMachineMethod | Optional | Method used to request the IfMachineUrl. |
feedback | Optional | Specify if survey should be enable or not |
surveyId | Optional | The unique identifier for the survey. |
Example Usage
var from = 'From';
var to = 'To';
var url = 'Url';
var method = 'Method';
var statusCallBackUrl = 'StatusCallBackUrl';
var statusCallBackMethod = 'StatusCallBackMethod';
var fallBackUrl = 'FallBackUrl';
var fallBackMethod = 'FallBackMethod';
var heartBeatUrl = 'HeartBeatUrl';
var heartBeatMethod = 'HeartBeatMethod';
var timeout = 16;
var playDtmf = 'PlayDtmf';
var hideCallerId = false;
var record = false;
var recordCallBackUrl = 'RecordCallBackUrl';
var recordCallBackMethod = 'RecordCallBackMethod';
var transcribe = false;
var transcribeCallBackUrl = 'TranscribeCallBackUrl';
var ifMachine = Object.keys(IfMachine)[0];
var ifMachineUrl = 'IfMachineUrl';
var ifMachineMethod = 'IfMachineMethod';
var feedback = false;
var surveyId = 'SurveyId';
controller.createMakeCall(from, to, url, method, statusCallBackUrl, statusCallBackMethod, fallBackUrl, fallBackMethod, heartBeatUrl, heartBeatMethod, timeout, playDtmf, hideCallerId, record, recordCallBackUrl, recordCallBackMethod, transcribe, transcribeCallBackUrl, ifMachine, ifMachineUrl, ifMachineMethod, feedback, surveyId, function(error, response, context) {
});
createPlayAudio
Play Audio from a url
function createPlayAudio(callSid, audioUrl, sayText, length, direction, mix, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier of each call resource |
audioUrl | Required | URL to sound that should be played. You also can add more than one audio file using semicolons e.g. http://example.com/audio1.mp3;http://example.com/audio2.wav |
sayText | Required | Valid alphanumeric string that should be played to the In-progress call. |
length | Optional | Time limit in seconds for audio play back |
direction | Optional | The leg of the call audio will be played to |
mix | Optional | If false, all other audio will be muted |
Example Usage
var callSid = 'CallSid';
var audioUrl = 'AudioUrl';
var sayText = 'SayText';
var length = 16;
var direction = Object.keys(Direction)[0];
var mix = false;
controller.createPlayAudio(callSid, audioUrl, sayText, length, direction, mix, function(error, response, context) {
});
createRecordCall
Start or stop recording of an in-progress voice call.
function createRecordCall(callSid, record, direction, timeLimit, callBackUrl, fileformat, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier of each call resource |
record | Required | Set true to initiate recording or false to terminate recording |
direction | Optional | The leg of the call to record |
timeLimit | Optional | Time in seconds the recording duration should not exceed |
callBackUrl | Optional | URL consulted after the recording completes |
fileformat | Optional | Format of the recording file. Can be .mp3 or .wav |
Example Usage
var callSid = 'CallSid';
var record = false;
var direction = Object.keys(Direction4)[0];
var timeLimit = 16;
var callBackUrl = 'CallBackUrl';
var fileformat = Object.keys(Fileformat)[0];
controller.createRecordCall(callSid, record, direction, timeLimit, callBackUrl, fileformat, function(error, response, context) {
});
createVoiceEffect
Add audio voice effects to the an in-progress voice call.
function createVoiceEffect(callSid, audioDirection, pitchSemiTones, pitchOctaves, pitch, rate, tempo, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier for the in-progress voice call. |
audioDirection | Optional | The direction the audio effect should be placed on. If IN, the effects will occur on the incoming audio stream. If OUT, the effects will occur on the outgoing audio stream. |
pitchSemiTones | Optional | Set the pitch in semitone (half-step) intervals. Value between -14 and 14 |
pitchOctaves | Optional | Set the pitch in octave intervals.. Value between -1 and 1 |
pitch | Optional | Set the pitch (lowness/highness) of the audio. The higher the value, the higher the pitch. Value greater than 0 |
rate | Optional | Set the rate for audio. The lower the value, the lower the rate. value greater than 0 |
tempo | Optional | Set the tempo (speed) of the audio. A higher value denotes a faster tempo. Value greater than 0 |
Example Usage
var callSid = 'CallSid';
var audioDirection = Object.keys(AudioDirection)[0];
var pitchSemiTones = 16.9939512629034;
var pitchOctaves = 16.9939512629034;
var pitch = 16.9939512629034;
var rate = 16.9939512629034;
var tempo = 16.9939512629034;
controller.createVoiceEffect(callSid, audioDirection, pitchSemiTones, pitchOctaves, pitch, rate, tempo, function(error, response, context) {
});
createInterruptCall
Interrupt the Call by Call Sid
function createInterruptCall(callSid, url, method, status, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
callSid | Required | The unique identifier for voice call that is in progress. |
url | Optional | URL the in-progress call will be redirected to |
method | Optional | The method used to request the above Url parameter |
status | Optional | Status to set the in-progress call to |
Example Usage
var callSid = 'CallSid';
var url = 'Url';
var method = 'Method';
var status = Object.keys(Status)[0];
controller.createInterruptCall(callSid, url, method, status, function(error, response, context) {
});
createListCalls
A list of calls associated with your Ytel account
function createListCalls(page, pageSize, to, from, dateCreated, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
pageSize | Optional | Number of individual resources listed in the response per page |
to | Optional | Filter calls that were sent to this 10-digit number (E.164 format). |
from | Optional | Filter calls that were sent from this 10-digit number (E.164 format). |
dateCreated | Optional | Return calls that are from a specified date. |
Example Usage
var page = 16;
var pageSize = 16;
var to = 'To';
var from = 'From';
var dateCreated = 'DateCreated';
controller.createListCalls(page, pageSize, to, from, dateCreated, function(error, response, context) {
});
createSendRVM
Initiate an outbound Ringless Voicemail through Ytel.
function createSendRVM(from, rVMCallerId, to, voiceMailURL, method, statusCallBackUrl, statsCallBackMethod, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
from | Required | A valid Ytel Voice enabled number (E.164 format) that will be initiating the phone call. |
rVMCallerId | Required | A required secondary Caller ID for RVM to work. |
to | Required | A valid number (E.164 format) that will receive the phone call. |
voiceMailURL | Required | The URL requested once the RVM connects. A set of default parameters will be sent here. |
method | Optional | Specifies the HTTP method used to request the required URL once call connects. |
statusCallBackUrl | Optional | URL that can be requested to receive notification when call has ended. A set of default parameters will be sent here once the call is finished. |
statsCallBackMethod | Optional | Specifies the HTTP method used to request the required StatusCallBackUrl once call connects. |
Example Usage
var from = 'From';
var rVMCallerId = 'RVMCallerId';
var to = 'To';
var voiceMailURL = 'VoiceMailURL';
var method = 'Method';
var statusCallBackUrl = 'StatusCallBackUrl';
var statsCallBackMethod = 'StatsCallBackMethod';
controller.createSendRVM(from, rVMCallerId, to, voiceMailURL, method, statusCallBackUrl, statsCallBackMethod, function(error, response, context) {
});
createGroupCall
Group Call
function createGroupCall(from, to, url, groupConfirmKey, groupConfirmFile, method, statusCallBackUrl, statusCallBackMethod, fallBackUrl, fallBackMethod, heartBeatUrl, heartBeatMethod, timeout, playDtmf, hideCallerId, record, recordCallBackUrl, recordCallBackMethod, transcribe, transcribeCallBackUrl, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
from | Required | This number to display on Caller ID as calling |
to | Required | Please enter multiple E164 number. You can add max 10 numbers. Add numbers separated with comma. e.g : 1111111111,2222222222 |
url | Required | URL requested once the call connects |
groupConfirmKey | Required | Define the DTMF that the called party should send to bridge the call. Allowed Values : 0-9, #, * |
groupConfirmFile | Required | Specify the audio file you want to play when the called party picks up the call |
method | Optional | Specifies the HTTP method used to request the required URL once call connects. |
statusCallBackUrl | Optional | URL that can be requested to receive notification when call has ended. A set of default parameters will be sent here once the call is finished. |
statusCallBackMethod | Optional | Specifies the HTTP methodlinkclass used to request StatusCallbackUrl. |
fallBackUrl | Optional | URL requested if the initial Url parameter fails or encounters an error |
fallBackMethod | Optional | Specifies the HTTP method used to request the required FallbackUrl once call connects. |
heartBeatUrl | Optional | URL that can be requested every 60 seconds during the call to notify of elapsed time and pass other general information. |
heartBeatMethod | Optional | Specifies the HTTP method used to request HeartbeatUrl. |
timeout | Optional | Time (in seconds) we should wait while the call is ringing before canceling the call |
playDtmf | Optional | DTMF Digits to play to the call once it connects. 0-9, #, or * |
hideCallerId | Optional | Specifies if the caller id will be hidden |
record | Optional | Specifies if the call should be recorded |
recordCallBackUrl | Optional | Recording parameters will be sent here upon completion |
recordCallBackMethod | Optional | Method used to request the RecordCallback URL. |
transcribe | Optional | Specifies if the call recording should be transcribed |
transcribeCallBackUrl | Optional | Transcription parameters will be sent here upon completion |
Example Usage
var from = 'From';
var to = 'To';
var url = 'Url';
var groupConfirmKey = 'GroupConfirmKey';
var groupConfirmFile = Object.keys(GroupConfirmFile)[0];
var method = 'Method';
var statusCallBackUrl = 'StatusCallBackUrl';
var statusCallBackMethod = 'StatusCallBackMethod';
var fallBackUrl = 'FallBackUrl';
var fallBackMethod = 'FallBackMethod';
var heartBeatUrl = 'HeartBeatUrl';
var heartBeatMethod = 'HeartBeatMethod';
var timeout = 16;
var playDtmf = 'PlayDtmf';
var hideCallerId = 'HideCallerId';
var record = false;
var recordCallBackUrl = 'RecordCallBackUrl';
var recordCallBackMethod = 'RecordCallBackMethod';
var transcribe = false;
var transcribeCallBackUrl = 'TranscribeCallBackUrl';
controller.createGroupCall(from, to, url, groupConfirmKey, groupConfirmFile, method, statusCallBackUrl, statusCallBackMethod, fallBackUrl, fallBackMethod, heartBeatUrl, heartBeatMethod, timeout, playDtmf, hideCallerId, record, recordCallBackUrl, recordCallBackMethod, transcribe, transcribeCallBackUrl, function(error, response, context) {
});
PhoneNumberController
Get singleton instance
The singleton instance of the PhoneNumberController
class can be accessed from the API Client.
var controller = lib.PhoneNumberController;
createGetDIDScore
Get DID Score Number
function createGetDIDScore(phonenumber, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phonenumber | Required | Specifies the multiple phone numbers for check updated spamscore . |
Example Usage
var phonenumber = 'Phonenumber';
controller.createGetDIDScore(phonenumber, function(error, response, context) {
});
createMoveNumber
Transfer phone number that has been purchased for from one account to another account.
function createMoveNumber(phonenumber, fromaccountsid, toaccountsid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phonenumber | Required | A valid 10-digit Ytel number (E.164 format). |
fromaccountsid | Required | A specific Accountsid from where Number is getting transfer. |
toaccountsid | Required | A specific Accountsid to which Number is getting transfer. |
Example Usage
var phonenumber = 'phonenumber';
var fromaccountsid = 'fromaccountsid';
var toaccountsid = 'toaccountsid';
controller.createMoveNumber(phonenumber, fromaccountsid, toaccountsid, function(error, response, context) {
});
createPurchaseNumber
Purchase a phone number to be used with your Ytel account
function createPurchaseNumber(phoneNumber, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phoneNumber | Required | A valid 10-digit Ytel number (E.164 format). |
Example Usage
var phoneNumber = 'PhoneNumber';
controller.createPurchaseNumber(phoneNumber, function(error, response, context) {
});
createReleaseNumber
Remove a purchased Ytel number from your account.
function createReleaseNumber(responseType, phoneNumber, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
responseType | Required | Response type format xml or json |
phoneNumber | Required | A valid 10-digit Ytel number (E.164 format). |
Example Usage
var responseType = 'ResponseType';
var phoneNumber = 'PhoneNumber';
controller.createReleaseNumber(responseType, phoneNumber, function(error, response, context) {
});
createViewDetails
Retrieve the details for a phone number by its number.
function createViewDetails(phoneNumber, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phoneNumber | Required | A valid Ytel 10-digit phone number (E.164 format). |
Example Usage
var phoneNumber = 'PhoneNumber';
controller.createViewDetails(phoneNumber, function(error, response, context) {
});
createBulkRelease
Remove a purchased Ytel number from your account.
function createBulkRelease(phoneNumber, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phoneNumber | Required | A valid Ytel comma separated numbers (E.164 format). |
Example Usage
var phoneNumber = 'PhoneNumber';
controller.createBulkRelease(phoneNumber, function(error, response, context) {
});
createAvailableNumbers
Retrieve a list of available phone numbers that can be purchased and used for your Ytel account.
function createAvailableNumbers(numbertype, areacode, pagesize, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
numbertype | Required | Number type either SMS,Voice or all |
areacode | Required | Specifies the area code for the returned list of available numbers. Only available for North American numbers. |
pagesize | Optional | The count of objects to return. |
Example Usage
var numbertype = Object.keys(numbertype)[0];
var areacode = 'areacode';
var pagesize = 58;
controller.createAvailableNumbers(numbertype, areacode, pagesize, function(error, response, context) {
});
updateNumber
Update properties for a Ytel number that has been purchased for your account. Refer to the parameters list for the list of properties that can be updated.
function updateNumber(phoneNumber, voiceUrl, friendlyName, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, hangupCallback, hangupCallbackMethod, heartbeatUrl, heartbeatMethod, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phoneNumber | Required | A valid Ytel number (E.164 format). |
voiceUrl | Required | URL requested once the call connects |
friendlyName | Optional | Phone number friendly name description |
voiceMethod | Optional | Post or Get |
voiceFallbackUrl | Optional | URL requested if the voice URL is not available |
voiceFallbackMethod | Optional | Post or Get |
hangupCallback | Optional | callback url after a hangup occurs |
hangupCallbackMethod | Optional | Post or Get |
heartbeatUrl | Optional | URL requested once the call connects |
heartbeatMethod | Optional | URL that can be requested every 60 seconds during the call to notify of elapsed time |
smsUrl | Optional | URL requested when an SMS is received |
smsMethod | Optional | Post or Get |
smsFallbackUrl | Optional | URL used if any errors occur during execution of InboundXML from an SMS or at initial request of the SmsUrl. |
smsFallbackMethod | Optional | The HTTP method Ytel will use when URL requested if the SmsUrl is not available. |
Example Usage
var phoneNumber = 'PhoneNumber';
var voiceUrl = 'VoiceUrl';
var friendlyName = 'FriendlyName';
var voiceMethod = 'VoiceMethod';
var voiceFallbackUrl = 'VoiceFallbackUrl';
var voiceFallbackMethod = 'VoiceFallbackMethod';
var hangupCallback = 'HangupCallback';
var hangupCallbackMethod = 'HangupCallbackMethod';
var heartbeatUrl = 'HeartbeatUrl';
var heartbeatMethod = 'HeartbeatMethod';
var smsUrl = 'SmsUrl';
var smsMethod = 'SmsMethod';
var smsFallbackUrl = 'SmsFallbackUrl';
var smsFallbackMethod = 'SmsFallbackMethod';
controller.updateNumber(phoneNumber, voiceUrl, friendlyName, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, hangupCallback, hangupCallbackMethod, heartbeatUrl, heartbeatMethod, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, function(error, response, context) {
});
createListNumbers
Retrieve a list of purchased phones numbers associated with your Ytel account.
function createListNumbers(page, pageSize, numberType, friendlyName, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
page | Optional | Which page of the overall response will be returned. Page indexing starts at 1. |
pageSize | Optional | The page count to retrieve from the total results in the collection. Page indexing starts at 1. |
numberType | Optional | The capability supported by the number.Number type either SMS,Voice or all |
friendlyName | Optional | A human-readable label added to the number object. |
Example Usage
var page = 58;
var pageSize = 58;
var numberType = Object.keys(NumberType14)[0];
var friendlyName = 'FriendlyName';
controller.createListNumbers(page, pageSize, numberType, friendlyName, function(error, response, context) {
});
createBulkUpdateNumbers
Update properties for a Ytel numbers that has been purchased for your account. Refer to the parameters list for the list of properties that can be updated.
function createBulkUpdateNumbers(phoneNumber, voiceUrl, friendlyName, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, hangupCallback, hangupCallbackMethod, heartbeatUrl, heartbeatMethod, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
phoneNumber | Required | A valid comma(,) separated Ytel numbers. (E.164 format). |
voiceUrl | Required | The URL returning InboundXML incoming calls should execute when connected. |
friendlyName | Optional | A human-readable value for labeling the number. |
voiceMethod | Optional | Specifies the HTTP method used to request the VoiceUrl once incoming call connects. |
voiceFallbackUrl | Optional | URL used if any errors occur during execution of InboundXML on a call or at initial request of the voice url |
voiceFallbackMethod | Optional | Specifies the HTTP method used to request the VoiceFallbackUrl once incoming call connects. |
hangupCallback | Optional | URL that can be requested to receive notification when and how incoming call has ended. |
hangupCallbackMethod | Optional | The HTTP method Ytel will use when requesting the HangupCallback URL. |
heartbeatUrl | Optional | URL that can be used to monitor the phone number. |
heartbeatMethod | Optional | The HTTP method Ytel will use when requesting the HeartbeatUrl. |
smsUrl | Optional | URL requested when an SMS is received. |
smsMethod | Optional | The HTTP method Ytel will use when requesting the SmsUrl. |
smsFallbackUrl | Optional | URL used if any errors occur during execution of InboundXML from an SMS or at initial request of the SmsUrl. |
smsFallbackMethod | Optional | The HTTP method Ytel will use when URL requested if the SmsUrl is not available. |
Example Usage
var phoneNumber = 'PhoneNumber';
var voiceUrl = 'VoiceUrl';
var friendlyName = 'FriendlyName';
var voiceMethod = 'VoiceMethod';
var voiceFallbackUrl = 'VoiceFallbackUrl';
var voiceFallbackMethod = 'VoiceFallbackMethod';
var hangupCallback = 'HangupCallback';
var hangupCallbackMethod = 'HangupCallbackMethod';
var heartbeatUrl = 'HeartbeatUrl';
var heartbeatMethod = 'HeartbeatMethod';
var smsUrl = 'SmsUrl';
var smsMethod = 'SmsMethod';
var smsFallbackUrl = 'SmsFallbackUrl';
var smsFallbackMethod = 'SmsFallbackMethod';
controller.createBulkUpdateNumbers(phoneNumber, voiceUrl, friendlyName, voiceMethod, voiceFallbackUrl, voiceFallbackMethod, hangupCallback, hangupCallbackMethod, heartbeatUrl, heartbeatMethod, smsUrl, smsMethod, smsFallbackUrl, smsFallbackMethod, function(error, response, context) {
});
createBulkBuyNumbers
Purchase a selected number of DID's from specific area codes to be used with your Ytel account.
function createBulkBuyNumbers(numberType, areaCode, quantity, leftover, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
numberType | Required | The capability the number supports. |
areaCode | Required | Specifies the area code for the returned list of available numbers. Only available for North American numbers. |
quantity | Required | A positive integer that tells how many number you want to buy at a time. |
leftover | Optional | If desired quantity is unavailable purchase what is available . |
Example Usage
var numberType = Object.keys(NumberType15)[0];
var areaCode = 'AreaCode';
var quantity = 'Quantity';
var leftover = 'Leftover';
controller.createBulkBuyNumbers(numberType, areaCode, quantity, leftover, function(error, response, context) {
});
SMSController
Get singleton instance
The singleton instance of the SMSController
class can be accessed from the API Client.
var controller = lib.SMSController;
createViewSMS1
Retrieve a single SMS message object with details by its SmsSid.
function createViewSMS1(messageSid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
messageSid | Required | The unique identifier for a sms message. |
Example Usage
var messageSid = 'MessageSid';
controller.createViewSMS1(messageSid, function(error, response, context) {
});
createViewSMS
Retrieve a single SMS message object by its SmsSid.
function createViewSMS(messageSid, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
messageSid | Required | The unique identifier for a sms message. |
Example Usage
var messageSid = 'MessageSid';
controller.createViewSMS(messageSid, function(error, response, context) {
});
createSendSMS
Send an SMS from a Ytel number
function createSendSMS(from, to, body, method, messageStatusCallback, smartsms, deliveryStatus, callback)
Parameters
Parameter | Tags | Description |
---|---|---|
from | Required | The 10-digit SMS-enabled Ytel number (E.164 format) in which the message is sent. |
to | Required | The 10-digit phone number (E.164 format) that will receive the message. |
body | Required | The body message that is to be sent in the text. |
method | Optional | Specifies the HTTP method used to request the required URL once SMS sent. |
messageStatusCallback | Optional | URL that can be requested to receive notification when SMS has Sent. A set of default parameters will be sent here once the SMS is finished. |
smartsms | Optional | Check's 'to' number can receive sms or not using Carrier API, if wireless = true then text sms is sent, else wireless = false then call is recieved to end user with audible message. |
deliveryStatus | Optional | Delivery reports are a method to tell your system if the message has arrived on the destination phone. |
Example Usage
var from = 'From';
var to = 'To';
var body = 'Body';
var method = 'Method';
var messageStatusCallback = 'MessageStatusCallback';
var smartsms = false;
var deliveryStatus = false;
controller.createSendSMS(from, to, body, method, messageStatusCallback, smartsms, deliveryStatus, function(error, response, context) {
});
(https://apidocs.io/img/method.png ".SMSController.createListSMS"
6 years ago