3.1.2 • Published 6 years ago

ytel v3.1.2

Weekly downloads
11
License
-
Repository
-
Last release
6 years ago

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

Version Check

Now use npm to resolve all dependencies by running the following command in the root directory (of the SDK folder):

npm install

Resolve Dependencies

Resolve Dependencies

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.

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.

Open Project

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.

Create new file

Save new file

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

Run file

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)

  1. Navigate to the root directory of the SDK folder from command prompt.
  2. Type mocha --recursive to run all the tests.

Method 2 (Run all tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. Type mocha * to run all the tests.

Method 3 (Run specific controller's tests)

  1. Navigate to the ../test/Controllers/ directory from command prompt.
  2. 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 in TestBootstrap.js.

Run Tests

Initialization

Authentication

In order to setup authentication in the API client, you need the following information.

ParameterDescription
basicAuthUserNameThe username to use with basic authentication
basicAuthPasswordThe 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

Class: ShortCodeController

Get singleton instance

The singleton instance of the ShortCodeController class can be accessed from the API Client.

var controller = lib.ShortCodeController;

Method: createListShortcodes

Retrieve a list of Short Code assignment associated with your Ytel account.

function createListShortcodes(shortcode, page, pagesize, callback)

Parameters

ParameterTagsDescription
shortcodeOptionalOnly list Short Code Assignment sent from this Short Code
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pagesizeOptionalThe 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) {

    
    });

Method: createViewSMS

Retrieve a single Short Code object by its shortcode assignment.

function createViewSMS(shortcode, callback)

Parameters

ParameterTagsDescription
shortcodeRequiredList of valid Dedicated Short Code to your Ytel account

Example Usage

    var shortcode = 'Shortcode';

    controller.createViewSMS(shortcode, function(error, response, context) {

    
    });

Method: createViewSMS1

View a single Sms Short Code message.

function createViewSMS1(messageSid, callback)

Parameters

ParameterTagsDescription
messageSidRequiredThe unique identifier for the sms resource

Example Usage

    var messageSid = 'MessageSid';

    controller.createViewSMS1(messageSid, function(error, response, context) {

    
    });

Method: createListSMS

Retrieve a list of Short Code messages.

function createListSMS(shortcode, to, dateSent, page, pageSize, callback)

Parameters

ParameterTagsDescription
shortcodeOptionalOnly list messages sent from this Short Code
toOptionalOnly list messages sent to this number
dateSentOptionalOnly list messages sent with the specified date
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pageSizeOptionalThe 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) {

    
    });

Method: createSendSMS

Send Dedicated Shortcode

function createSendSMS(shortcode, to, body, method, messagestatuscallback, callback)

Parameters

ParameterTagsDescription
shortcodeRequiredYour dedicated shortcode
toRequiredThe number to send your SMS to
bodyRequiredThe body of your message
methodOptionalSpecifies the HTTP method used to request the required URL once the Short Code message is sent.GET or POST
messagestatuscallbackOptionalURL 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) {

    
    });

Method: createListInboundSMS

Retrive a list of inbound Sms Short Code messages associated with your Ytel account.

function createListInboundSMS(page, pagesize, from, shortcode, datecreated, callback)

Parameters

ParameterTagsDescription
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pagesizeOptionalNumber of individual resources listed in the response per page
fromOptionalOnly list SMS messages sent from this number
shortcodeOptionalOnly list SMS messages sent to Shortcode
datecreatedOptionalOnly 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) {

    
    });

Method: updateShortcode

Update a dedicated shortcode.

function updateShortcode(shortcode, friendlyName, callbackMethod, callbackUrl, fallbackMethod, fallbackUrl, callback)

Parameters

ParameterTagsDescription
shortcodeRequiredList of valid dedicated shortcode to your Ytel account.
friendlyNameOptionalUser generated name of the dedicated shortcode.
callbackMethodOptionalSpecifies the HTTP method used to request the required StatusCallBackUrl once call connects.
callbackUrlOptionalURL 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.
fallbackMethodOptionalSpecifies the HTTP method used to request the required FallbackUrl once call connects.
fallbackUrlOptionalURL 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) {

    
    });

