Widget
These api:s can be executed with different services.
toggle
Open or close widget depending on the state it is in. If state is open then toggle will close.
Usage
_imbox.push(["toggle"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
</script>
<a href="#" onclick="_imbox.push(['toggle']); return false;">Toggle chat</a>
hideWidget
Hide the widget.
This API can be used in combination with toggle, openChat or close to customize the widgets behaviour.
Usage
_imbox.push(["hideWidget"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["hideWidget"])
</script>
hideLauncher
Hide the default launcher.
This API can be used in combination with toggle, openChat or close to customize the launchers behaviour.
Usage
_imbox.push(["hideLauncher"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["toggle"])
_imbox.push(["hideLauncher"])
</script>
hideService
Hide a service in the widget.
This API enables you to hide a certain service in the widget. Make note that you are responsible for making sure at least one service is visible.
Usage
_imbox.push(["hideService", "chat"])
_imbox.push(["hideService", "faq"])
_imbox.push(["hideService", "form"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["hideService", "chat"])
</script>
showService
Show a service in the widget.
This API enables you to show a certain service that has previously been hidden in the widget. Make note that you are responsible for making sure at least one service is visible.
Usage
_imbox.push(["showService", "chat"])
_imbox.push(["showService", "faq"])
_imbox.push(["showService", "form"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["showService", "chat"])
</script>
setLanguage
Set the language shown in the widget.
This API can be used to update the language in the widget on multilingual sites.
Usage
_imbox.push(["setLanguage"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["setLanguage", "en"])
</script>
setDisableSound
Disable sounds in the widget.
Usage
_imbox.push(["setDisableSound"])
Example
<script type="text/javascript">
var _imbox = _imbox || []
_imbox.push(["setDisableSound"])
</script>
onNavigation
Register a listener on widget navigation,
This API can be used for keeping track of navigation events within the widget.
Usage
_imbox.push(["onNavigation", callback])
Example
<script type="text/javascript">
var _imbox = _imbox || []
function handleNavigation(data) {
/* data = {
service: 'chat' | 'faq' | 'form',
data: {
formId?: number
faqId?: number
categoryId?: number
articleId?: number
agentId?: number
}
}
*/
console.log("Navigation event emitted, data: ", data)
}
_imbox.push(["onNavigation", handleNavigation])
</script>
onToggle
Register a listener on widget open/close,
This API can be used for keeping track of whether the widget is shown or not.
Usage
_imbox.push(["onToggle", callback])
Example
<script type="text/javascript">
var _imbox = _imbox || []
function handleToggle(data) {
// data = { isOpen: boolean }
if (!data.isOpen) {
_imbox.push("openChat")
}
}
_imbox.push(["onToggle", handleToggle])
</script>