This page has sample code for :

  • Create banners for given personnel
  • Get banners for given personnel
  • Delete banners for given personnel

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

Banners are what personnel and client see for every TEXT message received. There are three kind of banners based on entities that are being addressed in a particular TEXT message. These are client_banners , dealer_banners , supervisor_banners
/**
 * 
 */
package com.braango.virtualdealer.banners;

import java.util.ArrayList;
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.BannersApi;
import com.braango.client.braangomodel.BannersInput;
import com.braango.client.braangomodel.BannersInputBody;
import com.braango.client.braangomodel.BannersOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.BannersOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to add banners for a personnel
 *
 */
public class CreateBanners {

	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
		BannersApi bannerApi = new BannersApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

				BannersOutputBodyData bannersList = result.getBody()
						.getData();
				
				List<String> dealerBanners = bannersList.getDealerBanners();
				List<String> clientBanners = bannersList.getClientBanners();
				List<String> supervisorBanners =
						                     bannersList.getSupervisorBanners();
				
				System.out.println("Dealer banners =  " + dealerBanners);
				System.out.println("Client banners =  " + clientBanners);
				System.out.println("Supervisor banners =  " + supervisorBanners);


			}

			@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
		BannersInput bannersInput = new BannersInput();

		/*
		 * { "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("banner-create-s1002r2");
		bannersInput.setHeader(hdr);

		BannersInputBody body = new BannersInputBody();

		// Create banners
		
		body.setDealerBanners(new ArrayList<String>());
		body.setClientBanners(new ArrayList<String>());
		body.setSupervisorBanners(new ArrayList<String>());
		
		body.addDealerBannersItem("s1002r2db1-banners api \n\n");
		body.addClientBannersItem("s1002r2cb1-client api \n\n");
		body.addSupervisorBannersItem("s1002r2sb1-supervisor api \n\n");
		
		bannersInput.setBody(body);


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

}
/**
 * 
 */
package com.braango.virtualdealer.banners;

import java.util.ArrayList;
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.BannersApi;
import com.braango.client.braangomodel.BannersInput;
import com.braango.client.braangomodel.BannersInputBody;
import com.braango.client.braangomodel.BannersOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.BannersOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to get banners for a personnel
 *
 */
public class GetBanners {

	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
		BannersApi bannerApi = new BannersApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

				BannersOutputBodyData bannersList = result.getBody()
						.getData();
				
				List<String> dealerBanners = bannersList.getDealerBanners();
				List<String> clientBanners = bannersList.getClientBanners();
				List<String> supervisorBanners =
						                     bannersList.getSupervisorBanners();
				
				System.out.println("Dealer banners =  " + dealerBanners);
				System.out.println("Client banners =  " + clientBanners);
				System.out.println("Supervisor banners =  " + supervisorBanners);


			}

			@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 bannerType = "dealer" ; // "dealer", "client", "supervisor"
			bannerApi.getBannersAsync(subDealerId, salesPersonId,bannerType, apiKey,accountType, callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}
/**
 * 
 */
package com.braango.virtualdealer.banners;

import java.util.ArrayList;
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.BannersApi;
import com.braango.client.braangomodel.BannersInput;
import com.braango.client.braangomodel.BannersInputBody;
import com.braango.client.braangomodel.BannersOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.BannersOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to delete banners for a personnel
 *
 */
public class DeleteBanners {

	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
		BannersApi bannerApi = new BannersApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

				BannersOutputBodyData bannersList = result.getBody()
						.getData();
				
				List<String> dealerBanners = bannersList.getDealerBanners();
				List<String> clientBanners = bannersList.getClientBanners();
				List<String> supervisorBanners =
						                     bannersList.getSupervisorBanners();
				
				System.out.println("Dealer banners =  " + dealerBanners);
				System.out.println("Client banners =  " + clientBanners);
				System.out.println("Supervisor banners =  " + supervisorBanners);


			}

			@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 bannerType = "dealer" ; // "dealer", "client", "supervisor"
			bannerApi.deleteBannersAsync(subDealerId, salesPersonId,bannerType, 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 add banners for a 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\BannersApi();

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

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

// Braango\braangomodel\BannersInput |
$bannersInput = new \Braango\braangomodel\BannersInput();

/*
 * { "api_key": "ISNGvAzwuy4X7vAqrtV", "id": "any value",
 * "account_type": "partner" }
 */
$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("banner-create-s2002");

$bannersInput->setHeader($hrd);

$bannersInputBody = new model\BannersInputBody();

// Create Banners
$bannersInputBody->setClientBanners($clientBanners = array(
    "s2002cb1-client api"
));

$bannersInputBody->setDealerBanners($dealerBanners = array(
    "s2002db1-dealer api"
));

$bannersInputBody->setSupervisorBanners($supervisorBanners = array(
    "s2002sb1-supervisor api"
));

$bannersInput->setBody($bannersInputBody);

try {
    $result = $api_instance->createBanners($subdealerid, $salespersonid, $bannersInput);
    
    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");
            
            $bannersOutPutBodyData = $rspBdy->getData();
            
            $bannersDealer = $bannersOutPutBodyData->getDealerBanners();
            
            $bannersClient = $bannersOutPutBodyData->getClientBanners();
            
            $bannersSupervisor = $bannersOutPutBodyData->getSupervisorBanners();
            
            // Prints the Client, Dealer, and Supervisor Banners
            print "Client Banners = ";
            print_r($bannersClient);
           
            print "Dealer Banners = ";
            print_r($bannersDealer);
            
            print "Supervisor Banners = ";
            print_r($bannersSupervisor);
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling BannersApi->createBanners: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');
/**
 *
 * @author braango
 *        
 *         Sample code showing how to get banners for a 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\BannersApi();

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

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

// string | Banner type - `client` , `dealer` , `supervisor`
$bannertype = "supervisor";

// 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->getBanners($subdealerid, $salespersonid, $bannertype, $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");
            
            $bannersOutPutBodyData = $rspBdy->getData();
            
            $bannersDealer = $bannersOutPutBodyData->getDealerBanners();
            $bannersClient = $bannersOutPutBodyData->getClientBanners();
            $bannersSupervisor = $bannersOutPutBodyData->getSupervisorBanners();
            
            // Prints either the Client, Dealer, and Supervisor Banners
            if ($bannertype == "client") {
                print "Client Banners = ";
                print_r($bannersClient);
            } else if ($bannertype == "dealer") {
                print "Dealer Banners = ";
                print_r($bannersDealer);
            } else {
                print "Supervisor Banners = ";
                print_r($bannersSupervisor);
            }
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling BannersApi->getBanners: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete banners for a 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\BannersApi();

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

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

// string | Banner type - `client` , `dealer` , `supervisor`
$bannertype = "dealer";

// 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->deleteBanners($subdealerid, $salespersonid, $bannertype, $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");
            
            $bannersOutPutBodyData = $rspBdy->getData();
            
            $bannersDealer = $bannersOutPutBodyData->getDealerBanners();
            $bannersClient = $bannersOutPutBodyData->getClientBanners();
            $bannersSupervisor = $bannersOutPutBodyData->getSupervisorBanners();
            
            // Prints either the Client, Dealer, and Supervisor Banners
            if ($bannertype == "client") {
                print "Client Banners = ";
                print_r($bannersClient);
            } else if ($bannertype == "dealer") {
                print "Dealer Banners = ";
                print_r($bannersDealer);
            } else {
                print "Supervisor Banners = ";
                print_r($bannersSupervisor);
            }
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling BannersApi->deleteBanners: ', $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=