Back to List of Controllers

Class: AreaMailController

Get singleton instance

The singleton instance of the AreaMailController class can be accessed from the API Client.

var controller = lib.AreaMailController;

Method: createDeleteAreaMail

Remove an AreaMail object by its AreaMailId.

function createDeleteAreaMail(areamailid, callback)

Parameters

ParameterTagsDescription
areamailidRequiredThe unique identifier for an AreaMail object.

Example Usage

    var areamailid = 'areamailid';

    controller.createDeleteAreaMail(areamailid, function(error, response, context) {

    
    });

Method: createViewAreaMail

Retrieve an AreaMail object by its AreaMailId.

function createViewAreaMail(areamailid, callback)

Parameters

ParameterTagsDescription
areamailidRequiredThe unique identifier for an AreaMail object.

Example Usage

    var areamailid = 'areamailid';

    controller.createViewAreaMail(areamailid, function(error, response, context) {

    
    });

Method: createListAreaMails

Retrieve a list of AreaMail objects.

function createListAreaMails(page, pagesize, areamailsid, dateCreated, callback)

Parameters

ParameterTagsDescription
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pagesizeOptionalThe count of objects to return per page.
areamailsidOptionalThe unique identifier for an AreaMail object.
dateCreatedOptionalThe 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) {

    
    });

Method: createAreaMail

Create a new AreaMail object.

function createAreaMail(routes, attachbyid, front, back, description, targettype, htmldata, callback)

Parameters

ParameterTagsDescription
routesRequiredList 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
attachbyidRequiredSet an existing areamail by attaching its AreamailId.
frontRequiredThe 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
backRequiredThe 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.
descriptionOptionalA string value to use as a description for this AreaMail item.
targettypeOptionalThe delivery location type.
htmldataOptionalA 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) {

    
    });

Back to List of Controllers

Class: PostCardController

Get singleton instance

The singleton instance of the PostCardController class can be accessed from the API Client.

var controller = lib.PostCardController;

Method: createDeletePostcard

Remove a postcard object.

function createDeletePostcard(postcardid, callback)

Parameters

ParameterTagsDescription
postcardidRequiredThe unique identifier of a postcard object.

Example Usage

    var postcardid = 'postcardid';

    controller.createDeletePostcard(postcardid, function(error, response, context) {

    
    });

Method: createViewPostcard

Retrieve a postcard object by its PostcardId.

function createViewPostcard(postcardid, callback)

Parameters

ParameterTagsDescription
postcardidRequiredThe unique identifier for a postcard object.

Example Usage

    var postcardid = 'postcardid';

    controller.createViewPostcard(postcardid, function(error, response, context) {

    
    });

Method: 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

ParameterTagsDescription
toRequiredThe AddressId or an object structured when creating an address by addresses/Create.
fromRequiredThe AddressId or an object structured when creating an address by addresses/Create.
attachbyidRequiredSet an existing postcard by attaching its PostcardId.
frontRequiredA 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.
backRequiredA 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.
messageRequiredThe message for the back of the postcard with a maximum of 350 characters.
settingRequiredCode for the dimensions of the media to be printed.
descriptionOptionalA description for the postcard.
htmldataOptionalA 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) {

    
    });

Method: 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

ParameterTagsDescription
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pagesizeOptionalThe count of objects to return per page.
postcardidOptionalThe unique identifier for a postcard object.
dateCreatedOptionalThe 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) {

    
    });

Back to List of Controllers

Class: LetterController

Get singleton instance

The singleton instance of the LetterController class can be accessed from the API Client.

var controller = lib.LetterController;

Method: createDeleteLetter

Remove a letter object by its LetterId.

function createDeleteLetter(lettersid, callback)

Parameters

ParameterTagsDescription
lettersidRequiredThe unique identifier for a letter object.

Example Usage

    var lettersid = 'lettersid';

    controller.createDeleteLetter(lettersid, function(error, response, context) {

    
    });

Method: createViewLetter

Retrieve a letter object by its LetterSid.

function createViewLetter(lettersid, callback)

Parameters

ParameterTagsDescription
lettersidRequiredThe unique identifier for a letter object.

Example Usage

    var lettersid = 'lettersid';

    controller.createViewLetter(lettersid, function(error, response, context) {

    
    });

Method: 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

ParameterTagsDescription
toRequiredThe AddressId or an object structured when creating an address by addresses/Create.
fromRequiredThe AddressId or an object structured when creating an address by addresses/Create.
attachbyidRequiredSet an existing letter by attaching its LetterId.
fileRequiredFile can be a 8.5"x11" PDF uploaded file or URL that links to a file.
colorRequiredSpecify if letter should be printed in color.
descriptionOptionalA description for the letter.
extraserviceOptionalAdd 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.
doublesidedOptionalSpecify if letter should be printed on both sides.
templateOptionalBoolean 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.
htmldataOptionalA 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) {

    
    });

Method: 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

ParameterTagsDescription
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pagesizeOptionalThe count of objects to return per page.
lettersidOptionalThe unique identifier for a letter object.
dateCreatedOptionalThe 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) {

    
    });

Back to List of Controllers

Class: CallController

Get singleton instance

The singleton instance of the CallController class can be accessed from the API Client.

var controller = lib.CallController;

Method: createViewCall1

Retrieve a single voice call’s information by its CallSid.

function createViewCall1(callSid, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier for the voice call.

Example Usage

    var callSid = 'callSid';

    controller.createViewCall1(callSid, function(error, response, context) {

    
    });

Method: createViewCall

Retrieve a single voice call’s information by its CallSid.

function createViewCall(callsid, callback)

Parameters

ParameterTagsDescription
callsidRequiredThe unique identifier for the voice call.

Example Usage

    var callsid = 'callsid';

    controller.createViewCall(callsid, function(error, response, context) {

    
    });

Method: createPlayDTMF

Play Dtmf and send the Digit

function createPlayDTMF(callSid, playDtmf, playDtmfDirection, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier of each call resource
playDtmfRequiredDTMF digits to play to the call. 0-9, #, *, W, or w
playDtmfDirectionOptionalThe 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) {

    
    });

Method: 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

ParameterTagsDescription
fromRequiredA valid Ytel Voice enabled number (E.164 format) that will be initiating the phone call.
toRequiredTo number
urlRequiredURL requested once the call connects
methodOptionalSpecifies the HTTP method used to request the required URL once call connects.
statusCallBackUrlOptionalURL 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.
statusCallBackMethodOptionalSpecifies the HTTP methodlinkclass used to request StatusCallbackUrl.
fallBackUrlOptionalURL requested if the initial Url parameter fails or encounters an error
fallBackMethodOptionalSpecifies the HTTP method used to request the required FallbackUrl once call connects.
heartBeatUrlOptionalURL that can be requested every 60 seconds during the call to notify of elapsed tim
heartBeatMethodOptionalSpecifies the HTTP method used to request HeartbeatUrl.
timeoutOptionalTime (in seconds) Ytel should wait while the call is ringing before canceling the call
playDtmfOptionalDTMF Digits to play to the call once it connects. 0-9, #, or *
hideCallerIdOptionalSpecifies if the caller id will be hidden
recordOptionalSpecifies if the call should be recorded
recordCallBackUrlOptionalRecording parameters will be sent here upon completion
recordCallBackMethodOptionalMethod used to request the RecordCallback URL.
transcribeOptionalSpecifies if the call recording should be transcribed
transcribeCallBackUrlOptionalTranscription parameters will be sent here upon completion
ifMachineOptionalHow Ytel should handle the receiving numbers voicemail machine
ifMachineUrlOptionalURL requested when IfMachine=continue
ifMachineMethodOptionalMethod used to request the IfMachineUrl.
feedbackOptionalSpecify if survey should be enable or not
surveyIdOptionalThe 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) {

    
    });

Method: createPlayAudio

Play Audio from a url

function createPlayAudio(callSid, audioUrl, sayText, length, direction, mix, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier of each call resource
audioUrlRequiredURL 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
sayTextRequiredValid alphanumeric string that should be played to the In-progress call.
lengthOptionalTime limit in seconds for audio play back
directionOptionalThe leg of the call audio will be played to
mixOptionalIf 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) {

    
    });

