diff --git a/scripts/apply-menus.php b/scripts/apply-menus.php index 5ba3c89..fc48f40 100644 --- a/scripts/apply-menus.php +++ b/scripts/apply-menus.php @@ -97,6 +97,10 @@ $menuConfig = [ 'ciclo_cosecha_historico' => ['type' => 'function', 'function' => 'api_report', 'params' => ['endpoint_key' => 'cosecha_dn', 'filename' => 'ciclo_cosecha_30dias.xlsx', 'caption' => 'Histórico ciclos de cosecha últimos 30 días', 'date_mode' => 'last_30']], ], 'per_type' => [ + '3' => [ + 'greeting' => '¡Bienvenido! Escribe *menu* para ver las opciones disponibles.', + 'fallback' => 'No entendí. Escribe *menu* para ver las opciones disponibles.', + ], '1' => [ 'greeting' => '¡Bienvenido! Escribe *menu* para recibir información.', 'fallback' => 'Escribe *menu* para recibir información.', diff --git a/services/NormalBot.php b/services/NormalBot.php index 6093132..5cc5732 100644 --- a/services/NormalBot.php +++ b/services/NormalBot.php @@ -48,14 +48,15 @@ class NormalBot $greeting = $perType['greeting'] ?? $config['greeting'] ?? null; if ($greeting !== null && $currentNode === null) { - ConversationContext::updateNode($ctxId, 'greeting'); - $greetingFlowId = $perType['greeting_flow'] ?? 'greeting'; if (isset($flows[$greetingFlowId])) { + ConversationContext::updateNode($ctxId, $greetingFlowId); return self::handleFlow($flows[$greetingFlowId], $context, $company, $ctxId); } - return self::sendText($greeting, $context['from'], $company); + $response = self::sendText($greeting, $context['from'], $company); + ConversationContext::updateNode($ctxId, null); + return $response; } $fallback = $perType['fallback'] ?? $config['fallback'] ?? null;