Every communication between sub_dealer‘s personnel and customer can be tracked and acted upon

braango will post every responses, either from personnel or from customer to partner’s server

partner needs to register web_hook URL with every personnel it wants tracked or it can set global web_hook for partner_dealer account. Having individual web_hook per personnel is recommended as it allows to tie communication per personnel

Message format

When a message is received by a braango system it is forwarded to partner server via registered web_hook . braango system makes a POST call to the registered URL with registered api_key

The format of the response is as described below

{
    "body" : {
        "numbers" : [ 
            {
                "phone_number" : "xxxxxxxxx",
                "date_consumer_responded" : "11/30/2017:07:41:PM",
                "bridge_message" : false,
                "stop_requested" : false,
                "bridge_number_used" : "(617) 941-3276",
                "bridge_dealer" : true,
                "message" : "Text"
            }
        ]
    },
    "header" : {
        "isn-api-key" : "ISNWF0P30WM0CMK",
        "account-type" : "partner",
        "operation" : "DEALER_MSG",
        "id" : "390e68b6-98e6-466d-b729-92a1f2146613"
    }
}

The following is response when consumer is messaging the dealer

{
    "_id" : ObjectId("5a20d4456056b40fc5a2e860"),
    "body" : {
        "numbers" : [ 
            {
                "phone_number" : "+15103662533",
                "media_urls" : [],
                "date_consumer_responded" : "11/30/2017:08:01:PM",
                "bridge_message" : false,
                "stop_requested" : false,
                "bridge_number_used" : "(617) 941-3276",
                "bridge_dealer" : true,
                "message" : "Hello World"
            }
        ]
    },
    "header" : {
        "isn-api-key" : "ISNWF0P30WM0CMK",
        "account-type" : "partner",
        "operation" : "CONSUMER_MSG",
        "id" : "a0a4f4ac-24ee-4e0b-b667-23147f3770b4"
    }
}

Explanation of the fields is below :

