Execute bot after chat transfer to another department
The goal is to:
- Have
Bot AinDepartment A. - Bot A has a trigger that sets the chat to a pending state.
Department Ais configured to transfer the chat toDepartment Bif the chat is not accepted within 30 seconds.Department BhasBot B.- After the transfer, the chat should revert to bot status, and
Bot B's trigger should execute.
Requirements:
- Minimum version 4.16v.
- Cron job setup as described here.
- This setup allows the transfer between departments even if the visitor has left the chat.
- This is also required for third-party integrations.
How it works:
- Transfer between departments occurs only if the chat is in a pending state.
- After the transfer, listen to
chat.data_changed_assigned_departmentand adjust chat attributes accordingly:- Change the chat's
bot_idattribute. - Set the chat status to bot chat.
- Change the chat's
- It is also advisable to check the incoming webhook configuration ->
Chat should be reset to default department. Bot also will be set to default.so that if the chat was closed, it will start in the originalDepartment Awith the original bot.

Trigger Configuration:

Department A configuration to transfer chat to Department B:
