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

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


This will install all dependencies in the node_modules
folder.
Once dependencies are resolved, you will need to move the folder 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
.

Select the folder of your SDK and click on Select Folder
to open it up in Sublime Text. The folder will become visible in the bar on the left.

2. Creating a Test File
Now right click on the folder name and select the New File
option to create a new test file. Save it as index.js
Now import the generated NodeJS library using the following lines of code:
var lib = require('lib');
Save changes.


3. Running The Test File
To run the index.js
file, open up the command prompt and navigate to the Path where the SDK folder resides. Type the following command to run the file:
node index.js

How to Test
These tests use Mocha framework for testing, coupled with Chai for assertions. These dependencies need to be installed for tests to run.
Tests can be run in a number of ways:
Method 1 (Run all tests)
- Navigate to the root directory of the SDK folder from command prompt.
- Type
mocha --recursive
to run all the tests.
Method 2 (Run all tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha *
to run all the tests.
Method 3 (Run specific controller's tests)
- Navigate to the
../test/Controllers/
directory from command prompt. - Type
mocha 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
.

Initialization
Authentication
In order to setup authentication in the API client, you need the following information.
Parameter | Description |
---|
username | your username |
key | your api key |
API client can be initialized as following:
const lib = require('lib');
lib.Configuration.username = "username";
lib.Configuration.key = "key";
Class Reference
List of Controllers
CountriesController
Get singleton instance
The singleton instance of the CountriesController
class can be accessed from the API Client.
var controller = lib.CountriesController;
getCountries
Tags: Skips Authentication
Get all countries
function getCountries(callback)
Example Usage
controller.getCountries(function(error, response, context) {
});
Back to List of Controllers
SMSController
Get singleton instance
The singleton instance of the SMSController
class can be accessed from the API Client.
var controller = lib.SMSController;
sendSms
Send one or more SMS messages
function sendSms(smsMessages, callback)
Parameters
Parameter | Tags | Description |
---|
smsMessages | Required | SmsMessageCollection model |
Example Usage
var smsMessages = new SmsMessageCollection({"key":"value"});
controller.sendSms(smsMessages, function(error, response, context) {
});
calculatePrice
Calculate sms price
function calculatePrice(smsMessages, callback)
Parameters
Parameter | Tags | Description |
---|
smsMessages | Required | SmsMessageCollection model |
Example Usage
var smsMessages = new SmsMessageCollection({"key":"value"});
controller.calculatePrice(smsMessages, function(error, response, context) {
});
exportHistory
Export all sms history
function exportHistory(filename, callback)
Parameters
Parameter | Tags | Description |
---|
filename | Required | Filename to download history as |
Example Usage
var filename = 'filename';
controller.exportHistory(filename, function(error, response, context) {
});
createReceipt
Add a delivery receipt
function createReceipt(url, callback)
Parameters
Parameter | Tags | Description |
---|
url | Required | Your url |
Example Usage
var url = 'url';
controller.createReceipt(url, function(error, response, context) {
});
markReceiptsAsRead
Marked delivery receipts as read
function markReceiptsAsRead(dateBefore, callback)
Parameters
Parameter | Tags | Description |
---|
dateBefore | Optional | Mark all as read before this timestamp |
Example Usage
var dateBefore = date_before;
controller.markReceiptsAsRead(dateBefore, function(error, response, context) {
});
getInboundSms
Get all inbound sms
function getInboundSms(callback)
Example Usage
controller.getInboundSms(function(error, response, context) {
});
createInboundSms
Create inbound sms
function createInboundSms(url, callback)
Parameters
Parameter | Tags | Description |
---|
url | Required | Your url |
Example Usage
var url = 'url';
controller.createInboundSms(url, function(error, response, context) {
});
cancelScheduledSms
Update scheduled message as cancel
function cancelScheduledSms(messageId, callback)
Parameters
Parameter | Tags | Description |
---|
messageId | Required | The message ID you want to cancel |
Example Usage
var messageId = message_id;
controller.cancelScheduledSms(messageId, function(error, response, context) {
});
cancelAllScheduledSms
Update all scheduled message as cancelled
function cancelAllScheduledSms(callback)
Example Usage
controller.cancelAllScheduledSms(function(error, response, context) {
});
createSmsTemplate
Create sms template
function createSmsTemplate(smsTemplate, callback)
Parameters
Parameter | Tags | Description |
---|
smsTemplate | Required | SmsTemplate model |
Example Usage
var smsTemplate = new SmsTemplate({"key":"value"});
controller.createSmsTemplate(smsTemplate, function(error, response, context) {
});
deleteSmsTemplate
Delete sms template
function deleteSmsTemplate(templateId, callback)
Parameters
Parameter | Tags | Description |
---|
templateId | Required | Template id |
Example Usage
var templateId = 145;
controller.deleteSmsTemplate(templateId, function(error, response, context) {
});
updateSmsTemplate
Update sms template
function updateSmsTemplate(templateId, smsTemplate, callback)
Parameters
Parameter | Tags | Description |
---|
templateId | Required | Template id |
smsTemplate | Required | Template item |
Example Usage
var templateId = 145;
var smsTemplate = new SmsTemplate({"key":"value"});
controller.updateSmsTemplate(templateId, smsTemplate, function(error, response, context) {
});
getDeliveryReceipts
Get all delivery receipts
function getDeliveryReceipts(callback)
Example Usage
controller.getDeliveryReceipts(function(error, response, context) {
});
getSmsTemplates
Get lists of all sms templates
function getSmsTemplates(callback)
Example Usage
controller.getSmsTemplates(function(error, response, context) {
});
markAllInboundSMSAsRead
Mark all inbound SMS as read optionally before a certain date
function markAllInboundSMSAsRead(dateBefore, callback)
Parameters
Parameter | Tags | Description |
---|
dateBefore | Optional | An 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) {
});
getSpecificDeliveryReceipt
Get a Specific Delivery Receipt
function getSpecificDeliveryReceipt(messageId, callback)
Parameters
Parameter | Tags | Description |
---|
messageId | Required | Message ID |
Example Usage
var messageId = message_id;
controller.getSpecificDeliveryReceipt(messageId, function(error, response, context) {
});
getSmsHistory
Get all sms history
function getSmsHistory(dateFrom, dateTo, callback)
Parameters
Parameter | Tags | Description |
---|
dateFrom | Optional | Start date |
dateTo | Optional | End date |
Example Usage
var dateFrom = 145;
var dateTo = 145;
controller.getSmsHistory(dateFrom, dateTo, function(error, response, context) {
});
Back to List of Controllers
VoiceController
Get singleton instance
The singleton instance of the VoiceController
class can be accessed from the API Client.
var controller = lib.VoiceController;
sendVoice
Send a voice call
function sendVoice(voiceMessages, callback)
Parameters
Parameter | Tags | Description |
---|
voiceMessages | Required | VoiceMessageCollection model |
Example Usage
var voiceMessages = new VoiceMessageCollection({"key":"value"});
controller.sendVoice(voiceMessages, function(error, response, context) {
});
calculatePrice
Calculate voice price
function calculatePrice(voiceMessages, callback)
Parameters
Parameter | Tags | Description |
---|
voiceMessages | Required | VoiceMessageCollection model |
Example Usage
var voiceMessages = new VoiceMessageCollection({"key":"value"});
controller.calculatePrice(voiceMessages, function(error, response, context) {
});
getVoiceLanguages
Get all voice languages
function getVoiceLanguages(callback)
Example Usage
controller.getVoiceLanguages(function(error, response, context) {
});
getVoiceReceipts
Get all voice receipts
function getVoiceReceipts(callback)
Example Usage
controller.getVoiceReceipts(function(error, response, context) {
});
cancelVoiceMessage
Update voice message status as cancelled
function cancelVoiceMessage(messageId, callback)
Parameters
Parameter | Tags | Description |
---|
messageId | Required | Your voice message id |
Example Usage
var messageId = message_id;
controller.cancelVoiceMessage(messageId, function(error, response, context) {
});
cancelVoiceMessages
Update all voice messages as cancelled
function cancelVoiceMessages(callback)
Example Usage
controller.cancelVoiceMessages(function(error, response, context) {
});
exportVoiceHistory
Export voice history
function exportVoiceHistory(filename, callback)
Parameters
Parameter | Tags | Description |
---|
filename | Required | Filename to export to |
Example Usage
var filename = 'filename';
controller.exportVoiceHistory(filename, function(error, response, context) {
});
getVoiceHistory
Get all voice history
function getVoiceHistory(dateFrom, dateTo, callback)
Parameters
Parameter | Tags | Description |
---|
dateFrom | Optional | Timestamp (from) used to show records by date. |
dateTo | Optional | Timestamp (to) used to show records by date |
Example Usage
var dateFrom = 145;
var dateTo = 145;
controller.getVoiceHistory(dateFrom, dateTo, function(error, response, context) {
});
Back to List of Controllers
AccountController
Get singleton instance
The singleton instance of the AccountController
class can be accessed from the API Client.
var controller = lib.AccountController;
getAccount
Get account details
function getAccount(callback)
Example Usage
controller.getAccount(function(error, response, context) {
});
createAccount
Create An Account
function createAccount(account, callback)
Parameters
Parameter | Tags | Description |
---|
account | Required | Account model |
Example Usage
var account = new Account({"key":"value"});
controller.createAccount(account, function(error, response, context) {
});
accountVerifySend
Send account activation token
function accountVerifySend(accountVerify, callback)
Parameters
Parameter | Tags | Description |
---|
accountVerify | Required | Account details |
Example Usage
var accountVerify = new AccountVerify({"key":"value"});
controller.accountVerifySend(accountVerify, function(error, response, context) {
});
accountVerify
Verify new account
function accountVerify(activationToken, callback)
Parameters
Parameter | Tags | Description |
---|
activationToken | Required | TODO: Add a parameter description |
Example Usage
var activationToken = 145;
controller.accountVerify(activationToken, function(error, response, context) {
});
forgotUsername
Tags: Skips Authentication
Forgot username
function forgotUsername(email, callback)
Parameters
Parameter | Tags | Description |
---|
email | Required | Email belonging to account |
Example Usage
var email = 'email';
controller.forgotUsername(email, function(error, response, context) {
});
forgotPassword
Forgot password
function forgotPassword(username, callback)
Parameters
Parameter | Tags | Description |
---|
username | Required | Username belonging to account |
Example Usage
var username = 'username';
controller.forgotPassword(username, function(error, response, context) {
});
verifyForgotPassword
Verify forgot password
function verifyForgotPassword(verifyPassword, callback)
Parameters
Parameter | Tags | Description |
---|
verifyPassword | Required | verifyPassword data |
Example Usage
var verifyPassword = new AccountForgotPasswordVerify({"key":"value"});
controller.verifyForgotPassword(verifyPassword, function(error, response, context) {
});
Back to List of Controllers
SubaccountController
Get singleton instance
The singleton instance of the SubaccountController
class can be accessed from the API Client.
var controller = lib.SubaccountController;
getSubaccounts
Get all subaccounts
function getSubaccounts(callback)
Example Usage
controller.getSubaccounts(function(error, response, context) {
});
createSubaccount
Create new subaccount
function createSubaccount(subaccount, callback)
Parameters
Parameter | Tags | Description |
---|
subaccount | Required | Subaccount model |
Example Usage
var subaccount = new Subaccount({"key":"value"});
controller.createSubaccount(subaccount, function(error, response, context) {
});
getSubaccount
Get specific subaccount
function getSubaccount(subaccountId, callback)
Parameters
Parameter | Tags | Description |
---|
subaccountId | Required | ID of subaccount to get |
Example Usage
var subaccountId = 103;
controller.getSubaccount(subaccountId, function(error, response, context) {
});
deleteSubaccount
Delete a subaccount
function deleteSubaccount(subaccountId, callback)
Parameters
Parameter | Tags | Description |
---|
subaccountId | Required | ID of subaccount to delete |
Example Usage
var subaccountId = 103;
controller.deleteSubaccount(subaccountId, function(error, response, context) {
});
regenerateApiKey
Regenerate an API Key
function regenerateApiKey(subaccountId, callback)
Parameters
Parameter | Tags | Description |
---|
subaccountId | Required | ID of subaccount to regenerate API key for |
Example Usage
var subaccountId = 103;
controller.regenerateApiKey(subaccountId, function(error, response, context) {
});
updateSubaccount
Update subaccount
function updateSubaccount(subaccountId, subaccount, callback)
Parameters
Parameter | Tags | Description |
---|
subaccountId | Required | ID of subaccount to update |
subaccount | Required | Subaccount model |
Example Usage
var subaccountId = 103;
var subaccount = new Subaccount({"key":"value"});
controller.updateSubaccount(subaccountId, subaccount, function(error, response, context) {
});
Back to List of Controllers
ContactListController
Get singleton instance
The singleton instance of the ContactListController
class can be accessed from the API Client.
var controller = lib.ContactListController;
getContactLists
Get all contact lists
function getContactLists(callback)
Example Usage
controller.getContactLists(function(error, response, context) {
});
createContactList
Create new contact list
function createContactList(listName, callback)
Parameters
Parameter | Tags | Description |
---|
listName | Required | Your contact list name |
Example Usage
var listName = list_name;
controller.createContactList(listName, function(error, response, context) {
});
getContactList
Get specific contact list
function getContactList(listId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | List ID |
Example Usage
var listId = 103;
controller.getContactList(listId, function(error, response, context) {
});
deleteContactList
Delete a specific contact list
function deleteContactList(listId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | List ID |
Example Usage
var listId = 103;
controller.deleteContactList(listId, function(error, response, context) {
});
removeDuplicateContacts
Remove duplicate contacts
function removeDuplicateContacts(listId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Your list id |
Example Usage
var listId = 103;
controller.removeDuplicateContacts(listId, function(error, response, context) {
});
updateContactList
Update specific contact list
function updateContactList(listId, listName, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Your list id |
listName | Required | Your new list name |
Example Usage
var listId = 103;
var listName = list_name;
controller.updateContactList(listId, listName, function(error, response, context) {
});
importContactsToList
Import contacts to list
function importContactsToList(listId, file, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Your contact list id you want to access. |
file | Required | ContactListImport model |
Example Usage
var listId = 103;
var file = new ContactListImport({"key":"value"});
controller.importContactsToList(listId, file, function(error, response, context) {
});
Back to List of Controllers
ContactController
Get singleton instance
The singleton instance of the ContactController
class can be accessed from the API Client.
var controller = lib.ContactController;
getContacts
Get all contacts in a list
function getContacts(listId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Contact list ID |
Example Usage
var listId = 103;
controller.getContacts(listId, function(error, response, context) {
});
createContact
Create new contact
function createContact(contact, listId, callback)
Parameters
Parameter | Tags | Description |
---|
contact | Required | Contact model |
listId | Required | List id |
Example Usage
var contact = new Contact({"key":"value"});
var listId = 103;
controller.createContact(contact, listId, function(error, response, context) {
});
getContact
Get a specific contact
function getContact(listId, contactId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Your contact list id you want to access. |
contactId | Required | Your contact id you want to access. |
Example Usage
var listId = 103;
var contactId = 103;
controller.getContact(listId, contactId, function(error, response, context) {
});
updateContact
Update contact
function updateContact(listId, contactId, contact, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Contact list id |
contactId | Required | Contact ID |
contact | Required | Contact model |
Example Usage
var listId = 103;
var contactId = 103;
var contact = new Contact({"key":"value"});
controller.updateContact(listId, contactId, contact, function(error, response, context) {
});
removeOptedOutContacts
Remove all opted out contacts
function removeOptedOutContacts(listId, optOutListId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | Your list id |
optOutListId | Required | Your opt out list id |
Example Usage
var listId = 103;
var optOutListId = 103;
controller.removeOptedOutContacts(listId, optOutListId, function(error, response, context) {
});
deleteContact
Delete a contact
function deleteContact(listId, contactId, callback)
Parameters
Parameter | Tags | Description |
---|
listId | Required | List ID |
contactId | Required | Contact ID |
Example Usage
var listId = 103;
var contactId = 103;
controller.deleteContact(listId, contactId, function(error, response, context) {
});
Back to List of Controllers
NumberController
Get singleton instance
The singleton instance of the NumberController
class can be accessed from the API Client.
var controller = lib.NumberController;
getDedicatedNumbers
Get all dedicated numbers
function getDedicatedNumbers(callback)
Example Usage
controller.getDedicatedNumbers(function(error, response, context) {
});
purchaseDedicatedNumber
Buy dedicated number
function purchaseDedicatedNumber(dedicatedNumber, callback)
Parameters
Parameter | Tags | Description |
---|
dedicatedNumber | Required | Phone number to purchase |
Example Usage
var dedicatedNumber = dedicated_number;
controller.purchaseDedicatedNumber(dedicatedNumber, function(error, response, context) {
});
getDedicatedNumbersByCountry
Get all dedicated numbers by country
function getDedicatedNumbersByCountry(country, search, searchType, callback)
Parameters
Parameter | Tags | Description |
---|
country | Required | Country code to search |
search | Optional | Your search pattern or query. |
searchType | Optional | Your strategy for searching, 0 = starts with, 1 = anywhere, 2 = ends with. |
Example Usage
var country = 'country';
var search = 'search';
var searchType = 103;
controller.getDedicatedNumbersByCountry(country, search, searchType, function(error, response, context) {
});
Back to List of Controllers
StatisticsController
Get singleton instance
The singleton instance of the StatisticsController
class can be accessed from the API Client.
var controller = lib.StatisticsController;
getVoiceStatistics
Get voice statistics
function getVoiceStatistics(callback)
Example Usage
controller.getVoiceStatistics(function(error, response, context) {
});
getSmsStatistics
Get sms statistics
function getSmsStatistics(callback)
Example Usage
controller.getSmsStatistics(function(error, response, context) {
});
Back to List of Controllers
EmailToSmsController
Get singleton instance
The singleton instance of the EmailToSmsController
class can be accessed from the API Client.
var controller = lib.EmailToSmsController;
createAllowedAddress
Create email to sms allowed address
function createAllowedAddress(emailSmsAddress, callback)
Parameters
Parameter | Tags | Description |
---|
emailSmsAddress | Required | EmailSMSAddress model |
Example Usage
var emailSmsAddress = new EmailSMSAddress({"key":"value"});
controller.createAllowedAddress(emailSmsAddress, function(error, response, context) {
});
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
SearchController
Get singleton instance
The singleton instance of the SearchController
class can be accessed from the API Client.
var controller = lib.SearchController;
searchContactList
Get list of searched contact list
function searchContactList(q, callback)
Parameters
Parameter | Tags | Description |
---|
q | Required | Your keyword or query. |
Example Usage
var q = 'q';
controller.searchContactList(q, function(error, response, context) {
});
Back to List of Controllers
ReferralAccountController
Get singleton instance
The singleton instance of the ReferralAccountController
class can be accessed from the API Client.
var controller = lib.ReferralAccountController;
getReferralAccounts
Get all referral accounts
function getReferralAccounts(callback)
Example Usage
controller.getReferralAccounts(function(error, response, context) {
});
Back to List of Controllers
ResellerAccountController
Get singleton instance
The singleton instance of the ResellerAccountController
class can be accessed from the API Client.
var controller = lib.ResellerAccountController;
getResellerAccounts
Get list of reseller accounts
function getResellerAccounts(callback)
Example Usage
controller.getResellerAccounts(function(error, response, context) {
});
createResellerAccount
Create reseller account
function createResellerAccount(resellerAccount, callback)
Parameters
Parameter | Tags | Description |
---|
resellerAccount | Required | ResellerAccount model |
Example Usage
var resellerAccount = new ResellerAccount({"key":"value"});
controller.createResellerAccount(resellerAccount, function(error, response, context) {
});
getResellerAccount
Get Reseller Account
function getResellerAccount(clientUserId, callback)
Parameters
Parameter | Tags | Description |
---|
clientUserId | Required | User ID of client |
Example Usage
var clientUserId = 103;
controller.getResellerAccount(clientUserId, function(error, response, context) {
});
updateResellerAccount
Reseller Account
function updateResellerAccount(clientUserId, resellerAccount, callback)
Parameters
Parameter | Tags | Description |
---|
clientUserId | Required | User ID of client |
resellerAccount | Required | ResellerAccount model |
Example Usage
var clientUserId = 103;
var resellerAccount = new ResellerAccount({"key":"value"});
controller.updateResellerAccount(clientUserId, resellerAccount, function(error, response, context) {
});
Back to List of Controllers
TransferCreditController
Get singleton instance
The singleton instance of the TransferCreditController
class can be accessed from the API Client.
var controller = lib.TransferCreditController;
transferCredit
Transfer Credit
function transferCredit(resellerAccountTransferCredit, callback)
Parameters
Parameter | Tags | Description |
---|
resellerAccountTransferCredit | Required | ResellerAccountTransferCredit model |
Example Usage
var resellerAccountTransferCredit = new ResellerAccountTransferCredit({"key":"value"});
controller.transferCredit(resellerAccountTransferCredit, function(error, response, context) {
});
Back to List of Controllers
AccountRechargeController
Get singleton instance
The singleton instance of the AccountRechargeController
class can be accessed from the API Client.
var controller = lib.AccountRechargeController;
getCreditCardInfo
Get Credit Card info
function getCreditCardInfo(callback)
Example Usage
controller.getCreditCardInfo(function(error, response, context) {
});
updateCreditCardInfo
Update credit card info
function updateCreditCardInfo(creditCard, callback)
Parameters
Parameter | Tags | Description |
---|
creditCard | Required | CreditCard model |
Example Usage
var creditCard = new CreditCard({"key":"value"});
controller.updateCreditCardInfo(creditCard, function(error, response, context) {
});
getPackagesList
Get list of all packages
function getPackagesList(country, callback)
Parameters
Parameter | Tags | Description |
---|
country | Optional | Country code |
Example Usage
var country = 'country';
controller.getPackagesList(country, function(error, response, context) {
});
purchasePackage
Purchase a package
function purchasePackage(packageId, callback)
Parameters
Parameter | Tags | Description |
---|
packageId | Required | ID of package to purchase |
Example Usage
var packageId = 103;
controller.purchasePackage(packageId, function(error, response, context) {
});
getTransactions
Get all transactions
function getTransactions(callback)
Example Usage
controller.getTransactions(function(error, response, context) {
});
getTransaction
Get specific Transaction
function getTransaction(transactionId, callback)
Parameters
Parameter | Tags | Description |
---|
transactionId | Required | ID of transaction to retrieve |
Example Usage
var transactionId = transaction_id;
controller.getTransaction(transactionId, function(error, response, context) {
});
Back to List of Controllers
SmsCampaignController
Get singleton instance
The singleton instance of the SmsCampaignController
class can be accessed from the API Client.
var controller = lib.SmsCampaignController;
createSmsCampaign
Create sms campaign
function createSmsCampaign(campaign, callback)
Parameters
Parameter | Tags | Description |
---|
campaign | Required | SmsCampaign model |
Example Usage
var campaign = new SmsCampaign({"key":"value"});
controller.createSmsCampaign(campaign, function(error, response, context) {
});
calculatePrice
Calculate price for sms campaign
function calculatePrice(campaign, callback)
Parameters
Parameter | Tags | Description |
---|
campaign | Required | SmsCampaign model |
Example Usage
var campaign = new SmsCampaign({"key":"value"});
controller.calculatePrice(campaign, function(error, response, context) {
});
updateSmsCampaign
Update sms campaign
function updateSmsCampaign(smsCampaignId, campaign, callback)
Parameters
Parameter | Tags | Description |
---|
smsCampaignId | Required | ID of SMS campaign to update |
campaign | Required | SmsCampaign model |
Example Usage
var smsCampaignId = 103;
var campaign = new SmsCampaign({"key":"value"});
controller.updateSmsCampaign(smsCampaignId, campaign, function(error, response, context) {
});
cancelSmsCampaign
Cancel sms campaign
function cancelSmsCampaign(smsCampaignId, callback)
Parameters
Parameter | Tags | Description |
---|
smsCampaignId | Required | ID of SMS Campaign to cancel |
Example Usage
var smsCampaignId = 103;
controller.cancelSmsCampaign(smsCampaignId, function(error, response, context) {
});
getSmsCampaigns
Get list of sms campaigns
function getSmsCampaigns(callback)
Example Usage
controller.getSmsCampaigns(function(error, response, context) {
});
getSmsCampaign
Get specific sms campaign
function getSmsCampaign(smsCampaignId, callback)
Parameters
Parameter | Tags | Description |
---|
smsCampaignId | Required | ID of SMS campaign to retrieve |
Example Usage
var smsCampaignId = 103;
controller.getSmsCampaign(smsCampaignId, function(error, response, context) {
});
Back to List of Controllers
PostLetterController
Get singleton instance
The singleton instance of the PostLetterController
class can be accessed from the API Client.
var controller = lib.PostLetterController;
sendPostLetter
Send post letter
function sendPostLetter(postLetter, callback)
Parameters
Parameter | Tags | Description |
---|
postLetter | Required | PostLetter model |
Example Usage
var postLetter = new PostLetter({"key":"value"});
controller.sendPostLetter(postLetter, function(error, response, context) {
});
calculatePrice
Calculate post letter price
function calculatePrice(postLetter, callback)
Parameters
Parameter | Tags | Description |
---|
postLetter | Required | PostLetter model |
Example Usage
var postLetter = new PostLetter({"key":"value"});
controller.calculatePrice(postLetter, function(error, response, context) {
});
getPostLetterHistory
Get all post letter history
function getPostLetterHistory(callback)
Example Usage
controller.getPostLetterHistory(function(error, response, context) {
});
exportPostLetterHistory
export post letter history
function exportPostLetterHistory(filename, callback)
Parameters
Parameter | Tags | Description |
---|
filename | Required | Filename to export to |
Example Usage
var filename = 'filename';
controller.exportPostLetterHistory(filename, function(error, response, context) {
});
Back to List of Controllers
PostReturnAddressController
Get singleton instance
The singleton instance of the PostReturnAddressController
class can be accessed from the API Client.
var controller = lib.PostReturnAddressController;
createPostReturnAddress
Create post return address
function createPostReturnAddress(returnAddress, callback)
Parameters
Parameter | Tags | Description |
---|
returnAddress | Required | Address model |
Example Usage
var returnAddress = new Address({"key":"value"});
controller.createPostReturnAddress(returnAddress, function(error, response, context) {
});
getPostReturnAddresses
Get list of post return addresses
function getPostReturnAddresses(callback)
Example Usage
controller.getPostReturnAddresses(function(error, response, context) {
});
getPostReturnAddress
Get specific post return address
function getPostReturnAddress(returnAddressId, callback)
Parameters
Parameter | Tags | Description |
---|
returnAddressId | Required | Return address ID |
Example Usage
var returnAddressId = 103;
controller.getPostReturnAddress(returnAddressId, function(error, response, context) {
});
updatePostReturnAddress
Update post return address
function updatePostReturnAddress(returnAddressId, returnAddress, callback)
Parameters
Parameter | Tags | Description |
---|
returnAddressId | Required | Return address ID |
returnAddress | Required | Address model |
Example Usage
var returnAddressId = 103;
var returnAddress = new Address({"key":"value"});
controller.updatePostReturnAddress(returnAddressId, returnAddress, function(error, response, context) {
});
deletePostReturnAddress
Delete specific post return address
function deletePostReturnAddress(returnAddressId, callback)
Parameters
Parameter | Tags | Description |
---|
returnAddressId | Required | Return address ID |
Example Usage
var returnAddressId = 103;
controller.deletePostReturnAddress(returnAddressId, function(error, response, context) {
});
Back to List of Controllers
FaxController
Get singleton instance
The singleton instance of the FaxController
class can be accessed from the API Client.
var controller = lib.FaxController;
faxReceiptList
Get List of Fax Receipts
function faxReceiptList(callback)
Example Usage
controller.faxReceiptList(function(error, response, context) {
});
getFaxReceipt
Get a single fax receipt based on message id.
function getFaxReceipt(messageId, callback)
Parameters
Parameter | Tags | Description |
---|
messageId | Required | ID of the message receipt to retrieve |
Example Usage
var messageId = message_id;
controller.getFaxReceipt(messageId, function(error, response, context) {
});
getFaxHistory
Get a list of Fax History.
function getFaxHistory(dateFrom, dateTo, q, order, callback)
Parameters
Parameter | Tags | Description |
---|
dateFrom | Optional | Customize result by setting from date (timestsamp) Example: 1457572619. |
dateTo | Optional | Customize result by setting to date (timestamp) Example: 1457573000. |
q | Optional | Custom query Example: status:Sent,status_code:201. |
order | Optional | Order result by Example: date_added:desc,list_id:desc. |
Example Usage
var dateFrom = 103;
var dateTo = 103;
var q = 'q';
var order = 'order';
controller.getFaxHistory(dateFrom, dateTo, q, order, function(error, response, context) {
});
calculatePrice
Calculate Total Price for Fax Messages sent
function calculatePrice(faxMessage, callback)
Parameters
Parameter | Tags | Description |
---|
faxMessage | Required | FaxMessageCollection model |
Example Usage
var faxMessage = new FaxMessageCollection({"key":"value"});
controller.calculatePrice(faxMessage, function(error, response, context) {
});
sendFax
Send a fax using supplied supported file-types.
function sendFax(faxMessage, callback)
Parameters
Parameter | Tags | Description |
---|
faxMessage | Required | FaxMessageCollection model |
Example Usage
var faxMessage = new FaxMessageCollection({"key":"value"});
controller.sendFax(faxMessage, function(error, response, context) {
});
Back to List of Controllers
MMSController
Get singleton instance
The singleton instance of the MMSController
class can be accessed from the API Client.
var controller = lib.MMSController;
sendMMS
TODO: Add a method description
function sendMMS(mmsMessages, callback)
Parameters
Parameter | Tags | Description |
---|
mmsMessages | Required | MmsMessageCollection model |
Example Usage
var mmsMessages = new MmsMessageCollection({"key":"value"});
controller.sendMMS(mmsMessages, function(error, response, context) {
});
getPrice
Get Price for MMS sent
function getPrice(mmsMessages, callback)
Parameters
Parameter | Tags | Description |
---|
mmsMessages | Required | MmsMessageCollection model |
Example Usage
var mmsMessages = new MmsMessageCollection({"key":"value"});
controller.getPrice(mmsMessages, function(error, response, context) {
});
Back to List of Controllers
PostPostcardController
Get singleton instance
The singleton instance of the PostPostcardController
class can be accessed from the API Client.
var controller = lib.PostPostcardController;
sendPostcard
Send one or more postcards
function sendPostcard(postPostcards, callback)
Parameters
Parameter | Tags | Description |
---|
postPostcards | Required | PostPostcard model |
Example Usage
var postPostcards = new PostPostcard({"key":"value"});
controller.sendPostcard(postPostcards, function(error, response, context) {
});
calculatePrice
Calculate price for sending one or more postcards
function calculatePrice(postPostcards, callback)
Parameters
Parameter | Tags | Description |
---|
postPostcards | Required | PostPostcard model |
Example Usage
var postPostcards = new PostPostcard({"key":"value"});
controller.calculatePrice(postPostcards, function(error, response, context) {
});
getPostcardHistory
Retrieve the history of postcards sent or scheduled
function getPostcardHistory(callback)
Example Usage
controller.getPostcardHistory(function(error, response, context) {
});
exportPostcardHistory
Export postcard history to a CSV file
function exportPostcardHistory(filename, callback)
Parameters
Parameter | Tags | Description |
---|
filename | Required | Filename to export to |
Example Usage
var filename = 'filename';
controller.exportPostcardHistory(filename, function(error, response, context) {
});
Back to List of Controllers
UploadController
Get singleton instance
The singleton instance of the UploadController
class can be accessed from the API Client.
var controller = lib.UploadController;
uploadFile
Upload a file
function uploadFile(file, convert, callback)
Parameters
Parameter | Tags | Description |
---|
file | Required | The file to be uploaded |
convert | Required | The product that this file will be used with e.g. 'fax', 'mms', 'csv' or 'post' |
Example Usage
TestHelper.getFilePath('url', function(data) {
var file = data;
var convert = 'convert';
controller.uploadFile(file, convert, function(error, response, context) {
});
});
uploadFile1
TODO: Add a method description
function uploadFile1(content, convert, callback)
Parameters
Parameter | Tags | Description |
---|
content | Required | Base64-encoded file contents |
convert | Required | TODO: Add a parameter description |
Example Usage
var content = 'content';
var convert = 'convert';
controller.uploadFile1(content, convert, function(error, response, context) {
});
Back to List of Controllers
PostDirectMailController
Get singleton instance
The singleton instance of the PostDirectMailController
class can be accessed from the API Client.
var controller = lib.PostDirectMailController;
locationSearch
Search for a location
function locationSearch(country, q, callback)
Parameters
Parameter | Tags | Description |
---|
country | Required | Country Code to search |
q | Required | Search term (e.g. post code, city name) |
Example Usage
var country = 'country';
var q = 'q';
controller.locationSearch(country, q, function(error, response, context) {
});
sendCampaign
TODO: Add a method description
function sendCampaign(postDirectMail, callback)
Parameters
Parameter | Tags | Description |
---|
postDirectMail | Required | PostDirectMail model |
Example Usage
var postDirectMail = new PostDirectMail({"key":"value"});
controller.sendCampaign(postDirectMail, function(error, response, context) {
});
calculatePrice
Calculate direct mail campaign price
function calculatePrice(postDirectMail, callback)
Parameters
Parameter | Tags | Description |
---|
postDirectMail | Required | PostDirectMail model |
Example Usage
var postDirectMail = new PostDirectMail({"key":"value"});
controller.calculatePrice(postDirectMail, function(error, response, context) {
});
campaigns
Get direct mail campaigns
function campaigns(callback)
Example Usage
controller.campaigns(function(error, response, context) {
});
Back to List of Controllers