Repository navigation
Live chat transfer and chat.transferred - #109
Merged
Merged
Conversation
Ports escalated-laravel ChatController::transfer and
ChatSessionService::transferChat as POST chat/{session}/transfer, and
sends chat.transferred to webhooks and workflows.
This was referenced Oct 23, 2026
Merged
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Ports escalated-laravel's live chat transfer (
ChatController::transfer,ChatSessionService::transferChat), so the plugin can emitchat.transferred(ADR 2026-10-21 event vocabulary), as escalated-go #167 and escalated-phoenix #176 did.What
POST /wp-json/escalated/v1/chat/{session_id}/transfer, with an API token like the other agent chat endpoints (WordPress has no route names; this is the plugin's equivalent ofescalated.admin.chat.transfer). Body{agent_id, department_id}(either or both); the sharedChatActionBarbody{type, id}is accepted too.ticket.assigned/ticket.department_changedfires for the transfer itself (a re-route then accepts through the normal path).TicketAccess::allows); 404 unknown session. Response{"message": "Chat transferred.", "session": {...}}.escalated_chat_transferredaction ($session, $from_agent_id, $to_agent_id, $to_department_id).chat.transferredis a workflow trigger ("Chat transferred") and a webhook event offered in the webhook form. Payload: the ticket pluschat {session_id, ticket_id, status, agent_id, department_id, from_agent_id, to_agent_id, to_department_id}, matching Laravel'sDispatchWebhook::chatPayload; no visitor email or token.Note: the plugin's webhooks still do not send the other chat events (
chat.started/assigned/message/ended); only workflows get those. Left as is here.Tests
tests/Test_Chat_Transfer.phpthrough the real REST server and boot hooks: agent transfer (webhook payload + workflow log), department transfer with re-routing, department transfer with no agent (waiting), both, ChatActionBar body, refusals (no token, no target, blank target, unknown/non-integer department, unknown agent, unknown session, ended chat) with no event sent, an agent outside the department under department visibility. All red before (404).Test_Workflow_Wiringnow fireschat.transferredtoo. Full suite in the WP test lib on MySQL 8: 913 tests, 1 failure, the existingTest_Ticket_Access_Migration"separate database" case that needs a second database grant the local harness lacks (fails onmaintoo). Pint clean.