1.22.333 • Published 6 years ago

sdsdsdsadsadsa v1.22.333

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

Getting started

Clicksend v3 API

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 ClickSend 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 ClickSend v3 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
usernameyour username
keyyour api key

API client can be initialized as following:

const lib = require('lib');

// Configuration parameters and credentials
lib.Configuration.username = "username"; // your username
lib.Configuration.key = "key"; // your api key

Class Reference

List of Controllers

Class: CountriesController

Get singleton instance

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

var controller = lib.CountriesController;

Method: getCountries

Tags: Skips Authentication

Get all countries

function getCountries(callback)

Example Usage

    controller.getCountries(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: sendSms

Send one or more SMS messages

function sendSms(smsMessages, callback)

Parameters

ParameterTagsDescription
smsMessagesRequiredSmsMessageCollection model

Example Usage

    var smsMessages = new SmsMessageCollection({"key":"value"});

    controller.sendSms(smsMessages, function(error, response, context) {

    
    });

Method: calculatePrice

Calculate sms price

function calculatePrice(smsMessages, callback)

Parameters

ParameterTagsDescription
smsMessagesRequiredSmsMessageCollection model

Example Usage

    var smsMessages = new SmsMessageCollection({"key":"value"});

    controller.calculatePrice(smsMessages, function(error, response, context) {

    
    });

Method: exportHistory

Export all sms history

function exportHistory(filename, callback)

Parameters

ParameterTagsDescription
filenameRequiredFilename to download history as

Example Usage

    var filename = 'filename';

    controller.exportHistory(filename, function(error, response, context) {

    
    });

Method: createReceipt

Add a delivery receipt

function createReceipt(url, callback)

Parameters

ParameterTagsDescription
urlRequiredYour url

Example Usage

    var url = 'url';

    controller.createReceipt(url, function(error, response, context) {

    
    });

Method: markReceiptsAsRead

Marked delivery receipts as read

function markReceiptsAsRead(dateBefore, callback)

Parameters

ParameterTagsDescription
dateBeforeOptionalMark all as read before this timestamp

Example Usage

    var dateBefore = date_before;

    controller.markReceiptsAsRead(dateBefore, function(error, response, context) {

    
    });

Method: getInboundSms

Get all inbound sms

function getInboundSms(callback)

Example Usage

    controller.getInboundSms(function(error, response, context) {

    
    });

Method: createInboundSms

Create inbound sms

function createInboundSms(url, callback)

Parameters

ParameterTagsDescription
urlRequiredYour url

Example Usage

    var url = 'url';

    controller.createInboundSms(url, function(error, response, context) {

    
    });

Method: cancelScheduledSms

Update scheduled message as cancel

function cancelScheduledSms(messageId, callback)

Parameters

ParameterTagsDescription
messageIdRequiredThe message ID you want to cancel

Example Usage

    var messageId = message_id;

    controller.cancelScheduledSms(messageId, function(error, response, context) {

    
    });

Method: cancelAllScheduledSms

Update all scheduled message as cancelled

function cancelAllScheduledSms(callback)

Example Usage

    controller.cancelAllScheduledSms(function(error, response, context) {

    
    });

Method: createSmsTemplate

Create sms template

function createSmsTemplate(smsTemplate, callback)

Parameters

ParameterTagsDescription
smsTemplateRequiredSmsTemplate model

Example Usage

    var smsTemplate = new SmsTemplate({"key":"value"});

    controller.createSmsTemplate(smsTemplate, function(error, response, context) {

    
    });

Method: deleteSmsTemplate

Delete sms template

function deleteSmsTemplate(templateId, callback)

Parameters

ParameterTagsDescription
templateIdRequiredTemplate id

Example Usage

    var templateId = 62;

    controller.deleteSmsTemplate(templateId, function(error, response, context) {

    
    });

Method: updateSmsTemplate

Update sms template

function updateSmsTemplate(templateId, smsTemplate, callback)

Parameters

ParameterTagsDescription
templateIdRequiredTemplate id
smsTemplateRequiredTemplate item

Example Usage

    var templateId = 62;
    var smsTemplate = new SmsTemplate({"key":"value"});

    controller.updateSmsTemplate(templateId, smsTemplate, function(error, response, context) {

    
    });

Method: getDeliveryReceipts

Get all delivery receipts

function getDeliveryReceipts(callback)

Example Usage

    controller.getDeliveryReceipts(function(error, response, context) {

    
    });

Method: getSmsTemplates

Get lists of all sms templates

function getSmsTemplates(callback)

Example Usage

    controller.getSmsTemplates(function(error, response, context) {

    
    });

Method: markAllInboundSMSAsRead

Mark all inbound SMS as read optionally before a certain date

function markAllInboundSMSAsRead(dateBefore, callback)

Parameters

ParameterTagsDescription
dateBeforeOptionalAn optional timestamp - mark all as read before this timestamp. If not given, all messages will be marked as read.

Example Usage

    var dateBefore = date_before;

    controller.markAllInboundSMSAsRead(dateBefore, function(error, response, context) {

    
    });

Method: getSpecificDeliveryReceipt

Get a Specific Delivery Receipt

function getSpecificDeliveryReceipt(messageId, callback)

Parameters

ParameterTagsDescription
messageIdRequiredMessage ID

Example Usage

    var messageId = message_id;

    controller.getSpecificDeliveryReceipt(messageId, function(error, response, context) {

    
    });

Method: getSmsHistory

Get all sms history

function getSmsHistory(dateFrom, dateTo, callback)

Parameters

ParameterTagsDescription
dateFromOptionalStart date
dateToOptionalEnd date

Example Usage

    var dateFrom = 62;
    var dateTo = 62;

    controller.getSmsHistory(dateFrom, dateTo, function(error, response, context) {

    
    });

Back to List of Controllers

Class: VoiceController

Get singleton instance

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

var controller = lib.VoiceController;

Method: sendVoice

Send a voice call

function sendVoice(voiceMessages, callback)

Parameters

ParameterTagsDescription
voiceMessagesRequiredVoiceMessageCollection model

Example Usage

    var voiceMessages = new VoiceMessageCollection({"key":"value"});

    controller.sendVoice(voiceMessages, function(error, response, context) {

    
    });

Method: calculatePrice

Calculate voice price

function calculatePrice(voiceMessages, callback)

Parameters

ParameterTagsDescription
voiceMessagesRequiredVoiceMessageCollection model

Example Usage

    var voiceMessages = new VoiceMessageCollection({"key":"value"});

    controller.calculatePrice(voiceMessages, function(error, response, context) {

    
    });

Method: getVoiceLanguages

Get all voice languages

function getVoiceLanguages(callback)

Example Usage

    controller.getVoiceLanguages(function(error, response, context) {

    
    });

Method: getVoiceReceipts

Get all voice receipts

function getVoiceReceipts(callback)

Example Usage

    controller.getVoiceReceipts(function(error, response, context) {

    
    });

Method: cancelVoiceMessage

Update voice message status as cancelled

function cancelVoiceMessage(messageId, callback)

Parameters

ParameterTagsDescription
messageIdRequiredYour voice message id

Example Usage

    var messageId = message_id;

    controller.cancelVoiceMessage(messageId, function(error, response, context) {

    
    });

Method: cancelVoiceMessages

Update all voice messages as cancelled

function cancelVoiceMessages(callback)

Example Usage

    controller.cancelVoiceMessages(function(error, response, context) {

    
    });

Method: exportVoiceHistory

Export voice history

function exportVoiceHistory(filename, callback)

Parameters

ParameterTagsDescription
filenameRequiredFilename to export to

Example Usage

    var filename = 'filename';

    controller.exportVoiceHistory(filename, function(error, response, context) {

    
    });

Method: getVoiceHistory

Get all voice history

function getVoiceHistory(dateFrom, dateTo, callback)

Parameters

ParameterTagsDescription
dateFromOptionalTimestamp (from) used to show records by date.
dateToOptionalTimestamp (to) used to show records by date

Example Usage

    var dateFrom = 62;
    var dateTo = 62;

    controller.getVoiceHistory(dateFrom, dateTo, 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: getAccount

Get account details

function getAccount(callback)

Example Usage

    controller.getAccount(function(error, response, context) {

    
    });

Method: createAccount

Create An Account

function createAccount(account, callback)

Parameters

ParameterTagsDescription
accountRequiredAccount model

Example Usage

    var account = new Account({"key":"value"});

    controller.createAccount(account, function(error, response, context) {

    
    });

Method: accountVerifySend

Send account activation token

function accountVerifySend(accountVerify, callback)

Parameters

ParameterTagsDescription
accountVerifyRequiredAccount details

Example Usage

    var accountVerify = new AccountVerify({"key":"value"});

    controller.accountVerifySend(accountVerify, function(error, response, context) {

    
    });

Method: accountVerify

Verify new account

function accountVerify(activationToken, callback)

Parameters

ParameterTagsDescription
activationTokenRequiredTODO: Add a parameter description

Example Usage

    var activationToken = 62;

    controller.accountVerify(activationToken, function(error, response, context) {

    
    });

Method: forgotUsername

Tags: Skips Authentication

Forgot username

function forgotUsername(email, callback)

Parameters

ParameterTagsDescription
emailRequiredEmail belonging to account

Example Usage

    var email = 'email';

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

    
    });

