$zopim.livechat.departments
Control the departments in your account.
$zopim. | Control the departments in your account. |
Functions | |
filter | Display only the specified departments in the pre-chat form. |
setVisitorDepartment | Set the visitor’s default department for the current session. |
clearVisitorDepartment | Clear the visitor’s default department. |
getDepartment | Return an object containing information about the specified department, including its id, name and status. |
getAllDepartments | Return a list of all enabled departments containing information about each department including its id, name and status. |
setLabel | Set the department label. |
filter
function filter( /* department1[, department2[, department3[, ...]]] * / )
Display only the specified departments in the pre-chat form. All other departments will be hidden regardless of their status.
Department names are matched in a case-insensitive manner.
Passing in no arguments causes all departments to be displayed. If none of department names or IDs passed in are valid (e.g. an empty string is passed in), the department dropdown menu will be hidden.
Parameters
department1, department2, ... | ID(s) or name(s) of department(s) to be displayed |
Example
#NORUN <script> $zopim(function() { $zopim.livechat.departments.filter('Marketing', 'Sales'); }); </script>
setVisitorDepartment
function setVisitorDepartment( id )
Set the visitor’s default department for the current session.
Chat requests will be routed to this department unless the visitor selects another department in the pre-chat form or the department is offline.
Note: If the visitor has already started chatting, changes to the default department will not affect the department of the started chat. The changes to the default department will also not take effect until a page change or refresh. The department of the started chat will persist and be taken as the default department until a page change or refresh, even when the visitor has explicitly ended the chat.
Offline messages will also be routed to this department.
Parameters
id (number or string) | Id or name of the department to be set |
Example
#NORUN <script> $zopim(function() { $zopim.livechat.departments.setVisitorDepartment('Marketing'); }); </script>
clearVisitorDepartment
function clearVisitorDepartment()
Clear the visitor’s default department.
Note: If the visitor has already started chatting, changes to the default department will not affect the department of the started chat. The changes to the default department will also not take effect until a page change or refresh. The department of the started chat will persist and be taken as the default department until a page change or refresh, even when the visitor has explicitly ended the chat.
getDepartment
function getDepartment( id )
Return an object containing information about the specified department, including its id, name and status. Return undefined if the department is not found or not enabled.
Note: This function should only be called after the widget is connected (see example).
Parameters
id (number or string) | Id or name of the department |
Example
#NORUN <script> $zopim(function() { $zopim.livechat.setOnConnected(function() { var marketing_department = $zopim.livechat.departments.getDepartment('Marketing'); // do something }); }); </script>
getAllDepartments
function getAllDepartments()
Return a list of all enabled departments containing information about each department including its id, name and status.
Note: This function should only be called after the widget is connected (see example).
Example
#NORUN <script> $zopim(function() { $zopim.livechat.setOnConnected(function() { var all_departments = $zopim.livechat.departments.getAllDepartments(); // do something }); }); </script>
Display only the specified departments in the pre-chat form.
function filter( /* department1[, department2[, department3[, ...]]] * / )
Set the visitor’s default department for the current session.
function setVisitorDepartment( id )
Clear the visitor’s default department.
function clearVisitorDepartment()
Return an object containing information about the specified department, including its id, name and status.
function getDepartment( id )
Return a list of all enabled departments containing information about each department including its id, name and status.
function getAllDepartments()
Set the department label.
function setLabel( label )