This page has sample code for :

  • Add email for given personnel
  • List emails for given personnel
  • Delete emails for given personnel
  • Delete one email for given personnel

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

personnel can specify the email where it can receive TEXT messages. personnel can respond back via email . The response will be converted back to TEXT message back and sent back to the client
Also personnel can specify type of email. Braango system supports ADF XML based CRM that accept ADF documents via email. Personnel can specify if the email is for ADF or for human consumption and interaction
/**
 * 
 */
package com.braango.virtualdealer.email;

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.EmailsApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to create add email for personnel
 *
 */
public class CreateEmail {

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

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

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

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

			}

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

				EmailOutputBodyData emailList = result.getBody()
						.getData();
				
				List<String> emails = null;
				if(typeAdfCrmEmail) {
					emails = emailList.getCrmEmailList();
				} else {
					emails = emailList.getEmailList();
				}
				

				System.out.println("Email LIST : " + emails);

			}

			@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
		EmailInput emailInput = new EmailInput();

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

		EmailInputBody body = new EmailInputBody();

		// Create new SMS number for this personnel
		body.email("test6@subdealers1002.com");
		body.setTypeAdfCrm(typeAdfCrmEmail);

		emailInput.setBody(body);

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

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

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.EmailsApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to get emails for personnel
 *
 */
public class GetEmail {

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

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

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

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

			}

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

				EmailOutputBodyData emailList = result.getBody()
						.getData();
				
				List<String> emails = null;
				if(typeAdfCrmEmail) {
					emails = emailList.getCrmEmailList();
				} else {
					emails = emailList.getEmailList();
				}
				

				System.out.println("Email LIST : " + emails);

			}

			@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";
			emailApi.getEmailAsync(subDealerId, salesPersonId, apiKey,accountType,typeAdfCrmEmail,
					callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

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

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.EmailsApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to delete all email for personnel
 *
 */
public class DeleteEmail {

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

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

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

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

			}

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

				EmailOutputBodyData emailList = result.getBody()
						.getData();
				
				List<String> emails = null;
				if(typeAdfCrmEmail) {
					emails = emailList.getCrmEmailList();
				} else {
					emails = emailList.getEmailList();
				}
				

				System.out.println("Email LIST : " + emails);

			}

			@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";
			emailApi.deleteEmailAsync(subDealerId, salesPersonId, apiKey,accountType,typeAdfCrmEmail,
					callBack);
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

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

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.EmailsApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;

/**
 * @author braango
 * 
 *    Sample code showing how to delete one email for personnel
 *
 */