Method: forgotPassword

Forgot password

function forgotPassword(username, callback)

Parameters

ParameterTagsDescription
usernameRequiredUsername belonging to account

Example Usage

    var username = 'username';

    controller.forgotPassword(username, function(error, response, context) {

    
    });

Method: verifyForgotPassword

Verify forgot password

function verifyForgotPassword(verifyPassword, callback)

Parameters

ParameterTagsDescription
verifyPasswordRequiredverifyPassword data

Example Usage

    var verifyPassword = new AccountForgotPasswordVerify({"key":"value"});

    controller.verifyForgotPassword(verifyPassword, 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: getSubaccounts

Get all subaccounts

function getSubaccounts(callback)

Example Usage

    controller.getSubaccounts(function(error, response, context) {

    
    });

Method: createSubaccount

Create new subaccount

function createSubaccount(subaccount, callback)

Parameters

ParameterTagsDescription
subaccountRequiredSubaccount model

Example Usage

    var subaccount = new Subaccount({"key":"value"});

    controller.createSubaccount(subaccount, function(error, response, context) {

    
    });

Method: getSubaccount

Get specific subaccount

function getSubaccount(subaccountId, callback)

Parameters

ParameterTagsDescription
subaccountIdRequiredID of subaccount to get

Example Usage

    var subaccountId = 62;

    controller.getSubaccount(subaccountId, function(error, response, context) {

    
    });

Method: deleteSubaccount

Delete a subaccount

function deleteSubaccount(subaccountId, callback)

Parameters

ParameterTagsDescription
subaccountIdRequiredID of subaccount to delete

Example Usage

    var subaccountId = 62;

    controller.deleteSubaccount(subaccountId, function(error, response, context) {

    
    });

Method: regenerateApiKey

Regenerate an API Key

function regenerateApiKey(subaccountId, callback)

Parameters

ParameterTagsDescription
subaccountIdRequiredID of subaccount to regenerate API key for

Example Usage

    var subaccountId = 62;

    controller.regenerateApiKey(subaccountId, function(error, response, context) {

    
    });

Method: updateSubaccount

Update subaccount

function updateSubaccount(subaccountId, subaccount, callback)

Parameters

ParameterTagsDescription
subaccountIdRequiredID of subaccount to update
subaccountRequiredSubaccount model

Example Usage

    var subaccountId = 62;
    var subaccount = new Subaccount({"key":"value"});

    controller.updateSubaccount(subaccountId, subaccount, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ContactListController

Get singleton instance

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

var controller = lib.ContactListController;

Method: getContactLists

Get all contact lists

function getContactLists(callback)

Example Usage

    controller.getContactLists(function(error, response, context) {

    
    });

Method: createContactList

Create new contact list

function createContactList(listName, callback)

Parameters

ParameterTagsDescription
listNameRequiredYour contact list name

Example Usage

    var listName = list_name;

    controller.createContactList(listName, function(error, response, context) {

    
    });

Method: getContactList

Get specific contact list

function getContactList(listId, callback)

Parameters

ParameterTagsDescription
listIdRequiredList ID

Example Usage

    var listId = 62;

    controller.getContactList(listId, function(error, response, context) {

    
    });

Method: deleteContactList

Delete a specific contact list

function deleteContactList(listId, callback)

Parameters

ParameterTagsDescription
listIdRequiredList ID

Example Usage

    var listId = 62;

    controller.deleteContactList(listId, function(error, response, context) {

    
    });

Method: removeDuplicateContacts

Remove duplicate contacts

function removeDuplicateContacts(listId, callback)

Parameters

ParameterTagsDescription
listIdRequiredYour list id

Example Usage

    var listId = 62;

    controller.removeDuplicateContacts(listId, function(error, response, context) {

    
    });

Method: updateContactList

Update specific contact list

function updateContactList(listId, listName, callback)

Parameters

ParameterTagsDescription
listIdRequiredYour list id
listNameRequiredYour new list name

Example Usage

    var listId = 62;
    var listName = list_name;

    controller.updateContactList(listId, listName, function(error, response, context) {

    
    });

Method: importContactsToList

Import contacts to list

function importContactsToList(listId, file, callback)

Parameters

ParameterTagsDescription
listIdRequiredYour contact list id you want to access.
fileRequiredContactListImport model

Example Usage

    var listId = 62;
    var file = new ContactListImport({"key":"value"});

    controller.importContactsToList(listId, file, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ContactController

Get singleton instance

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

var controller = lib.ContactController;

Method: getContacts

Get all contacts in a list

function getContacts(listId, callback)

Parameters

ParameterTagsDescription
listIdRequiredContact list ID

Example Usage

    var listId = 62;

    controller.getContacts(listId, function(error, response, context) {

    
    });

Method: createContact

Create new contact

function createContact(contact, listId, callback)

Parameters

ParameterTagsDescription
contactRequiredContact model
listIdRequiredList id

Example Usage

    var contact = new Contact({"key":"value"});
    var listId = 62;

    controller.createContact(contact, listId, function(error, response, context) {

    
    });

Method: getContact

Get a specific contact

function getContact(listId, contactId, callback)

Parameters

ParameterTagsDescription
listIdRequiredYour contact list id you want to access.
contactIdRequiredYour contact id you want to access.

Example Usage

    var listId = 62;
    var contactId = 62;

    controller.getContact(listId, contactId, function(error, response, context) {

    
    });

Method: updateContact

Update contact

function updateContact(listId, contactId, contact, callback)

Parameters

ParameterTagsDescription
listIdRequiredContact list id
contactIdRequiredContact ID
contactRequiredContact model

Example Usage

    var listId = 62;
    var contactId = 62;
    var contact = new Contact({"key":"value"});

    controller.updateContact(listId, contactId, contact, function(error, response, context) {

    
    });

Method: removeOptedOutContacts

Remove all opted out contacts

function removeOptedOutContacts(listId, optOutListId, callback)

Parameters

ParameterTagsDescription
listIdRequiredYour list id
optOutListIdRequiredYour opt out list id

Example Usage

    var listId = 62;
    var optOutListId = 62;

    controller.removeOptedOutContacts(listId, optOutListId, function(error, response, context) {

    
    });

Method: deleteContact

Delete a contact

function deleteContact(listId, contactId, callback)

Parameters

ParameterTagsDescription
listIdRequiredList ID
contactIdRequiredContact ID

Example Usage

    var listId = 62;
    var contactId = 62;

    controller.deleteContact(listId, contactId, function(error, response, context) {

    
    });

Back to List of Controllers

Class: NumberController

Get singleton instance

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

var controller = lib.NumberController;

Method: getDedicatedNumbers

Get all dedicated numbers

function getDedicatedNumbers(callback)

Example Usage

    controller.getDedicatedNumbers(function(error, response, context) {

    
    });

Method: purchaseDedicatedNumber

Buy dedicated number

function purchaseDedicatedNumber(dedicatedNumber, callback)

Parameters

ParameterTagsDescription
dedicatedNumberRequiredPhone number to purchase

Example Usage

    var dedicatedNumber = dedicated_number;

    controller.purchaseDedicatedNumber(dedicatedNumber, function(error, response, context) {

    
    });

Method: getDedicatedNumbersByCountry

Get all dedicated numbers by country

function getDedicatedNumbersByCountry(country, search, searchType, callback)

Parameters

ParameterTagsDescription
countryRequiredCountry code to search
searchOptionalYour search pattern or query.
searchTypeOptionalYour strategy for searching, 0 = starts with, 1 = anywhere, 2 = ends with.

Example Usage

    var country = 'country';
    var search = 'search';
    var searchType = 62;

    controller.getDedicatedNumbersByCountry(country, search, searchType, function(error, response, context) {

    
    });

Back to List of Controllers

Class: StatisticsController

Get singleton instance

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

var controller = lib.StatisticsController;

Method: getVoiceStatistics

Get voice statistics

function getVoiceStatistics(callback)

Example Usage

    controller.getVoiceStatistics(function(error, response, context) {

    
    });

Method: getSmsStatistics

Get sms statistics

function getSmsStatistics(callback)

Example Usage

    controller.getSmsStatistics(function(error, response, context) {

    
    });

Back to List of Controllers

Class: EmailToSmsController

Get singleton instance

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

var controller = lib.EmailToSmsController;

Method: createAllowedAddress

Create email to sms allowed address

function createAllowedAddress(emailSmsAddress, callback)

Parameters

ParameterTagsDescription
emailSmsAddressRequiredEmailSMSAddress model

Example Usage

    var emailSmsAddress = new EmailSMSAddress({"key":"value"});

    controller.createAllowedAddress(emailSmsAddress, function(error, response, context) {

    
    });

Method: getAllowedAddress

Get list of email to sms allowed addresses

function getAllowedAddress(callback)

Example Usage

    controller.getAllowedAddress(function(error, response, context) {

    
    });

Back to List of Controllers

Class: SearchController

Get singleton instance

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

var controller = lib.SearchController;

Method: searchContactList

Get list of searched contact list

function searchContactList(q, callback)

Parameters

ParameterTagsDescription
qRequiredYour keyword or query.

Example Usage

    var q = 'q';

    controller.searchContactList(q, function(error, response, context) {

    
    });

Back to List of Controllers

Class: ReferralAccountController

Get singleton instance

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

var controller = lib.ReferralAccountController;

Method: getReferralAccounts

Get all referral accounts

function getReferralAccounts(callback)

Example Usage

    controller.getReferralAccounts(function(error, response, context) {

    
    });

Back to List of Controllers

Class: ResellerAccountController

Get singleton instance

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

var controller = lib.ResellerAccountController;

Method: getResellerAccounts

Get list of reseller accounts

function getResellerAccounts(callback)

Example Usage

    controller.getResellerAccounts(function(error, response, context) {

    
    });

Method: createResellerAccount

Create reseller account

function createResellerAccount(resellerAccount, callback)

Parameters

ParameterTagsDescription
resellerAccountRequiredResellerAccount model

Example Usage

    var resellerAccount = new ResellerAccount({"key":"value"});

    controller.createResellerAccount(resellerAccount, function(error, response, context) {

    
    });

Method: getResellerAccount

Get Reseller Account

function getResellerAccount(clientUserId, callback)

Parameters

ParameterTagsDescription
clientUserIdRequiredUser ID of client

Example Usage

    var clientUserId = 62;

    controller.getResellerAccount(clientUserId, function(error, response, context) {

    
    });

Method: updateResellerAccount

Reseller Account

function updateResellerAccount(clientUserId, resellerAccount, callback)

Parameters

ParameterTagsDescription
clientUserIdRequiredUser ID of client
resellerAccountRequiredResellerAccount model

Example Usage

    var clientUserId = 62;
    var resellerAccount = new ResellerAccount({"key":"value"});

    controller.updateResellerAccount(clientUserId, resellerAccount, function(error, response, context) {

    
    });

Back to List of Controllers

Class: TransferCreditController

Get singleton instance

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

var controller = lib.TransferCreditController;

Method: transferCredit

Transfer Credit

function transferCredit(resellerAccountTransferCredit, callback)

Parameters

ParameterTagsDescription
resellerAccountTransferCreditRequiredResellerAccountTransferCredit model

Example Usage

    var resellerAccountTransferCredit = new ResellerAccountTransferCredit({"key":"value"});

    controller.transferCredit(resellerAccountTransferCredit, function(error, response, context) {

    
    });

Back to List of Controllers

Class: AccountRechargeController

Get singleton instance

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

var controller = lib.AccountRechargeController;

Method: getCreditCardInfo

Get Credit Card info

function getCreditCardInfo(callback)

Example Usage

    controller.getCreditCardInfo(function(error, response, context) {

    
    });

Method: updateCreditCardInfo

Update credit card info

function updateCreditCardInfo(creditCard, callback)

Parameters

ParameterTagsDescription
creditCardRequiredCreditCard model

Example Usage

    var creditCard = new CreditCard({"key":"value"});

    controller.updateCreditCardInfo(creditCard, function(error, response, context) {

    
    });

Method: getPackagesList

Get list of all packages

function getPackagesList(country, callback)

Parameters

ParameterTagsDescription
countryOptionalCountry code

Example Usage

    var country = 'country';

    controller.getPackagesList(country, function(error, response, context) {

    
    });

Method: purchasePackage

Purchase a package

function purchasePackage(packageId, callback)

Parameters

ParameterTagsDescription
packageIdRequiredID of package to purchase

Example Usage

    var packageId = 62;

    controller.purchasePackage(packageId, function(error, response, context) {

    
    });

Method: getTransactions

Get all transactions

function getTransactions(callback)

Example Usage

    controller.getTransactions(function(error, response, context) {

    
    });

Method: getTransaction

Get specific Transaction

function getTransaction(transactionId, callback)

Parameters

ParameterTagsDescription
transactionIdRequiredID of transaction to retrieve

Example Usage

    var transactionId = transaction_id;

    controller.getTransaction(transactionId, function(error, response, context) {

    
    });

Back to List of Controllers

Class: SmsCampaignController

Get singleton instance

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

var controller = lib.SmsCampaignController;

Method: createSmsCampaign

Create sms campaign

function createSmsCampaign(campaign, callback)

Parameters

ParameterTagsDescription
campaignRequiredSmsCampaign model

Example Usage

    var campaign = new SmsCampaign({"key":"value"});

    controller.createSmsCampaign(campaign, function(error, response, context) {

    
    });

Method: calculatePrice

Calculate price for sms campaign

function calculatePrice(campaign, callback)

Parameters

ParameterTagsDescription
campaignRequiredSmsCampaign model

Example Usage

    var campaign = new SmsCampaign({"key":"value"});

    controller.calculatePrice(campaign, function(error, response, context) {

    
    });

Method: updateSmsCampaign

Update sms campaign

function updateSmsCampaign(smsCampaignId, campaign, callback)

Parameters

ParameterTagsDescription
smsCampaignIdRequiredID of SMS campaign to update
campaignRequiredSmsCampaign model

Example Usage

    var smsCampaignId = 62;
    var campaign = new SmsCampaign({"key":"value"});

    controller.updateSmsCampaign(smsCampaignId, campaign, function(error, response, context) {

    
    });

Method: cancelSmsCampaign

Cancel sms campaign

function cancelSmsCampaign(smsCampaignId, callback)

Parameters

ParameterTagsDescription
smsCampaignIdRequiredID of SMS Campaign to cancel

Example Usage

    var smsCampaignId = 62;

    controller.cancelSmsCampaign(smsCampaignId, function(error, response, context) {

    
    });

Method: getSmsCampaigns

Get list of sms campaigns

function getSmsCampaigns(callback)

Example Usage

    controller.getSmsCampaigns(function(error, response, context) {

    
    });

Method: getSmsCampaign

Get specific sms campaign

function getSmsCampaign(smsCampaignId, callback)

Parameters

ParameterTagsDescription
smsCampaignIdRequiredID of SMS campaign to retrieve

Example Usage

    var smsCampaignId = 62;

    controller.getSmsCampaign(smsCampaignId, function(error, response, context) {

    
    });

Back to List of Controllers

Class: PostLetterController

Get singleton instance

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

var controller = lib.PostLetterController;

Method: sendPostLetter

Send post letter

function sendPostLetter(postLetter, callback)

Parameters

ParameterTagsDescription
postLetterRequiredPostLetter model

Example Usage

    var postLetter = new PostLetter({"key":"value"});

    controller.sendPostLetter(postLetter, function(error, response, context) {

    
    });

Method: calculatePrice

Calculate post letter price

function calculatePrice(postLetter, callback)

Parameters

ParameterTagsDescription
postLetterRequiredPostLetter model

Example Usage

    var postLetter = new PostLetter({"key":"value"});

    controller.calculatePrice(postLetter, function(error, response, context) {

    
    });

Method: getPostLetterHistory

Get all post letter history

function getPostLetterHistory(callback)

Example Usage

    controller.getPostLetterHistory(function(error, response, context) {

    
    });

Method: exportPostLetterHistory

export post letter history

function exportPostLetterHistory(filename, callback)

Parameters

ParameterTagsDescription
filenameRequiredFilename to export to

Example Usage

    var filename = 'filename';

    controller.exportPostLetterHistory(filename, function(error, response, context) {

    
    });

Back to List of Controllers

Class: PostReturnAddressController

Get singleton instance

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

var controller = lib.PostReturnAddressController;

Method: createPostReturnAddress

Create post return address

function createPostReturnAddress(returnAddress, callback)

Parameters

ParameterTagsDescription
returnAddressRequiredAddress model

Example Usage

    var returnAddress = new Address({"key":"value"});

    controller.createPostReturnAddress(returnAddress, function(error, response, context) {

    
    });

Method: getPostReturnAddresses

Get list of post return addresses

function getPostReturnAddresses(callback)

Example Usage

    controller.getPostReturnAddresses(function(error, response, context) {

    
    });

Method: getPostReturnAddress

Get specific post return address

function getPostReturnAddress(returnAddressId, callback)

Parameters

ParameterTagsDescription
returnAddressIdRequiredReturn address ID

Example Usage

    var returnAddressId = 62;

    controller.getPostReturnAddress(returnAddressId, function(error, response, context) {

    
    });

Method: updatePostReturnAddress

Update post return address

function updatePostReturnAddress(returnAddressId, returnAddress, callback)

Parameters

ParameterTagsDescription
returnAddressIdRequiredReturn address ID
returnAddressRequiredAddress model

Example Usage

    var returnAddressId = 62;
    var returnAddress = new Address({"key":"value"});

    controller.updatePostReturnAddress(returnAddressId, returnAddress, function(error, response, context) {

    
    });

Method: deletePostReturnAddress

Delete specific post return address

function deletePostReturnAddress(returnAddressId, callback)

Parameters

ParameterTagsDescription
returnAddressIdRequiredReturn address ID

Example Usage

    var returnAddressId = 62;

    controller.deletePostReturnAddress(returnAddressId, function(error, response, context) {

    
    });

Back to List of Controllers

Class: FaxController

Get singleton instance

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

var controller = lib.FaxController;

Method: faxReceiptList

Get List of Fax Receipts

function faxReceiptList(callback)

Example Usage

    controller.faxReceiptList(function(error, response, context) {

    
    });

Method: getFaxReceipt

Get a single fax receipt based on message id.

function getFaxReceipt(messageId, callback)

Parameters

ParameterTagsDescription
messageIdRequiredID of the message receipt to retrieve

Example Usage

    var messageId = message_id;

    controller.getFaxReceipt(messageId, function(error, response, context) {

    
    });

Method: getFaxHistory

Get a list of Fax History.

function getFaxHistory(dateFrom, dateTo, q, order, callback)

Parameters

ParameterTagsDescription
dateFromOptionalCustomize result by setting from date (timestsamp) Example: 1457572619.
dateToOptionalCustomize result by setting to date (timestamp) Example: 1457573000.
qOptionalCustom query Example: status:Sent,status_code:201.
orderOptionalOrder result by Example: date_added:desc,list_id:desc.

Example Usage

    var dateFrom = 62;
    var dateTo = 62;
    var q = 'q';
    var order = 'order';

    controller.getFaxHistory(dateFrom, dateTo, q, order, function(error, response, context) {

    
    });

Method: calculatePrice

Calculate Total Price for Fax Messages sent

function calculatePrice(faxMessage, callback)

Parameters

ParameterTagsDescription
faxMessageRequiredFaxMessageCollection model

Example Usage

    var faxMessage = new FaxMessageCollection({"key":"value"});

    controller.calculatePrice(faxMessage, function(error, response, context) {

    
    });

Method: sendFax

Send a fax using supplied supported file-types.

function sendFax(faxMessage, callback)

Parameters

ParameterTagsDescription
faxMessageRequiredFaxMessageCollection model

Example Usage

    var faxMessage = new FaxMessageCollection({"key":"value"});

    controller.sendFax(faxMessage, function(error, response, context) {

    
    });

Back to List of Controllers

Class: MMSController

Get singleton instance

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

var controller = lib.MMSController;

Method: (https://