Question
Departments help filter chat requests to specific groups of agents. How do I set or change the department of a chat?
Answer
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.
8 comments
Martin Jury
How to set department after working hours? It's not working on the web widget!
1
Dion
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
0
Martin Jury
I know how to change operating hours. The problem is after operation hours end, our tickets don't have any assigned department.
0
Dion
0
David
Dion
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?
0
Greg Katechis
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.
0
David
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:
0
David
Adding a question to do, should we even be able to select the Chat department with an if statement here?
0