3.1.3 • Published 5 years ago

ytelapi v3.1.3

Weekly downloads
22
License
-
Repository
-
Last release
5 years ago

Getting started

Ytel API version 3.1.2

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 YtelAPILib 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 APIController 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: UsageController

Get singleton instance

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

var controller = lib.UsageController;

Method: createListUsage

Retrieve usage metrics regarding your Ytel account. The results includes inbound/outbound voice calls and inbound/outbound SMS messages as well as carrier lookup requests.

function createListUsage(productCode, startDate, endDate, includeSubAccounts, callback)

Parameters

ParameterTagsDescription
productCodeOptionalFilter usage results by product type.
startDateOptionalFilter usage objects by start date.
endDateOptionalFilter usage objects by end date.
includeSubAccountsOptionalWill include all subaccount usage data

Example Usage

    var productCode = Object.keys(ProductCode)[0];
    var startDate = 'startDate';
    var endDate = 'endDate';
    var includeSubAccounts = 'IncludeSubAccounts';

    controller.createListUsage(productCode, startDate, endDate, includeSubAccounts, function(error, response, context) {

    
    });

Back to List of Controllers

Class: SubAccountController

Get singleton instance

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

var controller = lib.SubAccountController;

Method: createSubaccount

Create a sub user account under the parent account

function createSubaccount(firstName, lastName, email, friendlyName, password, callback)

Parameters

ParameterTagsDescription
firstNameRequiredSub account user first name
lastNameRequiredsub account user last name
emailRequiredSub account email address
friendlyNameRequiredDescriptive name of the sub account
passwordRequiredThe password of the sub account. Please make sure to make as password that is at least 8 characters long, contain a symbol, uppercase and a number.

Example Usage

    var firstName = 'FirstName';
    var lastName = 'LastName';
    var email = 'Email';
    var friendlyName = 'FriendlyName';
    var password = 'Password';

    controller.createSubaccount(firstName, lastName, email, friendlyName, password, function(error, response, context) {

    
    });

Method: createDeleteSubaccount

Delete sub account or merge numbers into parent

function createDeleteSubaccount(subAccountSID, mergeNumber, callback)

Parameters

ParameterTagsDescription
subAccountSIDRequiredThe SubaccountSid to be deleted
mergeNumberRequired0 to delete or 1 to merge numbers to parent account.

Example Usage

    var subAccountSID = 'SubAccountSID';
    var mergeNumber = Object.keys(MergeNumber)[0];

    controller.createDeleteSubaccount(subAccountSID, mergeNumber, function(error, response, context) {

    
    });

Method: createToggleSubaccountStatus

Suspend or unsuspend

function createToggleSubaccountStatus(subAccountSID, activate, callback)

Parameters

ParameterTagsDescription
subAccountSIDRequiredThe SubaccountSid to be activated or suspended
activateRequired0 to suspend or 1 to activate

Example Usage

    var subAccountSID = 'SubAccountSID';
    var activate = Object.keys(Activate)[0];

    controller.createToggleSubaccountStatus(subAccountSID, activate, function(error, response, context) {

    
    });

Back to List of Controllers

Class: AccountController

Get singleton instance

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

var controller = lib.AccountController;

Method: createViewAccount

Retrieve information regarding your Ytel account by a specific date. The response object will contain data such as account status, balance, and account usage totals.

function createViewAccount(date, callback)

Parameters

ParameterTagsDescription
dateRequiredFilter account information based on date.

Example Usage

    var date = 'Date';

    controller.createViewAccount(date, function(error, response, context) {

    
    });

Back to List of Controllers

Class: EmailController

Get singleton instance

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

var controller = lib.EmailController;

Method: createBlockedEmails

Retrieve a list of emails that have been blocked.

function createBlockedEmails(offset, limit, callback)

Parameters

ParameterTagsDescription
offsetOptionalThe starting point of the list of blocked emails that should be returned.
limitOptionalThe count of results that should be returned.

Example Usage

    var offset = 'Offset';
    var limit = 'Limit';

    controller.createBlockedEmails(offset, limit, function(error, response, context) {

    
    });

Method: createRemoveInvalidEmail

Remove an email from the invalid email list.

function createRemoveInvalidEmail(email, callback)

Parameters

ParameterTagsDescription
emailRequiredA valid email address that is to be remove from the invalid email list.

Example Usage

    var email = 'Email';

    controller.createRemoveInvalidEmail(email, function(error, response, context) {

    
    });

