| @@ -171,8 +171,9 @@ | ||
| 171 | 171 | // customer PII |
| 172 | 172 | 'mxchat_handle_order_history', |
| 173 | 173 | // disruptive handoff / data-collection flows |
| 174 | 174 | 'mxchat_live_agent_handover', 'mxchat_telegram_live_agent_handover', |
| 175 | + 'mxchat_webhook_live_agent_handover', | |
| 175 | 176 | 'mxchat_handle_email_capture', 'mxchat_handle_form_collection', |
| 176 | 177 | )); |
| 177 | 178 | } |
| 178 | 179 | |
| @@ -255,8 +256,16 @@ | ||
| 255 | 256 | 'label' => __('Hand Off to Live Agent (Telegram)', 'mxchat'), |
| 256 | 257 | 'description' => __('Transfer the conversation to a human support agent on Telegram.', 'mxchat'), |
| 257 | 258 | 'default_hint' => __('Use this when the visitor has asked something you cannot answer from the knowledge base, or has asked twice about the same unresolved problem.', 'mxchat'), |
| 258 | 259 | ), |
| 260 | + // Webhook destination (plan d88e22): outbound-only — the handoff is | |
| 261 | + // POSTed to the owner's configured URL and the conversation stays in | |
| 262 | + // AI mode; the receiving system follows up out-of-band. | |
| 263 | + 'mxchat_webhook_live_agent_handover' => array( | |
| 264 | + 'label' => __('Hand Off to Live Agent (Webhook)', 'mxchat'), | |
| 265 | + 'description' => __('Notify the site\'s human support team about this conversation via the configured webhook. The team follows up separately; you keep assisting meanwhile.', 'mxchat'), | |
| 266 | + 'default_hint' => __('Use this when the visitor has asked something you cannot answer from the knowledge base, or has asked twice about the same unresolved problem.', 'mxchat'), | |
| 267 | + ), | |
| 259 | 268 | )); |
| 260 | 269 | } |
| 261 | 270 | |
| 262 | 271 | /* ------------------------------------------------------------------ * |
| @@ -442,12 +451,13 @@ | ||
| 442 | 451 | } |
| 443 | 452 | |
| 444 | 453 | /** |
| 445 | 454 | * Withhold each live-agent handover tool outside ITS channel's availability |
| 446 | - * schedule (plans 8ccaa2 + 99d7a4). Slack and Telegram carry independent | |
| 447 | - * schedules: if Slack is off-hours but Telegram is staffed, the Telegram | |
| 448 | - * handoff stays offered and only the Slack one is withheld — and vice | |
| 449 | - * versa. Off-hours the bot must not DANGLE a human it cannot reach, so the | |
| 455 | + * schedule (plans 8ccaa2 + 99d7a4; webhook added by d88e22). Slack, | |
| 456 | + * Telegram, and the webhook destination carry independent schedules: if | |
| 457 | + * Slack is off-hours but Telegram is staffed, the Telegram handoff stays | |
| 458 | + * offered and only the Slack one is withheld — and likewise for each other | |
| 459 | + * pair. Off-hours the bot must not DANGLE a human it cannot reach, so the | |
| 450 | 460 | * tool never reaches the model in the first place. |
| 451 | 461 | * |
| 452 | 462 | * Applied HERE and deliberately NOT in available_tools(): that function |
| 453 | 463 | * feeds the admin AI Tools checklist, which must keep showing the owner's |
| @@ -471,8 +481,11 @@ | ||
| 471 | 481 | $withhold[] = 'mxchat_live_agent_handover'; |
| 472 | 482 | } |
| 473 | 483 | if (!MxChat_Live_Agent_Schedule::is_within_hours('telegram')) { |
| 474 | 484 | $withhold[] = 'mxchat_telegram_live_agent_handover'; |
| 485 | + } | |
| 486 | + if (!MxChat_Live_Agent_Schedule::is_within_hours('webhook')) { | |
| 487 | + $withhold[] = 'mxchat_webhook_live_agent_handover'; | |
| 475 | 488 | } |
| 476 | 489 | if (empty($withhold)) { |
| 477 | 490 | return $tools; |
| 478 | 491 | } |