Method: createRecordCall

Start or stop recording of an in-progress voice call.

function createRecordCall(callSid, record, direction, timeLimit, callBackUrl, fileformat, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier of each call resource
recordRequiredSet true to initiate recording or false to terminate recording
directionOptionalThe leg of the call to record
timeLimitOptionalTime in seconds the recording duration should not exceed
callBackUrlOptionalURL consulted after the recording completes
fileformatOptionalFormat 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) {

    
    });

Method: createVoiceEffect

Add audio voice effects to the an in-progress voice call.

function createVoiceEffect(callSid, audioDirection, pitchSemiTones, pitchOctaves, pitch, rate, tempo, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier for the in-progress voice call.
audioDirectionOptionalThe 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.
pitchSemiTonesOptionalSet the pitch in semitone (half-step) intervals. Value between -14 and 14
pitchOctavesOptionalSet the pitch in octave intervals.. Value between -1 and 1
pitchOptionalSet the pitch (lowness/highness) of the audio. The higher the value, the higher the pitch. Value greater than 0
rateOptionalSet the rate for audio. The lower the value, the lower the rate. value greater than 0
tempoOptionalSet 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) {

    
    });

Method: createInterruptCall

Interrupt the Call by Call Sid

function createInterruptCall(callSid, url, method, status, callback)

Parameters

ParameterTagsDescription
callSidRequiredThe unique identifier for voice call that is in progress.
urlOptionalURL the in-progress call will be redirected to
methodOptionalThe method used to request the above Url parameter
statusOptionalStatus 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) {

    
    });

Method: createListCalls

A list of calls associated with your Ytel account

function createListCalls(page, pageSize, to, from, dateCreated, callback)

Parameters

ParameterTagsDescription
pageOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
pageSizeOptionalNumber of individual resources listed in the response per page
toOptionalFilter calls that were sent to this 10-digit number (E.164 format).
fromOptionalFilter calls that were sent from this 10-digit number (E.164 format).
dateCreatedOptionalReturn 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) {

    
    });

Method: createSendRVM

Initiate an outbound Ringless Voicemail through Ytel.

function createSendRVM(from, rVMCallerId, to, voiceMailURL, method, statusCallBackUrl, statsCallBackMethod, callback)

Parameters

ParameterTagsDescription
fromRequiredA valid Ytel Voice enabled number (E.164 format) that will be initiating the phone call.
rVMCallerIdRequiredA required secondary Caller ID for RVM to work.
toRequiredA valid number (E.164 format) that will receive the phone call.
voiceMailURLRequiredThe URL requested once the RVM connects. A set of default parameters will be sent here.
methodOptionalSpecifies the HTTP method used to request the required URL once call connects.
statusCallBackUrlOptionalURL 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.
statsCallBackMethodOptionalSpecifies 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) {

    
    });

Method: 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

ParameterTagsDescription
fromRequiredThis number to display on Caller ID as calling
toRequiredPlease enter multiple E164 number. You can add max 10 numbers. Add numbers separated with comma. e.g : 1111111111,2222222222
urlRequiredURL requested once the call connects
groupConfirmKeyRequiredDefine the DTMF that the called party should send to bridge the call. Allowed Values : 0-9, #, *
groupConfirmFileRequiredSpecify the audio file you want to play when the called party picks up the call
methodOptionalSpecifies the HTTP method used to request the required URL once call connects.
statusCallBackUrlOptionalURL 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.
statusCallBackMethodOptionalSpecifies the HTTP methodlinkclass used to request StatusCallbackUrl.
fallBackUrlOptionalURL requested if the initial Url parameter fails or encounters an error
fallBackMethodOptionalSpecifies the HTTP method used to request the required FallbackUrl once call connects.
heartBeatUrlOptionalURL that can be requested every 60 seconds during the call to notify of elapsed time and pass other general information.
heartBeatMethodOptionalSpecifies the HTTP method used to request HeartbeatUrl.
timeoutOptionalTime (in seconds) we should wait while the call is ringing before canceling the call
playDtmfOptionalDTMF Digits to play to the call once it connects. 0-9, #, or *
hideCallerIdOptionalSpecifies if the caller id will be hidden
recordOptionalSpecifies if the call should be recorded
recordCallBackUrlOptionalRecording parameters will be sent here upon completion
recordCallBackMethodOptionalMethod used to request the RecordCallback URL.
transcribeOptionalSpecifies if the call recording should be transcribed
transcribeCallBackUrlOptionalTranscription 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) {

    
    });

