# Bootstrap API

Nuance Bootstrap code provides API's for controlling the Messaging experience on client Web Apps.

WebSDK provides lot more flexibility for clients to configure the way Nuance Chat is rendered on their Web Apps.

Clients can configure the Look and Feel of chat window by configuring the UI Config.

SDK allows clients to controls the positioning and size of chat window.

SDK also comes with a C2C plugin which enables clients to add advanced Chat button animation for various states.

- ##### initializeMessagingSDK(dataCenter, tagServerName, vendorUUID, callback)

  Initializes bootstrap file
  * @param {string} dataCenter - name of the data center that is provisoned for the client
  * @param {tagServerName} dataCenter - unique tagserver name given for the client
  * @param {function} callbac - callback that gets invoked when SDK is initialized

- ##### getAndSetSDKConfig()

  returns SDK Config object

- ##### loadChatAssets(testReady)

  Inject the sandboxed iframe and init loading of nuance framework within it
  * @param {boolean} testReady - test for dom ready

- ##### addCustomJavascript(funcName, funcRef)

  Add references to javscript function that can be invoked from Nuance Targetting engine
  * @param {string} funcName - name of the function
  * @param {function} funcRef - function reference that will be called when there is a targetting

- ##### SDKAPI.launchChatByRuleID(ruleID)

  Allowing web page to launch a chat by passing a rule id

- ##### SDKAPI.launchChatNowByRuleName(ruleName)

  Allowing web page to launch a chat by passing a rule name

- ##### SDKAPI.suppressChatForSession()

  Allowing web page to suppress the chat for this session

- ##### SDKAPI.reInitChat(pageId,data)

  Allowing web page to reinit the chat framework in a single page design when user moves from one page to another
  * @param {string} pageId - name of the function
  * @param {object} data - function reference that will be called when there is a targetting

- ##### SDKAPI.fireCustomEvent(eventName, eventData, pageData)

  Allowing web page to fire a custom event so that Nuance targetting can act on it
  * @param {string} eventName - name of the event
  * @param {object} eventData - data associated with the event
  * @param {object} eventData - page data if any that needed to be passed to nuance sandboxed iframe

- ##### SDKAPI.sendAutomatonMessage(msgType, message)

  Allowing web page to send a system or datapass message
  * @param {string} [msgType] - type of the message which is an optional parameter, value currently available is "datapass"
  * @param {string|object} message - data associated with this request, object for datapass and text for others

- ##### SDKAPI.closeChat()

  Allowing web page to close an opened chat.

- ##### SDKAPI.getChatID(callback)

  Allowing web page to get the current engagement ID

- ##### SDKAPI.isFrameworkInitialized(callback)

  Allowing web page to get initialization state

- ##### SDKAPI.getBRPublishedVariableRef(piKey,callback)

  Allowing web page to get values of certain variables published by nuance targetting engine.
  * @param {string} apiKey - variable that is published by targeting engine
  * @param {function} callback - when framework finds the value of the asked variable

- ##### SDKAPI.publishNewPageData(dataObj)

  Allowing web page to publish new page data to Nuance sandbox iframe.
  * @param {object} dataObj - object with page data in the form of key and value pairs

- ##### SDKAPI.onRestoredClicked()

  When c2c button is restored from minimized state.

- ##### SDKAPI.updateLogo(logo)

  When webpage wants to update the chat window logo during an active engagement.
  * @param {ImageO} logo - Object which represent an image resource
  * @property {string} ImageO.imgname - name of the image which is stored under nuance theme folder
  * @property {string} ImageO.imgsrc - url pointing to an image file

- ##### SDKAPI.updateTitle(title)

  When webpage wants to update the chat window title during an active engagement.

- ##### SDKAPI.autoEngage(title)

  When webpage wants to start an engagement automatically after chat is displayed, passed string will be send a client communication outcome.

### Config

- ##### siteID

  set the site id provided to you by nuance

- ##### setPageData(key, val)

  add page data key and value

- ##### setMessageWatch(callback)

  Allows client javascript to watch the communication between bootstrap and sandboxed iframe

- ##### tagServerUrl

  get the default tagserver url

- ##### overrideTagDomain(url)

  update the default tagserver url generated by bootstrap

- ##### chatLaunchFileAndPath

  get or set the default sandboxed iframe src path

- ##### registerForMessagingEvents(eventType, callback)

  listens to events fired from Nuance Chat framework from withing the sandboxed iframe
  * @param {MessagingEvent} eventType
  * @param {eventCB} callback

- ##### enableCustomC2CRendering(c2cIntance)

  C2C manager will invoke the provided C2C Plugin instance when rendering the c2c.

- ##### setMessagingUIConfigs(UIConfig)

  Set the json that contains the chat window branding styles and configuration.

- ##### disableDrag()

  Disable dragging of chat window.

- ##### setFrameConfig(w,h,position)

  override chat window width, height and position.
  * @param {number} width
  * @param {number} height
  * @param {WindowPosition} position

### MessagingEvent

- ##### config.Events.ON_RULE_SATISFIED

- ##### config.Events.ON_SERVICE_INVITATION

- ##### config.Events.ON_SERVICE_ENGAGED

- ##### config.Events.ON_SERVICE_INTERACTED

- ##### config.Events.ON_SERVICE_QUALIFIED

- ##### config.Events.ON_SERVICE_MISSED

- ##### config.Events.ON_C2C_READY

- ##### config.Events.ON_C2C_DISPLAYED

- ##### config.Events.ON_C2C_CLICKED

- ##### config.Events.ON_CHAT_REQUESTED

- ##### config.Events.ON_CHAT_LAUNCHED

- ##### config.Events.ON_CHAT_SHOWN

- ##### config.Events.ON_CHAT_CLOSED

- ##### config.Events.ON_AGENT_MSG

- ##### config.Events.ON_CUSTOMER_MSG

- ##### config.Events.ON_AGENT_MSG

- ##### config.Events.ON_AGENT_ASSIGNED

- ##### config.Events.ON_CHAT_EVENT

- ##### config.Events.ON_BEFORE_CHAT_CLOSED_EVENT

- ##### config.Events.ON_AGENT_DATAPASS

- ##### config.Events.ON_RECEIVE_VA_DATAPASS

- ##### config.Events.ON_CHAT_ROOM_READY

- ##### config.Events.ON_QUEUE_MESSAGE

### WindowPosition

- ##### config.WindowPosition.LOWER_RIGHT

- ##### config.WindowPosition.LOWER_LEFT

- ##### config.WindowPosition.LOWER_CENTER

- ##### config.WindowPosition.UPPER_CENTER

- ##### config.WindowPosition.UPPER_LEFT

- ##### config.WindowPosition.UPPER_RIGHT

- ##### config.WindowPosition.CENTER_LEFT

- ##### config.WindowPosition.CENTER_RIGHT

- ##### config.WindowPosition.CENTER