Departments help filter chat requests to specific groups of agents. How do I set or change the department of a chat?
Before a chat has started
Before a chat starts the department can be set using the trigger condition Set visitor department as described in this article: Automatically route chats to departments. You can also use the API to set the Chat department. Read more about that in our developer documentation: Chat API: Departments. Finally, if you have the pre-chat form enabled, the visitor can choose a department from within the form when they request a chat.
After a chat has started
At this point, it is too late for a trigger to make a change. Your agents can either manually reassign the ticket or, if you are using a bot, you can leverage the conversations API to assign the chat. The bot can read the content of the message and initiate a transfer to the department you specify. For more information, see our developer documentation: Chat Conversations API.
How to set department after working hours? It's not working on the web widget!
You can set the operating hours of a department by going to settings > hours > operating hours and then select department schedules. You can check this article for more information: Setting up operating hours
I know how to change operating hours. The problem is after operation hours end, our tickets don't have any assigned department.
We are attempting to select the department in js based on the tags present. However doing so, our script fails and returns no selected visitor department.. Could you help us have a look at this?
Hi David! It's difficult to say exactly what the issue may be from the snippet that you shared. There is an event listener that's firing both of your `if` statements and it seems that the second one is dependent on the first one. I would recommend console.logging/debugging to see where this is stopping so that you can figure out where the breakdown is occurring.
To test if the issue is with our API, you can simply run a script on the site where you have your widget with only the widget code to see if it updates properly.
Greg Katechis by debugging the console tell us our script runs as expected, going through the if statement, tho non of them selects the chat department.
When the visitors request a chat through this script, it goes to 'no department'.
We tried solving this with tags in the script for the Chat triggers to pick up on:
Adding a question to do, should we even be able to select the Chat department with an if statement here?
Please sign in to leave a comment.