Class SDK
				
				
			
				
				
				
					
Defined in:  sdk.js.
				
			
| Constructor Attributes | Constructor Name and Description | 
|---|---|
| 
								SDK()
							 Static class for common util functions and static properties. | 
| Field Attributes | Field Name and Description | 
|---|---|
| <static> | 
								SDK.applicationId
								 You must set your application ID to use the SDK. | 
| <static> | 
								SDK.canPlayAudio
								 Track if auto play of media is enabled in the browser (mobile Chrome/Safari)
Enable or disable to force audio auto play. | 
| <static> | 
								SDK.canPlayVideo
								 Track if auto play of media is enabled in the browser (mobile Chrome/Safari)
Enable or disable to force video auto play. | 
| <static> | 
								SDK.debug
								 Enable debug logging. | 
| <static> | 
								SDK.fixBrightness
								 Attempt to fix grey mp4 video background (only used for Chrome). | 
| <static> | Attempt to fix an issue with Chrome not processing the CSS after correctly when the chat bubble resizes. | 
| <static> | 
								SDK.lang
								 Set the active language code. | 
| <static> | 
								SDK.responsiveVoice
								 Allow our native speech API to use the third party ResponsiveVoice API. | 
| <static> | 
								SDK.secure
								 Escape and filter bot messages for HTML and JavaScript content for XSS security. | 
| <static> | 
								SDK.speechRate
								 The speechRate can be set to change the native speech voice speed. | 
| <static> | 
								SDK.translator
								 Allow text to be translated into another language is the interface elements. | 
| <static> | 
								SDK.useCanvas
								 Force avatars to enable or disable canvas for video (currently used only for Chrome and Firefox). | 
| <static> | 
								SDK.useVideo
								 Force avatars to enable or disable video (currently disabled for Safari on iPhone). | 
| Method Attributes | Method Name and Description | 
|---|---|
| <static> | SDK.addStyle(css)
								 Add a style tag to the page. | 
| <static> | SDK.addStylesheet(fileName)
								 Add a stylesheet link to the page. | 
| <static> | SDK.chime()
								 Play the chime sound. | 
| <static> | SDK.dataURLToBlob(dataURL)
								 | 
| <static> | SDK.error(message)
								 Set the error static field to trap or log any errors. | 
| <static> | SDK.escapeHTML(html)
								 Replace reserved HTML character with their HTML escape codes. | 
| <static> | SDK.evalScripts(node)
								 Evaluate any script tags in the node's descendants. | 
| <static> | SDK.initAudio()
								 | 
| <static> | SDK.initResponsiveVoice()
								 | 
| <static> | SDK.initVideo()
								 | 
| <static> | SDK.innerHTML(element)
								 Fix innerHTML for IE and Safari. | 
| <static> | SDK.insertAtCaret(element, text)
								 Insert the text into the input field. | 
| <static> | SDK.isChrome()
								 Detect Chrome browser. | 
| <static> | SDK.isFirefox()
								 Detect Firefox browser. | 
| <static> | SDK.isIPhone()
								 Detect iPhone OS. | 
| <static> | SDK.isMac()
								 Detect Mac OS. | 
| <static> | SDK.isMobile()
								 Detect mobile browser. | 
| <static> | SDK.isSafari()
								 Detect Safari browser. | 
| <static> | SDK.linkURLs(text)
								 Replace URL and email references in the text with HTML links. | 
| <static> | SDK.nativeTTS(utterance, lang, voice)
								 Speak the native utterance first setting the voice and language. | 
| <static> | SDK.pauseSpeechRecognition()
								 | 
| <static> | SDK.play(file, channelaudio)
								 Play the audio file given the url. | 
| <static> | SDK.popupwindow(url, title, w, h)
								 | 
| <static> | SDK.registerSpeechRecognition(input, button)
								 Enable speech recognition if supported by the browser, and insert the voice to text to the input field. | 
| <static> | SDK.removeScripts(node)
								 Remove any script tags from the node. | 
| <static> | SDK.removeTags(node)
								 | 
| <static> | SDK.resizeAndUploadImage(file, url, width, height, properties, onFinish)
								 | 
| <static> | SDK.responsiveVoiceTTS(utterance, lang, voice)
								 Use the ResponsiveVoice API. | 
| <static> | SDK.showConfirm(message, title, onYes, onNo)
								 Open a JQuery confirm dialog. | 
