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.