This page has sample code for :

  • Add SMS  number for given personnel
  • List SMS numbers for given personnel
  • Delete SMS numbers for given personnel
  • Delete one SMS number for given personnel

Above code wraps underlying API calls to create, delete, read voice numbers . Please refer to here   for details about the group api.

SMS is a sub-resource for personnel.

/**
 * 
 */
package com.braango.virtualdealer.personnel.sms;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.SmsApi;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.SmsInput;
import com.braango.client.braangomodel.SmsInputBody;
import com.braango.client.braangomodel.SmsOutput;
import com.braango.client.braangomodel.SmsOutputBodyDataSmsList;

/**
 * @author braango
 * 
 *         Sample code showing how to create new SMS number for personnel
 *
 */
public class CreateSMS {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		SmsApi smsApi = new SmsApi(braangoApiClient);

		ApiCallback<SmsOutput> callBack = new ApiCallback<SmsOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(SmsOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<SmsOutputBodyDataSmsList> smsList = result.getBody()
						.getData().getSmsList();

				System.out.println("SMS LIST : " + smsList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		// PersonnelRequestInput wraps RequestHeader and personnelRequestBody
		SmsInput smsInput = new SmsInput();

		/*
		 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
		 * "account_type": "partner" }
		 */
		RequestHeader hdr = new RequestHeader();

		// Set the account type to partner for
		// virtual dealer and partner hosted
		// accounts

		hdr.setAccountType("partner");

		// dealer_api_key returned
		// when partner_dealer was created

		hdr.setApiKey(apiKey);

		// ID that will be reflected back
		hdr.setId("sms-create-s1002r2");
		smsInput.setHeader(hdr);

		SmsInputBody body = new SmsInputBody();

		// Create new SMS number for this personnel
		body.setSmsNumber("4088723444");

		smsInput.setBody(body);

		try {
			String subDealerId = "subdealers1002";
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			smsApi.createSmsAsync(subDealerId, salesPersonId, smsInput,
					callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.sms;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.SmsApi;
import com.braango.client.braangomodel.SmsOutput;
import com.braango.client.braangomodel.SmsOutputBodyDataSmsList;

/**
 * @author braango
 * 
 * Sample code showing how to get SMS number list for 
 * given personnel
 * 
 */
public class GetSMS {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		SmsApi smsApi = new SmsApi(braangoApiClient);

		ApiCallback<SmsOutput> callBack = new ApiCallback<SmsOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(SmsOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<SmsOutputBodyDataSmsList> smsList = result.getBody()
						.getData().getSmsList();

				System.out.println("SMS LIST : " + smsList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			smsApi.readSmsAsync(subDealerId, salesPersonId, 
					            apiKey, accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.sms;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.SmsApi;
import com.braango.client.braangomodel.SmsOutput;
import com.braango.client.braangomodel.SmsOutputBodyDataSmsList;

/**
 * @author braango
 * 
 * Sample code showing how to delete all SMS
 * numbers for a given personnel
 * 
 */
public class DeleteAllSMS {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		SmsApi smsApi = new SmsApi(braangoApiClient);

		ApiCallback<SmsOutput> callBack = new ApiCallback<SmsOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, 
					long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking "
								+ "request progress");

			}

			@Override
			public void onSuccess(SmsOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<SmsOutputBodyDataSmsList> smsList = result.getBody()
						.getData().getSmsList();

				System.out.println("SMS LIST : " + smsList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			
			smsApi.deleteAllSmsAsync(subDealerId, salesPersonId, 
					                 apiKey,accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.personnel.sms;

import java.util.List;
import java.util.Map;
import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.SmsApi;
import com.braango.client.braangomodel.SmsOutput;
import com.braango.client.braangomodel.SmsOutputBodyDataSmsList;

/**
 * @author braango
 * 
 * Sample code showing how to delete one SMS
 * number for a given personnel
 * 
 */
public class DeleteOneSMS {

	static String basePath = "https://testapi2.braango.com/v2/braango";

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		// TODO Auto-generated method stub

		ApiClient braangoApiClient = new ApiClient();
		// TEST auth token. Please contact
		// sales@braango.com to have one
		// created for you
		String authToken = "ISNWF0P30WM0CMK";
		braangoApiClient.setBasePath(basePath);

		// Set the auth_token for api client to
		// interact with Braango system
		braangoApiClient.setApiKey(authToken);

		// Api key is authorization to to access
		// resources within braango system
		//
		// This key is different than auth_token
		// that is used to validate the master account

		String apiKey = "ISNfTMNOumV3xYNDd2g";

		// Create personnel api. Personnel is hosted by subDealer
		SmsApi smsApi = new SmsApi(braangoApiClient);

		ApiCallback<SmsOutput> callBack = new ApiCallback<SmsOutput>() {

			@Override
			public void onUploadProgress(long bytesWritten, 
					long contentLength,
					boolean done) {

				System.out
						.println("Place holder for tracking request progress");

			}

			@Override
			public void onSuccess(SmsOutput result, int statusCode,
					Map<String, List<String>> responseHeaders) {

				List<SmsOutputBodyDataSmsList> smsList = result.getBody()
						.getData().getSmsList();

				System.out.println("SMS LIST : " + smsList);

			}

			@Override
			public void onFailure(ApiException e, int statusCode,
					Map<String, List<String>> responseHeaders) {
				System.out.println("Error is " + statusCode + " "
						+ e.getResponseBody());

			}

			@Override
			public void onDownloadProgress(long bytesRead, long contentLength,
					boolean done) {

			}
		};

		

		try {
			String subDealerId = "subdealers1002";
			
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			
			String accountType   = "partner";
			
			String numberToBeDeleted = "4089763435";
			
			smsApi.deleteOnesmsAsync(subDealerId, salesPersonId, 
					                 numberToBeDeleted, apiKey,
					                 accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
<?php
use Braango\braangomodel as model;
use Braango\braangomodel\RequestHeader as rhdr;

require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to create new SMS number for personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\SmsApi();

// string | id of _sub_account_
$subdealerid = "subdealers2002";

// string | id of salesperson
$salespersonid = "d1e5cb9c-def7-4273-85c7-46a1b5e46869";

// Braango\braangomodel\SmsInput |
$smsInput = new \Braango\braangomodel\SmsInput();

$hrd = new rhdr();

// dealer_api_key returned
// when partner_dealer was created
$hrd->setApiKey("ISNMdzuNiKG7jhl9d9v");

// Set the account type to partner for
// virtual dealer and partner hosted
// accounts
$hrd->setAccountType("partner");

// ID that will be reflected back
$hrd->setId("sms-create-s2002");

$smsInput->setHeader($hrd);

$smsInputBody = new model\SmsInputBody();

// Create new SMS number for this personnel
$smsInputBody->setSmsNumber("4088723449");

$smsInput->setBody($smsInputBody);

try {
    $result = $api_instance->createSms($subdealerid, $salespersonid, $smsInput);
    
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $smsOutPutBodyData = $rspBdy->getData();
            
            $smsList = array();
            
            $smsList = $smsOutPutBodyData->getSmsList();
            
            print "SMS LIST: ";
            print_r(array_values($smsList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling SmsApi->createSms: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to get SMS number list for
 *         given personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\SmsApi();

// string | id of _sub_account_
$subdealerid = "subdealers2002";

// string | id of salesperson
$salespersonid = "d1e5cb9c-def7-4273-85c7-46a1b5e46869";

// string | API Key to access this dealer's resources. 
// Value was returned when create_account api was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";
try {
    $result = $api_instance->readSms($subdealerid, $salespersonid, $apiKey, $accountType);
    
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $smsOutPutBodyData = $rspBdy->getData();
            
            $smsList = array();
            
            $smsList = $smsOutPutBodyData->getSmsList();
            
            print "SMS LIST: ";
            print_r(array_values($smsList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling SmsApi->readSms: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete all SMS
 *         numbers for a given personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\SmsApi();

// string | id of _sub_account_
$subdealerid = "subdealers2002";

// string | id of salesperson
$salespersonid = "aed72631-c968-4362-a9a4-ebe5bef8310b";

// string | API Key to access this dealer's resources. 
// Value was returned when create_account api was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->deleteAllSms($subdealerid, $salespersonid, $apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $smsOutPutBodyData = $rspBdy->getData();
            
            $smsList = array();
            
            $smsList = $smsOutPutBodyData->getSmsList();
            
            print "SMS LIST: ";
            print_r(array_values($smsList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling SmsApi->deleteAllSms: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');
/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete one SMS
 *         number for a given personnel
 *        
 */

// TEST auth token. Please contact
// sales@braango.com to have one
// created for you
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

$api_instance = new Braango\braangoapi\SmsApi();

// string | id of _sub_account_
$subdealerid = "subdealers2002";

// string | id of _sales_person_
$salespersonid = "d1e5cb9c-def7-4273-85c7-46a1b5e46869";

// string | sms number to be deleted
$number = "4088723449";

// string | API Key to access this dealer's resources.
// Value was returned when create_account api was called and dealer was created first time
$apiKey = "ISNMdzuNiKG7jhl9d9v";

// string | Dealer or partner is accessing this API
$accountType = "partner";

try {
    $result = $api_instance->deleteOnesms($subdealerid, $salespersonid, $number, $apiKey, $accountType);
    if ($result != null) {
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
            print_r("Response ID = " . $rspId . ", API Request Id = " . $braangoRequestId . "\n");
        }
        
        $rspBdy = $result->getBody();
        if ($rspBdy != null) {
            
            $status = $rspBdy->getStatus();
            
            // Typically this value should be always SUCCESS else exception will be thrown
            // Sometimes, this can be WARNING to indicate if any resource conflicted or not
            // In case of SUCCESS or WARNING, resources are always created (excepting warned sub-resources)
            print_r("Status = " . $status . "\n");
            
            $smsOutPutBodyData = $rspBdy->getData();
            
            $smsList = array();
            
            $smsList = $smsOutPutBodyData->getSmsList();
            
            print "SMS LIST: ";
            print_r(array_values($smsList));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling SmsApi->deleteOnesms: ', $e->getMessage(), PHP_EOL;
}
?>
Braango
CONTACT US
Unified customer engagement platform for inbound and outbound communications
Thank You. We will contact you as soon as possible.
PGlmcmFtZSB3aWR0aD0iNTYwIiBoZWlnaHQ9IjMxNSIgc3JjPSJodHRwczovL3d3dy55b3V0dWJlLmNvbS9lbWJlZC9sMVZqaUxUMUFKdyIgZnJhbWVib3JkZXI9IjAiIGFsbG93ZnVsbHNjcmVlbj48L2lmcmFtZT4=