Given a phone number, determine its line type i.e. check if it is mobile, landline, VOIP etc

/**
 * 
 */
package com.braango.virtualdealer.communications.phone;

import java.util.List;
import java.util.Map;

import javax.naming.CommunicationException;

import com.braango.client.ApiCallback;
import com.braango.client.ApiClient;
import com.braango.client.ApiException;
import com.braango.client.braangoapi.BraangonumbersApi;
import com.braango.client.braangoapi.EmailsApi;
import com.braango.client.braangoapi.GroupsApi;
import com.braango.client.braangoapi.PhonesApi;
import com.braango.client.braangoapi.WebhooksApi;
import com.braango.client.braangomodel.BraangoNumberOutput;
import com.braango.client.braangomodel.BraangoNumberOutputBodyData;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.GroupOutput;
import com.braango.client.braangomodel.GroupOutputBodyData;
import com.braango.client.braangomodel.LineTypeOutput;
import com.braango.client.braangomodel.LineTypeOutputBodyData;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;
import com.braango.client.braangomodel.WebhookOutput;
import com.braango.client.braangomodel.WebhookOutputBodyData;

/**
 * @author braango
 * 
 *    Sample code showing how to determine
 *    the phone line type
 *   
 *
 */
public class GetLineType {

	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 webhookApi api. 
		PhonesApi phoneApi = new PhonesApi(braangoApiClient);
		

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

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

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

			}

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

				LineTypeOutputBodyData lineOutput = result.getBody()
						.getData();
				
				
				

				System.out.println("Braango Numbers : " + lineOutput.getLineType());

			}

			@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 accountType   = "partner";
			
			// UUID returned during creation process or braango number itself
			String number = "4087653312"; 
			
			phoneApi.getLineTypeAsync(number, apiKey, accountType, callBack);
			
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

This API allows partner or dealer to blast messages to one or multiple numbers at the same time. Each person can receive different message

The blasting number is seperate than regular braango number. At this moment that number will be created by Braango Support Team on behest of of partner. Eventually there will be simple API to create blasting number

Partner can choose to blast messages to anyone including dealers

Responses to these messages seeds the client into our database and are sent via REST api call to the partner or master account

Based on response, partner can then decide to bridge the client to particular sub_dealer or personnel within sub_dealer using dealerconnect api

The above described use case of late_binding mode of operation

Please refer to flow diagrams for various use case flows of this API

/**
 * 
 */
package com.braango.virtualdealer.communications.messaging;

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.BraangonumbersApi;
import com.braango.client.braangoapi.EmailsApi;
import com.braango.client.braangoapi.GroupsApi;
import com.braango.client.braangoapi.MessagingApi;
import com.braango.client.braangoapi.WebhooksApi;
import com.braango.client.braangomodel.BraangoNumberCreateInput;
import com.braango.client.braangomodel.BraangoNumberCreateInputBody;
import com.braango.client.braangomodel.BraangoNumberInput;
import com.braango.client.braangomodel.BraangoNumberOutput;
import com.braango.client.braangomodel.BraangoNumberOutputBodyData;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.GroupOutput;
import com.braango.client.braangomodel.GroupOutputBodyData;
import com.braango.client.braangomodel.MessageBlast;
import com.braango.client.braangomodel.MessageBlastNumbers;
import com.braango.client.braangomodel.MessageBlastOutputWrapper;
import com.braango.client.braangomodel.MessageBlastOutputWrapperBodyData;
import com.braango.client.braangomodel.MessageBlastRequestInput;
import com.braango.client.braangomodel.RequestHeader;
import com.braango.client.braangomodel.EmailInput;
import com.braango.client.braangomodel.EmailInputBody;
import com.braango.client.braangomodel.EmailOutput;
import com.braango.client.braangomodel.WebhookOutput;
import com.braango.client.braangomodel.WebhookOutputBodyData;

/**
 * @author braango
 * 
 *    Sample code showing how to blast
 *    to multiple consumers via
 *    partner's blast number (different than
 *    braango number)
 *   
 *
 */