public class DeleteOneEmail {

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

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

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

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

			}

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

				EmailOutputBodyData emailList = result.getBody()
						.getData();
				
				List<String> emails = null;
				if(typeAdfCrmEmail) {
					emails = emailList.getCrmEmailList();
				} else {
					emails = emailList.getEmailList();
				}
				

				System.out.println("Email LIST : " + emails);

			}

			@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 emailTobeDeleted = "test6@subdealers1002.com";
			emailApi.deleteOneEmailAsync(subDealerId, salesPersonId, emailTobeDeleted,apiKey,accountType,
					typeAdfCrmEmail,
					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 add email 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\EmailsApi();

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

// string | if of _personnel_
$salespersonid = "aed72631-c968-4362-a9a4-ebe5bef8310b";

// Braango\braangomodel\EmailInput |
$emailInput = new \Braango\braangomodel\EmailInput();

// bool | Specifies to get ADF CRM email records or plain email records. 
// If not specified, default is false i.e. regular email ID accounts
$typeAdfCrmEmail = FALSE;

/*
 * { "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");

$hrd->setId("email-create-s2002r2");

$emailInput->setHeader($hrd);

$emailInputBody = new model\EmailInputBody();

// Create new SMS number for this personnel
$emailInputBody->setEmail("test7@subdealers2002.com");

$emailInputBody->setTypeAdfCrm($typeAdfCrmEmail);

$emailInput->setBody($emailInputBody);

try {
    $result = $api_instance->createEmail($subdealerid, $salespersonid, $emailInput);
    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");
            
            $emailOutPutBodyData = new model\EmailOutputBodyData();
            
            $emailOutPutBodyData = $rspBdy->getData();
            
            $emails = array();
            
            if ($typeAdfCrmEmail) {
                $emails = $emailOutPutBodyData->getCrmEmailList();
            } else {
                $emails = $emailOutPutBodyData->getEmailList();
            }
            print "Email LIST: ";
            
            print_r(array_values($emails));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling EmailsApi->createEmail: ', $e->getMessage(), PHP_EOL;
}
?>

<?php
use Braango\braangomodel as model;

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

// Configure API key authorization: auth_token
Braango\Configuration::getDefaultConfiguration()->setApiKey('auth_token', 'ISNWF0P30WM0CMK');

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

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

// string | if of _personnel_
$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";

// bool | Specifies to get ADF CRM email records or plain email records.  
// If not specified, default is false i.e. regular email ID accounts
$typeAdfCrm = FALSE;

try {
    $result = $api_instance->getEmail($subdealerid, $salespersonid, $apiKey, $accountType, $typeAdfCrm);
    if ($result != null) {
        
        // Extract out response hdr and bdy
        $rspHdr = $result->getHeader();
        
        if ($requestHdr = ! null) {
            $rspId = $rspHdr->getId();
            $braangoRequestId = $rspHdr->getIsnRequestId();
        }
        
        $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");
            
            $emailOutPutBodyData = new model\EmailOutputBodyData();
            
            $emailOutPutBodyData = $rspBdy->getData();
            
            $emails = array();
            
            if ($typeAdfCrm) {
                $emails = $emailOutPutBodyData->getCrmEmailList();
            } else {
                $emails = $emailOutPutBodyData->getEmailList();
            }
            print "Email LIST: ";
            
            print_r(array_values($emails));
            
        }
        
    }
    
} catch (Exception $e) {
    echo 'Exception when calling EmailsApi->getEmail: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
use Braango\braangomodel as model;

require_once (__DIR__ . '/../../vendor/autoload.php');
/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete all email 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\EmailsApi();

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

// string | if of _personnel_
$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";

// bool | Specifies to get ADF CRM email records or plain email records. 
// If not specified, default is false i.e. regular email ID accounts
$typeAdfCrm = FALSE;

try {
    $result = $api_instance->deleteEmail($subdealerid, $salespersonid, $apiKey, $accountType, $typeAdfCrm);
    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");
            $data = $rspBdy->getData();
            
            $emailOutPutBodyData = new model\EmailOutputBodyData();
            
            $emailOutPutBodyData = $rspBdy->getData();
            
            $emails = array();
            
            if ($typeAdfCrm) {
                $emails = $emailOutPutBodyData->getCrmEmailList();
            } else {
                $emails = $emailOutPutBodyData->getEmailList();
            }
            print "Email LIST: ";
            
            print_r(array_values($emails));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling EmailsApi->deleteEmail: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
use Braango\braangomodel as model;
require_once (__DIR__ . '/../../vendor/autoload.php');
/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete one email 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\EmailsApi();

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

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

// string | Email to be deleted
$email = "test7@subdealers2002.com";

// 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";

// bool | Specifies to get ADF CRM email records or plain email records. 
// If not specified, default is false i.e. regular email ID accounts
$typeAdfCrm = FALSE;

try {
    $result = $api_instance->deleteOneEmail($subdealerid, $salespersonid, $email, $apiKey, $accountType, $typeAdfCrm);
    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");
            
            $emailOutPutBodyData = new model\EmailOutputBodyData();
            
            $emailOutPutBodyData = $rspBdy->getData();
            
            $emails = array();
            
            if ($typeAdfCrm) {
                $emails = $emailOutPutBodyData->getCrmEmailList();
            } else {
                $emails = $emailOutPutBodyData->getEmailList();
            }
            print "Email LIST: ";
            
            print_r(array_values($emails));
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling EmailsApi->deleteOneEmail: ', $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=