Method: createInvalidEmails

Retrieve a list of invalid email addresses.

function createInvalidEmails(offset, limit, callback)

Parameters

ParameterTagsDescription
offsetOptionalThe starting point of the list of invalid emails that should be returned.
limitOptionalThe count of results that should be returned.

Example Usage

    var offset = 'Offset';
    var limit = 'Limit';

    controller.createInvalidEmails(offset, limit, function(error, response, context) {

    
    });

Method: createRemoveBouncedEmail

Remove an email address from the bounced list.

function createRemoveBouncedEmail(email, callback)

Parameters

ParameterTagsDescription
emailRequiredThe email address to be remove from the bounced email list.

Example Usage

    var email = 'Email';

    controller.createRemoveBouncedEmail(email, function(error, response, context) {

    
    });

Method: createBouncedEmails

Retrieve a list of emails that have bounced.

function createBouncedEmails(offset, limit, callback)

Parameters

ParameterTagsDescription
offsetOptionalThe starting point of the list of bounced emails that should be returned.
limitOptionalThe count of results that should be returned.

Example Usage

    var offset = 'Offset';
    var limit = 'Limit';

    controller.createBouncedEmails(offset, limit, function(error, response, context) {

    
    });

Method: createSpamEmails

Retrieve a list of emails that are on the spam list.

function createSpamEmails(offset, limit, callback)

Parameters

ParameterTagsDescription
offsetOptionalThe starting point of the list of spam emails that should be returned.
limitOptionalThe count of results that should be returned.

Example Usage

    var offset = 'Offset';
    var limit = 'Limit';

    controller.createSpamEmails(offset, limit, function(error, response, context) {

    
    });

Method: createSendEmail

Create and submit an email message to one or more email addresses.

function createSendEmail(to, type, subject, message, from, cc, bcc, attachment, callback)

Parameters

ParameterTagsDescription
toRequiredA valid address that will receive the email. Multiple addresses can be separated by using commas.
typeRequiredSpecifies the type of email to be sent
subjectRequiredThe subject of the mail. Must be a valid string.
messageRequiredThe email message that is to be sent in the text.
fromOptionalA valid address that will send the email.
ccOptionalCarbon copy. A valid address that will receive the email. Multiple addresses can be separated by using commas.
bccOptionalBlind carbon copy. A valid address that will receive the email. Multiple addresses can be separated by using commas.
attachmentOptionalA file that is attached to the email. Must be less than 7 MB in size.

Example Usage

    var to = 'To';
    var type = Object.keys(Type)[0];
    var subject = 'Subject';
    var message = 'Message';
    var from = 'From';
    var cc = 'Cc';
    var bcc = 'Bcc';
    var attachment = 'Attachment';

    controller.createSendEmail(to, type, subject, message, from, cc, bcc, attachment, function(error, response, context) {

    
    });

Method: createRemoveBlockedAddress

Remove an email from blocked emails list.

function createRemoveBlockedAddress(email, callback)

Parameters

ParameterTagsDescription
emailRequiredThe email address to be remove from the blocked list.

Example Usage

    var email = 'Email';

    controller.createRemoveBlockedAddress(email, function(error, response, context) {

    
    });

Method: addEmailUnsubscribe

Add an email to the unsubscribe list

function addEmailUnsubscribe(email, callback)

Parameters

ParameterTagsDescription
emailRequiredA valid email address that is to be added to the unsubscribe list

Example Usage

    var email = 'email';

    controller.addEmailUnsubscribe(email, function(error, response, context) {

    
    });

Method: createRemoveUnsubscribedEmail

Remove an email address from the list of unsubscribed emails.

function createRemoveUnsubscribedEmail(email, callback)

Parameters

ParameterTagsDescription
emailRequiredA valid email address that is to be remove from the unsubscribe list.

Example Usage

    var email = 'email';

    controller.createRemoveUnsubscribedEmail(email, function(error, response, context) {

    
    });

Method: createListUnsubscribedEmails

Retrieve a list of email addresses from the unsubscribe list.

function createListUnsubscribedEmails(offset, limit, callback)

Parameters

ParameterTagsDescription
offsetOptionalThe starting point of the list of unsubscribed emails that should be returned.
limitOptionalThe count of results that should be returned.

Example Usage

    var offset = 'Offset';
    var limit = 'Limit';

    controller.createListUnsubscribedEmails(offset, limit, function(error, response, context) {

    
    });

