Migrating from the Chat widget syntax

This article describes how to migrate from the Chat widget syntax to the unified Web Widget (Classic) syntax.

The vast majority of the legacy $zopim.livechat APIs are aliased so they'll continue to work without the need to update any code.

In some cases, subtle differences might exist in how the APIs behave in the Web Widget (Classic) compared to the Chat widget. For example, the Web Widget doesn't have any separation between its launcher and window, so if you call hide or setOffset it is applied to the entire widget instead of just the launcher or window. Refer to the notes of each API below for more detail.

If you intend to continue using the $zopim.livechat syntax for some time before migrating to the new zE syntax, refer to Using the Chat widget JavaScript API in the Zendesk help center to understand how to correctly wrap $zopim.livechat API calls when using zE.

To read detailed descriptions for each API, refer to the Web Widget (Classic) developer documentation.

General APIs

$zopim.livechat syntaxzE syntax
authenticatezESettings.webWidget.authenticate.chat
badge.hidezE('webWidget', 'hide')
badge.showzE('webWidget', 'show')
button.hidezE('webWidget', 'hide')
button.showzE('webWidget', 'show')
endChatzE('webWidget', 'chat:end')
hideAllzE('webWidget', 'hide')
isChattingzE('webWidget:get', 'chat:isChatting')
addTagszE('webWidget', 'chat:addTags', array<string>)
removeTagszE('webWidget', 'chat:removeTags', array<string>)
sayzE('webWidget', 'chat:send', msg)
set*zE('webWidget', 'prefill', data<object>) and zE('webWidget', 'setLocale', data<string>)
setDefaultImplicitConsentzESettings.cookies
setLanguagezE('webWidget', 'setLocale', data<string>)
window.popoutzE('webWidget', 'popout')
window.togglezE('webWidget', 'toggle')
window.hidezE('webWidget', 'hide')
window.show*zE('webWidget', 'open')
window.getDisplayzE('webWidget:get', 'display')

* $zopim.livechat.set() currently supports the following APIs: name, email and language. * $zopim.livechat.window.show() will show the chat product in the widget by default.

Visitor Information

$zopim.livechat syntaxzE syntax
setName*zE('webWidget', 'prefill', { name: { value: 'John Doe', readOnly: true|false }})
setEmail*zE('webWidget', 'prefill', { email: { value: '[email protected]', readOnly: true|false }})
setPhone*zE('webWidget', 'prefill', { phone: { value: '12345678', readOnly: true|false }})
sendVisitorPathzE('webWidget', 'updatePath')
clearAllzE('webWidget', 'logout')

* You can set the name, phone, and email at the same time using the new prefill API. To set multiple attributes concurrently, provide a prefill object that has a key for each attribute. Example:

zE('webWidget', 'prefill', {  name: {},  email: {},  phone: {}})

Events

$zopim.livechat syntaxzE syntax
setOnConnectedzE('webWidget:on', 'chat:connected', () => {})
setOnChatStartzE('webWidget:on', 'chat:start', () => {})
setOnChatEndzE('webWidget:on', 'chat:end', () => {})
setOnStatuszE('webWidget:on', 'chat:status', (status) => {})
setOnUnreadMsgszE('webWidget:on', 'chat:unreadMessages', (msgs) => {})
window.onShowzE('webWidget:on', 'open', () => {})
window.onHidezE('webWidget:on', 'close', () => {})

Customization APIs

$zopim.livechat syntaxzE syntax
badge.setColorzESettings.webWidget.color.launcher
badge.setLayoutzESettings.webWidget.launcher.badge.layout
badge.setImagezESettings.webWidget.launcher.badge.image
badge.setTextzESettings.webWidget.launcher.badge.label
button.setOffsetVerticalzESettings.webWidget.offset.vertical
button.setOffsetVerticalMobilezESettings.webWidget.offset.mobile.vertical
button.setOffsetHorizontalzESettings.webWidget.offset.horizontal
button.setOffsetHorizontalMobilezESettings.webWidget.offset.mobile.horizontal
button.setPosition*zESettings.webWidget.position
button.setPositionMobile*zESettings.webWidget.position
button.setColorzESettings.webWidget.color.launcher
button.setOffsetBottomzESettings.webWidget.offset.vertical
window.setColorzESettings.webWidget.color.theme
window.setTitlezESettings.webWidget.chat.title
window.setOffsetVerticalzESettings.webWidget.offset.vertical
window.setOffsetHorizontalzESettings.webWidget.offset.horizontal
window.setOffsetBottomzESettings.webWidget.offset.vertical
window.setPosition*zESettings.webWidget.position
prechatForm.setGreetingszESettings.webWidget.chat.prechatForm.greeting
offlineForm.setGreetingszESettings.webWidget.chat.offlineForm.greeting
mobileNotifications.setDisabledzESettings.webWidget.chat.notifications.mobile.disable
theme.setColor*zESettings.webWidget.color.theme
theme.setColors*zESettings.webWidget.color.theme
theme.setProfileCardConfigzESettings.webWidget.chat.profileCard.avatar, zESettings.webWidget.chat.profileCard.title, zESettings.webWidget.chat.profileCard.rating
setDisableGoogleAnalyticszESettings.analytics
setGreetingszESettings.webWidget.launcher.chatLabel
setStatusThe $zopim.livechat syntax is supported. However, it is not mapped to the unified Web Widget API
button.setHideWhenOfflinezESettings.webWidget.chat.hideWhenOffline

* All the position values supported in the legacy Chat Widget can be used except for tm (Top middle), and bm (Bottom middle). See the complete list of position values in the legacy Chat documentation. Also note that setting the position for mobile or desktop will affect both mobile and desktop versions of the web widget.

* $zopim.livechat.theme.setColor supports the primary color only.

* $zopim.livechat.theme.setColors supports the primary color only.

Concierge

$zopim.livechat syntaxzE syntax
concierge.setAvatarzESettings.webWidget.chat.concierge.avatarPath
concierge.setNamezESettings.webWidget.chat.concierge.name
concierge.setTitlezESettings.webWidget.chat.concierge.title

Departments

$zopim.livechat syntaxzE syntax
departments.filterzESettings.webWidget.chat.departments.enabled
departments.setVisitorDepartmentzESettings.webWidget.chat.departments.select
departments.clearVisitorDepartmentzESettings.webWidget.chat.departments.select
departments.getDepartmentzE('webWidget:get', 'chat:department', id or name)
departments.getAllDepartmentszE('webWidget:get', 'chat:departments')
departments.setLabelzESettings.webWidget.chat.prechatForm.departmentLabel

What APIs are not supported

Below is a list of the $zopim.livechat APIs that are not supported in the Web Widget (Classic). Due to low adoption of these APIs in the standalone Chat widget, they won't be migrated over to the new experience.

Deprecated

$zopim.livechat syntaxNotes
setDisableSoundAdmin setting has replaced the need for this
setNotesNo longer supported for security reasons
appendNotesAs above
bubble.showChat bubble feature is no longer supported
bubble.hideAs above
bubble.resetAs above
bubble.setTitleAs above
bubble.setTextAs above
bubble.setColorAs above
getNameAs above
getEmailAs above
getPhoneAs above
setSizeAs above
theme.reloadTheme API calls are applied automatically and do not require this subsequent call
theme.setFontConfigChat themes are no longer available
theme.setThemeAs above
cookieLaw.complyCookie law format is changing