public class BlastMessage {

	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 webhookApi api. 
		MessagingApi messageBlastApi = new MessagingApi(braangoApiClient);
		

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

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

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

			}

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

				MessageBlastOutputWrapperBodyData messageBlastOutput = result.getBody()
						.getData();
				
				
				

				System.out.println("Braango Numbers : " + messageBlastOutput.getNumbers());

			}

			@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) {

			}
		};

		
		MessageBlastRequestInput messageBlastInput = new MessageBlastRequestInput();
		RequestHeader hdr = new RequestHeader();
		hdr.setAccountType("partner");
		hdr.setApiKey(apiKey);
		hdr.setId("message-blast-01");
		
		messageBlastInput.setHeader(hdr);
		
		MessageBlast body = new MessageBlast();
		List<MessageBlastNumbers> numbers = new ArrayList<MessageBlastNumbers>();
		MessageBlastNumbers number = new MessageBlastNumbers();
		
		List<String> message = new ArrayList<String>();
		message.add("Line 1 \n");
		number.setMessage(message);
		number.setNumberId("required-unique-id");
		number.setPhoneNumber("4087652231");
		numbers.add(number);
		body.setNumbers(numbers);
		messageBlastInput.setBody(body);
		
		
		try {
			String subDealerId = "subdealers1002";
			
			
			// Group for which the braango number is being created
			String group = "DEFAULT";
			messageBlastApi.messageBlastAsync(messageBlastInput, callBack);
			
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

}

Given a phone number, determine its line type i.e. check if it is mobile, landline, VOIP etc

<?php
use Braango\braangomodel as model;

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

/**
 *
 * @author braango
 *        
 *         Sample code showing how to determine
 *         the phone line type
 *        
 *        
 */

// 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\PhonesApi();

$number = "4087653312"; // string | number returned during creation process or braango number itself
                        
// 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->getLineType($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");
            
            $lineTypeOutputBodyData = new model\LineTypeOutputBodyData();
            $lineTypeOutputBodyData = $rspBdy->getData();
            print_r("Braango Numbers : " . $lineTypeOutputBodyData->getLineType());
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling PhonesApi->getLineType: ', $e->getMessage(), PHP_EOL;
}
?>

This API allows partner or dealer to blast messages to one or multiple numbers at the same time. Each person can receive different message

The blasting number is seperate than regular braango number. At this moment that number will be created by Braango Support Team on behest of of partner. Eventually there will be simple API to create blasting number

Partner can choose to blast messages to anyone including dealers

Responses to these messages seeds the client into our database and are sent via REST api call to the partner or master account

Based on response, partner can then decide to bridge the client to particular sub_dealer or personnel within sub_dealer using dealerconnect api

The above described use case of late_binding mode of operation

Please refer to flow diagrams for various use case flows of this API

<?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 blast
 *         to multiple consumers via
 *         partner's blast number (different than
 *         braango number)
 *        
 *        
 */

// 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\MessagingApi();

// Braango\braangomodel\MessageBlastRequestInput |
$messageBlastRequestInput = new \Braango\braangomodel\MessageBlastRequestInput();

/*
 * { "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("message-blast-01");

$messageBlastRequestInput->setHeader($hrd);

$messageBlastBody = new model\MessageBlast();

$numbers = array();

$messageBlastnumbers = new model\MessageBlastNumbers();

$message = array(
    "Line 1"
);

$messageBlastnumbers->setMessage($message);

$messageBlastnumbers->setNumberId("required-unique-id");

$messageBlastnumbers->setPhoneNumber("6692459240");

array_push($numbers, $messageBlastnumbers);

$messageBlastBody->setNumbers($numbers);

$messageBlastRequestInput->setBody($messageBlastBody);

try {
    $result = $api_instance->messageBlast($messageBlastRequestInput);
    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");
            
            $messageBlastOutputWrapperBodyData = $rspBdy->getData();
            print "Braango Numbers = ";
            print_r($messageBlastOutputWrapperBodyData->getNumbers());
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling MessagingApi->messageBlast: ', $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=