Method: createRemoveSpamAddress

Remove an email from the spam email list.

function createRemoveSpamAddress(email, callback)

Parameters

ParameterTagsDescription
emailRequiredA valid email address that is to be remove from the spam list.

Example Usage

    var email = 'Email';

    controller.createRemoveSpamAddress(email, function(error, response, context) {

    
    });

Back to List of Controllers

Class: RecordingController

Get singleton instance

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

var controller = lib.RecordingController;

Method: createDeleteRecording

Remove a recording from your Ytel account.

function createDeleteRecording(recordingsid, callback)

Parameters

ParameterTagsDescription
recordingsidRequiredThe unique identifier for a recording.

Example Usage

    var recordingsid = 'recordingsid';

    controller.createDeleteRecording(recordingsid, function(error, response, context) {

    
    });

Method: createListRecordings

Retrieve a list of recording objects.

function createListRecordings(page, pagesize, datecreated, callsid, 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.
datecreatedOptionalFilter results by creation date
callsidOptionalThe unique identifier for a call.

Example Usage

    var page = 39;
    var pagesize = 39;
    var datecreated = 'Datecreated';
    var callsid = 'callsid';

    controller.createListRecordings(page, pagesize, datecreated, callsid, function(error, response, context) {

    
    });

Method: createViewRecording

Retrieve the recording of a call by its RecordingSid. This resource will return information regarding the call such as start time, end time, duration, and so forth.

function createViewRecording(recordingsid, callback)

Parameters

ParameterTagsDescription
recordingsidRequiredThe unique identifier for the recording.

Example Usage

    var recordingsid = 'recordingsid';

    controller.createViewRecording(recordingsid, function(error, response, context) {

    
    });

Back to List of Controllers

Class: TranscriptionController

Get singleton instance

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

var controller = lib.TranscriptionController;

Method: createTranscribeAudioURL

Transcribe an audio recording from a file.

function createTranscribeAudioURL(audiourl, callback)

Parameters

ParameterTagsDescription
audiourlRequiredURL pointing to the location of the audio file that is to be transcribed.

Example Usage

    var audiourl = 'audiourl';

    controller.createTranscribeAudioURL(audiourl, function(error, response, context) {

    
    });

Method: createListTranscriptions

Retrieve a list of transcription objects for your Ytel account.

function createListTranscriptions(page, pagesize, status, dateTranscribed, 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.
statusOptionalThe state of the transcription.
dateTranscribedOptionalThe date the transcription took place.

Example Usage

    var page = 39;
    var pagesize = 39;
    var status = Object.keys(Status)[0];
    var dateTranscribed = 'dateTranscribed';

    controller.createListTranscriptions(page, pagesize, status, dateTranscribed, function(error, response, context) {

    
    });

Method: createViewTranscription

Retrieve information about a transaction by its TranscriptionSid.

function createViewTranscription(transcriptionsid, callback)

Parameters

ParameterTagsDescription
transcriptionsidRequiredThe unique identifier for a transcription object.

Example Usage

    var transcriptionsid = 'transcriptionsid';

    controller.createViewTranscription(transcriptionsid, function(error, response, context) {

    
    });

Method: createTranscribeRecording

Transcribe a recording by its RecordingSid.

function createTranscribeRecording(recordingSid, callback)

Parameters

ParameterTagsDescription
recordingSidRequiredThe unique identifier for a recording object.

Example Usage

    var recordingSid = 'recordingSid';

    controller.createTranscribeRecording(recordingSid, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ConferenceController

Get singleton instance

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

var controller = lib.ConferenceController;

Method: createListConferences

Retrieve a list of conference objects.

function createListConferences(page, pagesize, friendlyName, 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
friendlyNameOptionalOnly return conferences with the specified FriendlyName
dateCreatedOptionalConference created date

Example Usage

    var page = 39;
    var pagesize = 39;
    var friendlyName = 'FriendlyName';
    var dateCreated = 'DateCreated';

    controller.createListConferences(page, pagesize, friendlyName, dateCreated, function(error, response, context) {

    
    });

Method: createHangupParticipant

Remove a participant from a conference.

function createHangupParticipant(participantSid, conferenceSid, callback)

Parameters

ParameterTagsDescription
participantSidRequiredThe unique identifier for a participant object.
conferenceSidRequiredThe unique identifier for a conference object.

Example Usage

    var participantSid = 'ParticipantSid';
    var conferenceSid = 'ConferenceSid';

    controller.createHangupParticipant(participantSid, conferenceSid, function(error, response, context) {

    
    });

Method: createPlayAudio

Play an audio file during a conference.

function createPlayAudio(conferenceSid, participantSid, audioUrl, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredThe unique identifier for a conference object.
participantSidRequiredThe unique identifier for a participant object.
audioUrlRequiredThe URL for the audio file that is to be played during the conference. Multiple audio files can be chained by using a semicolon.

Example Usage

    var conferenceSid = 'ConferenceSid';
    var participantSid = 'ParticipantSid';
    var audioUrl = Object.keys(AudioUrl)[0];

    controller.createPlayAudio(conferenceSid, participantSid, audioUrl, function(error, response, context) {

    
    });

Method: createListParticipants

Retrieve a list of participants for an in-progress conference.

function createListParticipants(conferenceSid, page, pagesize, muted, deaf, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredThe unique identifier for a conference.
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.
mutedOptionalSpecifies if participant should be muted.
deafOptionalSpecifies if the participant should hear audio in the conference.

Example Usage

    var conferenceSid = 'ConferenceSid';
    var page = 39;
    var pagesize = 39;
    var muted = false;
    var deaf = false;

    controller.createListParticipants(conferenceSid, page, pagesize, muted, deaf, function(error, response, context) {

    
    });

Method: createConference

Here you can experiment with initiating a conference call through Ytel and view the request response generated when doing so.

function createConference(url, from, to, method, statusCallBackUrl, statusCallBackMethod, fallbackUrl, fallbackMethod, record, recordCallBackUrl, recordCallBackMethod, scheduleTime, timeout, callback)

Parameters

ParameterTagsDescription
urlRequiredURL requested once the conference connects
fromRequiredA valid 10-digit number (E.164 format) that will be initiating the conference call.
toRequiredA valid 10-digit number (E.164 format) that is to receive the conference 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 conference 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.
recordOptionalSpecifies if the conference should be recorded.
recordCallBackUrlOptionalRecording parameters will be sent here upon completion.
recordCallBackMethodOptionalSpecifies the HTTP method used to request the required URL once conference connects.
scheduleTimeOptionalSchedule conference in future. Schedule time must be greater than current time
timeoutOptionalThe number of seconds the call stays on the line while waiting for an answer. The max time limit is 999 and the default limit is 60 seconds but lower times can be set.

Example Usage

    var url = 'Url';
    var from = 'From';
    var to = 'To';
    var method = 'Method';
    var statusCallBackUrl = 'StatusCallBackUrl';
    var statusCallBackMethod = 'StatusCallBackMethod';
    var fallbackUrl = 'FallbackUrl';
    var fallbackMethod = 'FallbackMethod';
    var record = false;
    var recordCallBackUrl = 'RecordCallBackUrl';
    var recordCallBackMethod = 'RecordCallBackMethod';
    var scheduleTime = 'ScheduleTime';
    var timeout = 39;

    controller.createConference(url, from, to, method, statusCallBackUrl, statusCallBackMethod, fallbackUrl, fallbackMethod, record, recordCallBackUrl, recordCallBackMethod, scheduleTime, timeout, function(error, response, context) {

    
    });

Method: createViewParticipant

Retrieve information about a participant by its ParticipantSid.

function createViewParticipant(conferenceSid, participantSid, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredThe unique identifier for a conference object.
participantSidRequiredThe unique identifier for a participant object.

Example Usage

    var conferenceSid = 'ConferenceSid';
    var participantSid = 'ParticipantSid';

    controller.createViewParticipant(conferenceSid, participantSid, function(error, response, context) {

    
    });

Method: createViewConference

Retrieve information about a conference by its ConferenceSid.

function createViewConference(conferenceSid, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredThe unique identifier of each conference resource

Example Usage

    var conferenceSid = 'ConferenceSid';

    controller.createViewConference(conferenceSid, function(error, response, context) {

    
    });

Method: addParticipant

Add Participant in conference

function addParticipant(conferenceSid, participantNumber, muted, deaf, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredThe unique identifier for a conference object.
participantNumberRequiredThe phone number of the participant to be added.
mutedOptionalSpecifies if participant should be muted.
deafOptionalSpecifies if the participant should hear audio in the conference.

Example Usage

    var conferenceSid = 'ConferenceSid';
    var participantNumber = 'ParticipantNumber';
    var muted = false;
    var deaf = false;

    controller.addParticipant(conferenceSid, participantNumber, muted, deaf, function(error, response, context) {

    
    });

Method: createSilenceParticipant

Deaf Mute Participant

function createSilenceParticipant(conferenceSid, participantSid, muted, deaf, callback)

Parameters

ParameterTagsDescription
conferenceSidRequiredID of the active conference
participantSidRequiredID of an active participant
mutedOptionalMute a participant
deafOptionalMake it so a participant cant hear

Example Usage

    var conferenceSid = 'conferenceSid';
    var participantSid = 'ParticipantSid';
    var muted = false;
    var deaf = false;

    controller.createSilenceParticipant(conferenceSid, participantSid, muted, deaf, 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: 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(NumberType2)[0];
    var areaCode = 'AreaCode';
    var quantity = 'Quantity';
    var leftover = 'Leftover';

    controller.createBulkBuyNumbers(numberType, areaCode, quantity, leftover, 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: 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: 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 = 39;
    var pageSize = 39;
    var numberType = Object.keys(NumberType)[0];
    var friendlyName = 'FriendlyName';

    controller.createListNumbers(page, pageSize, numberType, friendlyName, 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: createViewDetails

Retrieve the details for a phone number by its number.

function createViewDetails(phoneNumber, callback)

Parameters

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

Example Usage

    var phoneNumber = 'PhoneNumber';

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

    
    });

Method: createReleaseNumber

Remove a purchased Ytel number from your account.

function createReleaseNumber(phoneNumber, callback)

Parameters

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

Example Usage

    var phoneNumber = 'PhoneNumber';

    controller.createReleaseNumber(phoneNumber, 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 Ytel 10-digit phone number (E.164 format).

Example Usage

    var phoneNumber = 'PhoneNumber';

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

    
    });

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: 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(Numbertype1)[0];
    var areacode = 'areacode';
    var pagesize = 39;

    controller.createAvailableNumbers(numbertype, areacode, pagesize, 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) {

    
    });

Back to List of Controllers

Class: CarrierController

Get singleton instance

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

var controller = lib.CarrierController;

Method: createLookupCarrier

Get the Carrier Lookup

function createLookupCarrier(phoneNumber, callback)

Parameters

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

Example Usage

    var phoneNumber = 'PhoneNumber';

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

    
    });

Method: createCarrierResults

Retrieve a list of carrier lookup objects.

function createCarrierResults(page, pageSize, 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.

Example Usage

    var page = 39;
    var pageSize = 39;

    controller.createCarrierResults(page, pageSize, function(error, response, context) {

    
    });

Back to List of Controllers

Class: DedicatedShortCodeController

Get singleton instance

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

var controller = lib.DedicatedShortCodeController;

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) {

    
    });

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: 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 = 39;
    var pagesize = 39;
    var from = 'From';
    var shortcode = 'Shortcode';
    var datecreated = 'Datecreated';

    controller.createListInboundSMS(page, pagesize, from, shortcode, datecreated, 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: 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 = 39;
    var pageSize = 39;

    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 = 39;
    var to = 39.350779552176;
    var body = 'body';
    var method = 'method';
    var messagestatuscallback = 'messagestatuscallback';

    controller.createSendSMS(shortcode, to, body, method, messagestatuscallback, 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) {

    
    });

Back to List of Controllers

Class: SharedShortCodeController

Get singleton instance

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

var controller = lib.SharedShortCodeController;

Method: createListShortcodes

Retrieve a list of shortcode assignment associated with your Ytel account.

function createListShortcodes(shortcode, page, pagesize, callback)

Parameters

ParameterTagsDescription
shortcodeOptionalOnly list keywords of shortcode
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

Example Usage

    var shortcode = 'Shortcode';
    var page = 39;
    var pagesize = 39;

    controller.createListShortcodes(shortcode, page, pagesize, function(error, response, context) {

    
    });

Method: updateShortcode

Update Assignment

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

Parameters

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

Example Usage

    var shortcode = 'Shortcode';
    var friendlyName = 'FriendlyName';
    var callbackUrl = 'CallbackUrl';
    var callbackMethod = 'CallbackMethod';
    var fallbackUrl = 'FallbackUrl';
    var fallbackUrlMethod = 'F
3.1.3

5 years ago

3.1.2

6 years ago

3.0.0

6 years ago