"header" : {
        "isn-api-key" : "<Value set during create web hook call>"
        "account-type" : "<partner|dealer>",
        "operation" : "<CONSUMER_MSG|DEALER_MSG>",
        "id" : "a0a4f4ac-24ee-4e0b-b667-23147f3770b4"
    }
    
    
    "body" : {
        "numbers" : [ 
            {
                "phone_number" : "<originating number, not a mask number>",
                "media_urls" : [],
                "date_consumer_responded" : "11/30/2017:08:01:PM",
                "bridge_message" : <always false, future upgrade>,
                "stop_requested" : <true|false>,
                "bridge_number_used" : "(617) 941-3276 <braango number>",
                "bridge_dealer" : true|false <whether braango number or blast number>,
                "message" : "Hello World <actual message"
            }
        ]
    },
  
    ```
/**
 * 
 */
package com.braango.virtualdealer.personnel.webhooks;

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.braangoapi.GroupsApi;
import com.braango.client.braangoapi.WebhooksApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.GroupOutput;
import com.braango.client.braangomodel.GroupOutputBodyData;
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.WebhkInput;
import com.braango.client.braangomodel.WebhookInput;
import com.braango.client.braangomodel.WebhookInputBody;
import com.braango.client.braangomodel.WebhookOutput;
import com.braango.client.braangomodel.WebhookOutputBodyData;

/**
 * @author braango
 * 
 *    Sample code showing how to get all webhooks
 *    
 *   
 *
 */
public class CreateWebhook {

	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. 
		WebhooksApi webhookApi = new WebhooksApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

				WebhookOutputBodyData webhookData = result.getBody()
						.getData();
				
				
				

				System.out.println("Webhooks : " + webhookData.getRestEndPoints());

			}

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

			}
		};

		
		// Create input for the webhook
		
		// WebHook Input wraps hdr and webhook body 
		WebhookInput webhookInput = new WebhookInput();
		
		RequestHeader hdr = new RequestHeader();
		hdr.setAccountType("partner");
		hdr.setApiKey(apiKey);
		hdr.setId("create-webhook");
		
		webhookInput.setHeader(hdr);
		
		WebhookInputBody body = new WebhookInputBody();
		
		// This is partner generated authid that partner
		// uses to track the webhook
		// Braango uses that to index the entry
		// This needs to be unique for given
		// personnel
		
		body.setAuthId("webhook-auth-id");
		
		// Partner generated auth key for webhook
		// Braango will use this in its
		// request when posting message
		body.setAuthKey("partner-webhook-auth-key");
		
		body.setEnable(true);
		
		// Url where the webhook needs to be posted
		body.setPostUrl("https://test.partner.webhook/someresource");
		
		webhookInput.setBody(body);
		// End create input for the webhook
		
		try {
			String subDealerId = "subdealers1002";
			String salesPersonId = "0550c168-6117-45d5-a95f-e66593e6336b";
			String accountType   = "partner";
			
			webhookApi.createWebhookAsync(subDealerId, salesPersonId, webhookInput, callBack);
			
			
			
		} catch (ApiException e1) {
			e1.printStackTrace();
		}
	}

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

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.braangoapi.GroupsApi;
import com.braango.client.braangoapi.WebhooksApi;
import com.braango.client.braangomodel.EmailOutputBodyData;
import com.braango.client.braangomodel.GroupOutput;
import com.braango.client.braangomodel.GroupOutputBodyData;
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 get all webhooks
 *    
 *   
 *
 */
public class GetWebhook {

	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. 
		WebhooksApi webhookApi = new WebhooksApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

				WebhookOutputBodyData webhookData = result.getBody()
						.getData();
				
				
				

				System.out.println("Webhooks : " + webhookData.getRestEndPoints());

			}

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

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

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.WebhooksApi;
import com.braango.client.braangomodel.WebhookOutput;
import com.braango.client.braangomodel.WebhookOutputBodyData;

/**
 * @author braango
 * 
 *    Sample code showing how to delete all webhooks
 *    
 *   
 *
 */
public class DeleteAllWebhooks {

	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. 
		WebhooksApi webhookApi = new WebhooksApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

			
				
				
				

				System.out.println("Webhooks delete status code: " + statusCode);

			}

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

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

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.WebhooksApi;
import com.braango.client.braangomodel.WebhookOutput;
import com.braango.client.braangomodel.WebhookOutputBodyData;

/**
 * @author braango
 * 
 *    Sample code showing how to delete one webhooks
 *    
 *   
 *
 */
public class DeleteOneWebhook {

	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. 
		WebhooksApi webhookApi = new WebhooksApi(braangoApiClient);
		
		final Boolean typeAdfCrmEmail = false;

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

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

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

			}

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

			
				
				
				

				System.out.println("Webhooks delete status code: " + statusCode);

			}

			@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 authId = "webhook-auth-id";
			
			webhookApi.deleteOneWebhookAsync(subDealerId, salesPersonId, authId, 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 get all webhooks
 *        
 *        
 *        
 */

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

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

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

// Braango\braangomodel\WebhookInput |
$webhookInput = new \Braango\braangomodel\WebhookInput();

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

$webhookInput->setHeader($hrd);

$webhookInputBody = new model\WebhookInputBody();

// This is partner generated authid that partner
// uses to track the webhook
// Braango uses that to index the entry
// This needs to be unique for given
// personnel
$webhookInputBody->setAuthId("webhook-auth-id");

// Partner generated auth key for webhook
// Braango will use this in its
// request when posting message
$webhookInputBody->setAuthKey("partner-webhook-auth-key");

$webhookInputBody->setEnable(TRUE);

// Url where the webhook needs to be posted
$webhookInputBody->setPostUrl("https://test.partner.webhook/someresource");

$webhookInput->setBody($webhookInputBody);
// End create input for the webhook

try {
    $result = $api_instance->createWebhook($subdealerid, $salespersonid, $webhookInput);
    
    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");
            $webhookInputBodyData = $rspBdy->getData();
            print "Webhooks : ";
            print_r($webhookInputBodyData->getRestEndPoints());
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling WebhooksApi->createWebhook: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to get all webhooks
 *        
 *        
 *        
 */

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

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

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

try {
    $result = $api_instance->getWebhook($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");
            $webhookInputBodyData = $rspBdy->getData();
            print "Webhooks : ";
            print_r($webhookInputBodyData->getRestEndPoints());
        }
    }
} catch (Exception $e) {
    echo 'Exception when calling WebhooksApi->getWebhook: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete all webhooks
 *        
 *        
 *        
 */

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

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

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

try {
    $api_instance->deleteWebhook($subdealerid, $salespersonid, $apiKey, $accountType);
} catch (Exception $e) {
    echo 'Exception when calling WebhooksApi->deleteWebhook: ', $e->getMessage(), PHP_EOL;
}
?>
<?php
require_once (__DIR__ . '/../../vendor/autoload.php');

/**
 *
 * @author braango
 *        
 *         Sample code showing how to delete one webhooks
 *        
 *        
 *        
 */

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

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

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

// string | authid
$authid = "webhook-auth-id";

// 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 {
    $api_instance->deleteOneWebhook($subdealerid, $salespersonid, $authid, $apiKey, $accountType);
} catch (Exception $e) {
    echo 'Exception when calling WebhooksApi->deleteOneWebhook: ', $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=