fix(agent-bot): dispatch webhook event on agent bot assignment

When an AgentBot is assigned to a conversation after the first message,
the bot receives no event and cannot respond. This adds ASSIGNEE_CHANGED
event dispatch for agent bot assignment changes and handles it in the
AgentBotListener to notify the bot via webhook.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Muhsin
2026-04-02 10:52:33 +04:00
co-authored by Claude Opus 4.6
parent 211fb1102d
commit 40d00d895d
3 changed files with 34 additions and 1 deletions
+1 -1
View File
@@ -29,7 +29,7 @@ module AssignmentHandler
def notify_assignment_change
{
ASSIGNEE_CHANGED => -> { saved_change_to_assignee_id? },
ASSIGNEE_CHANGED => -> { saved_change_to_assignee_id? || saved_change_to_assignee_agent_bot_id? },
TEAM_CHANGED => -> { saved_change_to_team_id? }
}.each do |event, condition|
condition.call && dispatcher_dispatch(event, previous_changes)