WCAP speedDIAL
WORLDPAC's WCAP speedDIAL enables web-based SMS applications to communicate with speedDIAL via Javascript. Web-based SMS applications can use the library's API's to request product quotes, order products, and receive exported orders asynchronously.
Architecture
Quick Start Guide
This section will help you incorporate the WCAP speedDIAL library into your SMS web application. For a more detailed example, go to WORLDPAC's SMS Demo.
Add the WCAP speedDIAL library
Add the required WCAP speedDIAL library in your SMS application. Replace the xx in the example below with the current library version (for example, "wcap.sio.02.min.js").
<!DOCTYPE html>
<html>
<head>
<script src="https://www.worldpac.com/wcap/js/wcap.sio.xx.min.js"></script>
...
</head>
Create the WCAP.speedDIAL object
The WCAP.speedDIAL object provides the starting point for web-based SMS applications to communicate with speedDIAL. It contains API's that are used to
- connect to speedDIAL
- disconnect from speedDIAL
- show catalog
- request product quote
- order product
- receive orders asynchronously
Create the WCAP.speedDIAL object by passing its constructor the following required arguments.
- speedDIAL port number. To use the default port 17944, specify WCAP.defaultPort.
- and the name of your SMS application. Optional arguments may also be used in the following order.
- communication protocol. The default value is the communication protocol of the SMS host. Valid values are WCAP.nonsecureProtocol and WCAP.secureProtocol.
host name. The default value is WCAP.defaultHost. Pass the host name or IP Address in as the last argument.
<script> // to use the default host name (WCAP.defaultHost) and communication protocol is the same as the browser's communication protocol var wcap = new WCAP.speedDIAL(WCAP.defaultPort, "Name of SMS Vendor"); // to use the default host name (WCAP.defaultHost) and specific communication protocol (WCAP.nonsecureProtocol or WCAP.secureProtocol) // var wcap = new WCAP.speedDIAL(WCAP.defaultPort, "Name of SMS Vendor", WCAP.nonsecureProtocol); // to use specific host name or IP Address and communication protocol (WCAP.nonsecureProtocol or WCAP.secureProtocol) // var wcap = new WCAP.speedDIAL(WCAP.defaultPort, "Name of SMS Vendor", WCAP.nonsecureProtocol, WCAP.localHost); ... </script>
Register callbacks
Your SMS web application may register functions to be called when messages are received from speedDIAL.
The following message types will be sent by speedDIAL.
- WCAP.Event.SERVER_ERROR
- WCAP.Event.CONNECT
- WCAP.Event.DISCONNECT
- WCAP.Event.PRODUCT_QUOTE
- WCAP.Event.ORDER
The functions that handle SERVER_ERROR, CONNECT, and DISCONNECT messages will be passed a WCAP.StatusMessage object.
The functions to handle PRODUCT_QUOTE and ORDER messages will be passed a JSON data object sent by speedDIAL.
<script>
...
wcap.on(WCAP.Event.SERVER_ERROR, function(statusMessage){...});
wcap.on(WCAP.Event.CONNECT, function(statusMessage){...});
wcap.on(WCAP.Event.DISCONNECT, function(statusMessage){...});
wcap.on(WCAP.Event.PRODUCT_QUOTE, function(jsonData){...});
wcap.on(WCAP.Event.ORDER, function(jsonData){...});
...
</script>
Connect to speedDIAL
WCAP.speedDIAL will attempt to connect to speedDIAL. If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
<script>
wcap.connect();
...
</script>
Disconnect from speedDIAL
Use the WCAP.speedDIAL object to disconnect from speedDIAL.
<script>
wcap.disconnect();
...
</script>
Show Catalog by VIN
To show the speedDIAL catalog by VIN,
- create a WCAP.ShowCatalogUsingVINRequest object
- set the optional reference ID for the request
- set the VIN value in the WCAP.ShowCatalogUsingVINRequest
- create an optional WCAP.CategoryIDs object, adding category IDs to it
- set the WCAP.CategoryIDs value in the WCAP.ShowCatalogUsingVINRequest
- call showCatalogUsingVin(), passing it the request object
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var request = new WCAP.ShowCatalogUsingVINRequest();
request.setReferenceID('PO 1');
request.setVIN('WBADT63463CK31D12');
var categoryIDs = new WCAP.CategoryIDs();
categoryIDs.addCategoryID('B1000');
categoryIDs.addCategoryID('N6');
request.setCategoryIDs(categoryIDs);
try{
wcap.showCatalogUsingVin(request);
}catch(err){
console.out(err);
}
Show Catalog by ACES Vehicle
To show the speedDIAL catalog by ACES Vehicle,
- create a WCAP.ShowCatalogUsingACESVehicleRequest object
- set the optional reference ID for the request
- create a WCAP.ACESVehicle object, setting properties for the ACES Vehicle
- set the ACES Vehicle value in the WCAP.ShowCatalogUsingACESVehicleRequest
- create an optional WCAP.CategoryIDs object, adding category IDs to it
- set the WCAP.CategoryIDs value in the WCAP.ShowCatalogUsingACESVehicleRequest
- call showCatalogUsingACESVehicle(), passing it the request object
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var request = new WCAP.ShowCatalogUsingACESVehicleRequest();
request.setReferenceID('PO 2');
var acesVehicle = new WCAP.ACESVehicle();
acesVehicle.setBaseVehicle('7947');
acesVehicle.setMfrBodyCode('1772','VZV2');
acesVehicle.setDriveType('5', 'FWD');
acesVehicle.setEngineBase('1019', '2.5 V6');
acesVehicle.setEngineDesignation('405', '2VZFE');
request.setACESVehicle(acesVehicle);
var categoryIDs = new WCAP.CategoryIDs();
categoryIDs.addCategoryID('B1000');
request.setCategoryIDs(categoryIDs);
try{
wcap.showCatalogUsingACESVehicle(request);
}catch(err){
console.out(err);
}
Show Catalog by AAIA Number
To show the speedDIAL catalog by AAIA Number,
- create a WCAP.ShowCatalogUsingAAIANumRequest object
- set the AAIA Number in the WCAP.ShowCatalogUsingAAIANumRequest object
- set the optional reference ID for the request
- create an optional WCAP.CategoryIDs object, adding category IDs to it
- set the WCAP.CategoryIDs value in the WCAP.ShowCatalogUsingAAIANumRequest
- call showCatalogUsingAAIANum(), passing it the request object
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var request = new WCAP.ShowCatalogUsingAAIANumRequest();
request.setReferenceID('PO 3');
request.setAAIANum('1287053');
var categoryIDs = new WCAP.CategoryIDs();
categoryIDs.addCategoryID('B1000');
categoryIDs.addCategoryID('N6');
request.setCategoryIDs(categoryIDs);
try{
wcap.showCatalogUsingAAIANum(request);
}catch(err){
console.out(err);
}
Get Product Quote
To request a product quote,
- create a WCAP.ProductQuoteRequest object
- set the optional reference ID for the request
- set the required product ID, brand ID, and quantity in the WCAP.ProductQuoteRequest object
- call getProductQuote(), passing it the request object.
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var request = new WCAP.ProductQuoteRequest();
request.setReferenceID('PO 4');
request.setProductID('13 71 7 542 294');
request.setBrandID('MAN');
request.setQuantity('1');
wcap.getProductQuote(request);
Create an Order
To create an Order,
- create a WCAP.OrderRequest object
- create a WCAP.OrderLine object
- set the brand ID, product ID and quantity to the OrderLine object
- set the OrderLine object to the OrderRequest object
- create additional OrderLine objects as needed
- call createOrder(), passing it the OrderRequest object.
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var orderRequest = new WCAP.OrderRequest();
orderRequest.setReferenceID('PO 5');
var orderLine1 = new WCAP.OrderLine();
orderLine1.setBrandID('CON');
orderLine1.setProductID('6PK-1145');
orderLine1.setQuantity('1');
orderRequest.addOrderLine(orderLine1);
var orderLine2 = new WCAP.OrderLine();
orderLine2.setBrandID('NPN');
orderLine2.setProductID('25042562');
orderLine2.setQuantity('3');
orderRequest.addOrderLine(orderLine2);
wcap.createOrder('SMS Demo', orderRequest);
Show PnA
To show the PnA table for a product,
- create a WCAP.ShowPnARequest object
- set the product ID to display on the PnA table
- set the optional reference ID for the request
- call showPna(), passing it the ShowPnARequest object
If speedDIAL is not running, WCAP.speedDIAL will make one attempt to launch speedDIAL.
(Click OK button when prompted by the browser to allow speedDIAL to start.) WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
var showPnARequest = new WCAP.ShowPnARequest();
showPnARequest.setReferenceID('PO 123');
showPnARequest.setProductID('D 154 103 A1');
wcap.showPna(showPnARequest);
Launch speedDIAL on your desktop
If speedDIAL is not running, you may start it by calling launchSD(). WCAP.speedDIAL will attempt to connect to speedDIAL within 30 seconds.
wcap.launchSD();