Back to List of Controllers

Class: PhoneNumberController

Get singleton instance

The singleton instance of the PhoneNumberController class can be accessed from the API Client.

var controller = lib.PhoneNumberController;

Method: createGetDIDScore

Get DID Score Number

function createGetDIDScore(phonenumber, callback)

Parameters

ParameterTagsDescription
phonenumberRequiredSpecifies the multiple phone numbers for check updated spamscore .

Example Usage

    var phonenumber = 'Phonenumber';

    controller.createGetDIDScore(phonenumber, function(error, response, context) {

    
    });

Method: createMoveNumber

Transfer phone number that has been purchased for from one account to another account.

function createMoveNumber(phonenumber, fromaccountsid, toaccountsid, callback)

Parameters

ParameterTagsDescription
phonenumberRequiredA valid 10-digit Ytel number (E.164 format).
fromaccountsidRequiredA specific Accountsid from where Number is getting transfer.
toaccountsidRequiredA 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) {

    
    });

Method: createPurchaseNumber

Purchase a phone number to be used with your Ytel account

function createPurchaseNumber(phoneNumber, callback)

Parameters

ParameterTagsDescription
phoneNumberRequiredA valid 10-digit Ytel number (E.164 format).

Example Usage

    var phoneNumber = 'PhoneNumber';

    controller.createPurchaseNumber(phoneNumber, function(error, response, context) {

    
    });

Method: createReleaseNumber

Remove a purchased Ytel number from your account.

function createReleaseNumber(responseType, phoneNumber, callback)

Parameters

ParameterTagsDescription
responseTypeRequiredResponse type format xml or json
phoneNumberRequiredA valid 10-digit Ytel number (E.164 format).

Example Usage

    var responseType = 'ResponseType';
    var phoneNumber = 'PhoneNumber';

    controller.createReleaseNumber(responseType, phoneNumber, function(error, response, context) {

    
    });

Method: createViewDetails

Retrieve the details for a phone number by its number.

function createViewDetails(phoneNumber, callback)

Parameters

ParameterTagsDescription
phoneNumberRequiredA valid Ytel 10-digit phone number (E.164 format).

Example Usage

    var phoneNumber = 'PhoneNumber';

    controller.createViewDetails(phoneNumber, function(error, response, context) {

    
    });

Method: createBulkRelease

Remove a purchased Ytel number from your account.

function createBulkRelease(phoneNumber, callback)

Parameters

ParameterTagsDescription
phoneNumberRequiredA valid Ytel comma separated numbers (E.164 format).

Example Usage

    var phoneNumber = 'PhoneNumber';

    controller.createBulkRelease(phoneNumber, function(error, response, context) {

    
    });

Method: 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

ParameterTagsDescription
numbertypeRequiredNumber type either SMS,Voice or all
areacodeRequiredSpecifies the area code for the returned list of available numbers. Only available for North American numbers.
pagesizeOptionalThe 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) {

    
    });

Method: 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

ParameterTagsDescription
phoneNumberRequiredA valid Ytel number (E.164 format).
voiceUrlRequiredURL requested once the call connects
friendlyNameOptionalPhone number friendly name description
voiceMethodOptionalPost or Get
voiceFallbackUrlOptionalURL requested if the voice URL is not available
voiceFallbackMethodOptionalPost or Get
hangupCallbackOptionalcallback url after a hangup occurs
hangupCallbackMethodOptionalPost or Get
heartbeatUrlOptionalURL requested once the call connects
heartbeatMethodOptionalURL that can be requested every 60 seconds during the call to notify of elapsed time
smsUrlOptionalURL requested when an SMS is received
smsMethodOptionalPost or Get
smsFallbackUrlOptionalURL used if any errors occur during execution of InboundXML from an SMS or at initial request of the SmsUrl.
smsFallbackMethodOptionalThe 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) {

    
    });

Method: createListNumbers

Retrieve a list of purchased phones numbers associated with your Ytel account.

function createListNumbers(page, pageSize, numberType, friendlyName, callback)

Parameters

ParameterTagsDescription
pageOptionalWhich page of the overall response will be returned. Page indexing starts at 1.
pageSizeOptionalThe page count to retrieve from the total results in the collection. Page indexing starts at 1.
numberTypeOptionalThe capability supported by the number.Number type either SMS,Voice or all
friendlyNameOptionalA 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) {

    
    });

Method: 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

ParameterTagsDescription
phoneNumberRequiredA valid comma(,) separated Ytel numbers. (E.164 format).
voiceUrlRequiredThe URL returning InboundXML incoming calls should execute when connected.
friendlyNameOptionalA human-readable value for labeling the number.
voiceMethodOptionalSpecifies the HTTP method used to request the VoiceUrl once incoming call connects.
voiceFallbackUrlOptionalURL used if any errors occur during execution of InboundXML on a call or at initial request of the voice url
voiceFallbackMethodOptionalSpecifies the HTTP method used to request the VoiceFallbackUrl once incoming call connects.
hangupCallbackOptionalURL that can be requested to receive notification when and how incoming call has ended.
hangupCallbackMethodOptionalThe HTTP method Ytel will use when requesting the HangupCallback URL.
heartbeatUrlOptionalURL that can be used to monitor the phone number.
heartbeatMethodOptionalThe HTTP method Ytel will use when requesting the HeartbeatUrl.
smsUrlOptionalURL requested when an SMS is received.
smsMethodOptionalThe HTTP method Ytel will use when requesting the SmsUrl.
smsFallbackUrlOptionalURL used if any errors occur during execution of InboundXML from an SMS or at initial request of the SmsUrl.
smsFallbackMethodOptionalThe 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) {

    
    });

Method: 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

ParameterTagsDescription
numberTypeRequiredThe capability the number supports.
areaCodeRequiredSpecifies the area code for the returned list of available numbers. Only available for North American numbers.
quantityRequiredA positive integer that tells how many number you want to buy at a time.
leftoverOptionalIf 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) {

    
    });

Back to List of Controllers

Class: SMSController

Get singleton instance

The singleton instance of the SMSController class can be accessed from the API Client.

var controller = lib.SMSController;

Method: createViewSMS1

Retrieve a single SMS message object with details by its SmsSid.

function createViewSMS1(messageSid, callback)

Parameters

ParameterTagsDescription
messageSidRequiredThe unique identifier for a sms message.

Example Usage

    var messageSid = 'MessageSid';

    controller.createViewSMS1(messageSid, function(error, response, context) {

    
    });

Method: createViewSMS

Retrieve a single SMS message object by its SmsSid.

function createViewSMS(messageSid, callback)

Parameters

ParameterTagsDescription
messageSidRequiredThe unique identifier for a sms message.

Example Usage

    var messageSid = 'MessageSid';

    controller.createViewSMS(messageSid, function(error, response, context) {

    
    });

Method: createSendSMS

Send an SMS from a Ytel number

function createSendSMS(from, to, body, method, messageStatusCallback, smartsms, deliveryStatus, callback)

Parameters

ParameterTagsDescription
fromRequiredThe 10-digit SMS-enabled Ytel number (E.164 format) in which the message is sent.
toRequiredThe 10-digit phone number (E.164 format) that will receive the message.
bodyRequiredThe body message that is to be sent in the text.
methodOptionalSpecifies the HTTP method used to request the required URL once SMS sent.
messageStatusCallbackOptionalURL 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.
smartsmsOptionalCheck'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.
deliveryStatusOptionalDelivery 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) {

    
    });

Method: (https://apidocs.io/img/method.png ".SMSController.createListSMS"