| <static> | SDK.showError(message, title)
								 Open a JQuery error message dialog. | 
| <static> | SDK.startSpeechRecognition()
								 | 
| <static> | SDK.stopSpeechRecognition()
								 | 
| <static> | SDK.stripTags(html)
								 Strip HTML tags from text. | 
| <static> | SDK.translate(text)
								 | 
| <static> | SDK.tts(text, voice, native, lang, nativeVoice, mod)
								 Convert the text to speech and play it either using the browser native TTS support, or as server generated an audio file. | 
| <static> | SDK.updateAvatar(responseMessage, speak, urlprefix, elementPrefix, channelaudio, afterFunction, nativeVoice, lang, voice)
								 Shared method for updating an avatar image/video/audio from the chat response. | 
| <static> | SDK.uploadImage(fileInput, url, width, height, properties, onFinish)
								 | 
					Field Detail
				
				
					 
					<static> 
					
					
					SDK.applicationId
					
					
					
						You must set your application ID to use the SDK.
You can obtain your application ID from your user page.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.canPlayAudio
					
					
					
						Track if auto play of media is enabled in the browser (mobile Chrome/Safari)
Enable or disable to force audio auto play.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.canPlayVideo
					
					
					
						Track if auto play of media is enabled in the browser (mobile Chrome/Safari)
Enable or disable to force video auto play.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.debug
					
					
					
						Enable debug logging.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.fixBrightness
					
					
					
						Attempt to fix grey mp4 video background (only used for Chrome).
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.fixChromeResizeCSS
					
					
					
						Attempt to fix an issue with Chrome not processing the CSS after correctly when the chat bubble resizes.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.lang
					
					
					
						Set the active language code.
This is used for voice recognition.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.responsiveVoice
					
					
					
						Allow our native speech API to use the third party ResponsiveVoice API.
You must create an account with ResponsiveVoice to use their API, see https://responsivevoice.com
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.secure
					
					
					
						Escape and filter bot messages for HTML and JavaScript content for XSS security.
This prevents bots sending advanced HTML and JavaScript in their messages.
Set this to false to allow your bot to send JavaScript.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.speechRate
					
					
					
						The speechRate can be set to change the native speech voice speed.
It can range between 0.1 (lowest) and 10.0 (highest).
1.0 is the default rate for the current platform or voice.
Other values act as a percentage relative to this, so for example 2.0 is twice as fast, 0.5 is half as fast.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.translator
					
					
					
						Allow text to be translated into another language is the interface elements.
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.useCanvas
					
					
					
						Force avatars to enable or disable canvas for video (currently used only for Chrome and Firefox).
						
						
					
					
					
						
						
						
						
					<static> 
					
					
					SDK.useVideo
					
					
					
						Force avatars to enable or disable video (currently disabled for Safari on iPhone).
						
						
					
					
					
						
						
						
						
					
				
			
		
			
				
					Method Detail
				
				
					 
					<static> 
					
					
					SDK.addStyle(css)
					
					
					
						Add a style tag to the page.
						
						
					
					
					
					
						
							- Parameters:
- css
<static> 
					
					
					SDK.addStylesheet(fileName)
					
					
					
						Add a stylesheet link to the page.
						
						
					
					
					
					
						
							- Parameters:
- fileName
<static> 
					
					
					SDK.chime()
					
					
					
						Play the chime sound.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.dataURLToBlob(dataURL)
					
					
					- Parameters:
- dataURL
<static> 
					
					
					SDK.error(message)
					
					
					
						Set the error static field to trap or log any errors.
						
						
					
					
					
					
						
							- Parameters:
- message
<static> 
					
					
					SDK.escapeHTML(html)
					
					
					
						Replace reserved HTML character with their HTML escape codes.
						
						
					
					
					
					
						
							- Parameters:
- html
<static> 
					
					
					SDK.evalScripts(node)
					
					
					
						Evaluate any script tags in the node's descendants.
This is required when innerHtml contains script nodes as they are not evaluated.
						
						
					
					
					
					
						
							- Parameters:
- node
<static> 
					
					
					SDK.initAudio()
					
					
					<static> 
					
					
					SDK.initResponsiveVoice()
					
					
					<static> 
					
					
					SDK.initVideo()
					
					
					<static> 
					
					
					SDK.innerHTML(element)
					
					
					
						Fix innerHTML for IE and Safari.
						
						
					
					
					
					
						
							- Parameters:
- element
<static> 
					
					
					SDK.insertAtCaret(element, text)
					
					
					
						Insert the text into the input field.
						
						
					
					
					
					
						
							- Parameters:
- element
- text
<static> 
					
					
					SDK.isChrome()
					
					
					
						Detect Chrome browser.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.isFirefox()
					
					
					
						Detect Firefox browser.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.isIPhone()
					
					
					
						Detect iPhone OS.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.isMac()
					
					
					
						Detect Mac OS.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.isMobile()
					
					
					
						Detect mobile browser.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.isSafari()
					
					
					
						Detect Safari browser.
						
						
					
					
					
					
						
						
						
						
						
						
						
					<static> 
					
					
					SDK.linkURLs(text)
					
					
					
						Replace URL and email references in the text with HTML links.
						
						
					
					
					
					
						
							- Parameters:
- text
<static> 
					
					
					SDK.nativeTTS(utterance, lang, voice)
					
					
					
						Speak the native utterance first setting the voice and language.
						
						
					
					
					
					
						
							- Parameters:
- utterance
- lang
- voice
<static> 
					
					
					SDK.pauseSpeechRecognition()
					
					
					<static> 
					
					
					SDK.play(file, channelaudio)
					
					
					
						Play the audio file given the url.
						
						
					
					
					
					
						
							- Parameters:
- file
- channelaudio
<static> 
					
					
					SDK.popupwindow(url, title, w, h)
					
					
					- Parameters:
- url
- title
- w
- h
<static> 
					
					
					SDK.registerSpeechRecognition(input, button)
					
					
					
						Enable speech recognition if supported by the browser, and insert the voice to text to the input field.
Optionally call click() on the button.
						
						
					
					
					
					
						
							- Parameters:
- input
- button
<static> 
					
					
					SDK.removeScripts(node)
					
					
					
						Remove any script tags from the node.
						
						
					
					
					
					
						
							- Parameters:
- node
<static> 
					
					
					SDK.removeTags(node)
					
					
					- Parameters:
- node
<static> 
					
					
					SDK.resizeAndUploadImage(file, url, width, height, properties, onFinish)
					
					
					- Parameters:
- file
- url
- width
- height
- properties
- onFinish
<static> 
					
					
					SDK.responsiveVoiceTTS(utterance, lang, voice)
					
					
					
						Use the ResponsiveVoice API.
						
						
					
					
					
					
						
							- Parameters:
- utterance
- lang
- voice
<static> 
					
					
					SDK.showConfirm(message, title, onYes, onNo)
					
					
					
						Open a JQuery confirm dialog.
						
						
					
					
					
					
						
							- Parameters:
- message
- title
- onYes
- onNo
<static> 
					
					
					SDK.showError(message, title)
					
					
					
						Open a JQuery error message dialog.
						
						
					
					
					
					
						
							- Parameters:
- message
- title
<static> 
					
					
					SDK.startSpeechRecognition()
					
					
					<static> 
					
					
					SDK.stopSpeechRecognition()
					
					
					<static> 
					
					
					SDK.stripTags(html)
					
					
					
						Strip HTML tags from text.
Return plain text.
						
						
					
					
					
					
						
							- Parameters:
- html
<static> 
					
					
					SDK.translate(text)
					
					
					- Parameters:
- text
<static> 
					
					
					SDK.tts(text, voice, native, lang, nativeVoice, mod)
					
					
					
						Convert the text to speech and play it either using the browser native TTS support, or as server generated an audio file.
The voice is optional and can be any voice supported by the server (see the voice page for a list of voices).
For native voices a language code can be given.
If the browser supports TTS the native voice will be used by default.
						
						
					
					
					
					
						
							- Parameters:
- text
- voice
- native
- lang
- nativeVoice
- mod
<static> 
					
					
					SDK.updateAvatar(responseMessage, speak, urlprefix, elementPrefix, channelaudio, afterFunction, nativeVoice, lang, voice)
					
					
					
						Shared method for updating an avatar image/video/audio from the chat response.
						
						
					
					
					
					
						
							- Parameters:
- responseMessage
- speak
- urlprefix
- elementPrefix
- channelaudio
- afterFunction
- nativeVoice
- lang
- voice
<static> 
					
					
					SDK.uploadImage(fileInput, url, width, height, properties, onFinish)
					
					
					- Parameters:
- fileInput
- url
- width
- height
- properties
- onFinish