WhatsApp dejaba de usar su bot propio (árbol de menús sin login ni compras) y pasa al motor compartido, así los tres canales quedan iguales. - TelegramBotService recibe el canal por constructor; flujos, menús, Gemini, OCR, validación de pagos y datos bancarios salen de ChatConfig sin duplicar - WhatsApp no tiene teclados inline: las opciones se envían numeradas y la respuesta numérica se traduce al callback equivalente - estado en caché con prefijo por canal (Telegram conserva el suyo para no cerrar las sesiones abiertas) - descarga de comprobantes y audios por la Graph API de Meta - respuesta manual del asesor y aviso de vencimiento salen también por WhatsApp - la pantalla de WhatsApp queda sólo con credenciales; el resto se administra en Chat / Bot Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
87 lines
5.9 KiB
PHP
87 lines
5.9 KiB
PHP
<div>
|
|
<div class="max-w-3xl mx-auto">
|
|
<h1 class="text-2xl font-bold text-gray-800 flex items-center gap-2 mb-6">
|
|
<svg class="w-7 h-7 text-green-500" fill="none" viewBox="0 0 24 24" stroke="currentColor">
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M10.325 4.317c.426-1.756 2.924-1.756 3.35 0a1.724 1.724 0 002.573 1.066c1.543-.94 3.31.826 2.37 2.37a1.724 1.724 0 001.065 2.572c1.756.426 1.756 2.924 0 3.35a1.724 1.724 0 00-1.066 2.573c.94 1.543-.826 3.31-2.37 2.37a1.724 1.724 0 00-2.572 1.065c-.426 1.756-2.924 1.756-3.35 0a1.724 1.724 0 00-2.573-1.066c-1.543.94-3.31-.826-2.37-2.37a1.724 1.724 0 00-1.065-2.572c-1.756-.426-1.756-2.924 0-3.35a1.724 1.724 0 001.066-2.573c-.94-1.543.826-3.31 2.37-2.37.996.608 2.296.07 2.572-1.065z"/>
|
|
<path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M15 12a3 3 0 11-6 0 3 3 0 016 0z"/>
|
|
</svg>
|
|
Configuración del Bot WhatsApp
|
|
</h1>
|
|
|
|
<form wire:submit.prevent="save" class="space-y-6">
|
|
|
|
{{-- Credenciales Meta --}}
|
|
<div class="bg-white rounded-xl shadow p-6 space-y-4">
|
|
<h2 class="text-base font-semibold text-gray-700 border-b border-gray-100 pb-2">Credenciales Meta / Graph API</h2>
|
|
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">Token de acceso (Bearer) *</label>
|
|
<input wire:model="whatsapp_token" type="password"
|
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-400 font-mono">
|
|
@error('whatsapp_token') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
|
</div>
|
|
|
|
<div class="grid grid-cols-2 gap-4">
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">Phone Number ID *</label>
|
|
<input wire:model="phone_number_id" type="text" placeholder="123456789012345"
|
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-400 font-mono">
|
|
@error('phone_number_id') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
|
</div>
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">URL API (Graph) *</label>
|
|
<input wire:model="whatsapp_api_url" type="url"
|
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-400 font-mono">
|
|
@error('whatsapp_api_url') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
|
</div>
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">Webhook Verify Token *</label>
|
|
<input wire:model="webhook_verify_token" type="text"
|
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-400 font-mono">
|
|
@error('webhook_verify_token') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
|
</div>
|
|
|
|
<div>
|
|
<label class="block text-xs font-medium text-gray-600 mb-1">App Secret *</label>
|
|
<input wire:model="app_secret" type="text"
|
|
class="w-full border border-gray-300 rounded-lg px-3 py-2 text-sm focus:outline-none focus:ring-2 focus:ring-green-400 font-mono">
|
|
<p class="text-xs text-gray-400 mt-1">Firma los webhooks entrantes. Sin este valor el webhook rechaza todo.</p>
|
|
@error('app_secret') <p class="text-red-500 text-xs mt-1">{{ $message }}</p> @enderror
|
|
</div>
|
|
</div>
|
|
|
|
{{-- Control del bot --}}
|
|
<div class="bg-white rounded-xl shadow p-6 space-y-4">
|
|
<h2 class="text-base font-semibold text-gray-700 border-b border-gray-100 pb-2">Control del Bot</h2>
|
|
|
|
<div class="flex items-center gap-4">
|
|
<label class="text-sm font-medium text-gray-700">Estado del bot</label>
|
|
<label class="relative inline-flex items-center cursor-pointer">
|
|
<input type="checkbox" wire:model="bot_enabled" value="1"
|
|
class="sr-only peer">
|
|
<div class="w-11 h-6 bg-gray-200 peer-focus:outline-none rounded-full peer peer-checked:after:translate-x-full peer-checked:after:border-white after:content-[''] after:absolute after:top-[2px] after:left-[2px] after:bg-white after:border-gray-300 after:border after:rounded-full after:h-5 after:w-5 after:transition-all peer-checked:bg-green-500"></div>
|
|
<span class="ml-3 text-sm text-gray-600">{{ $bot_enabled ? 'Activo' : 'Inactivo' }}</span>
|
|
</label>
|
|
</div>
|
|
|
|
|
|
<p class="text-xs text-gray-400">
|
|
Los mensajes, menús y flujos del bot se administran en
|
|
<span class="font-medium text-gray-500">Chat / Bot → Configuración</span>;
|
|
WhatsApp usa exactamente los mismos que Telegram y el chat web.
|
|
</p>
|
|
</div>
|
|
|
|
<div class="flex justify-end">
|
|
<button type="submit"
|
|
class="bg-green-500 hover:bg-green-600 text-white px-6 py-3 rounded-lg font-semibold text-sm transition flex items-center gap-2">
|
|
<svg class="w-4 h-4" fill="none" viewBox="0 0 24 24" stroke="currentColor"><path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M5 13l4 4L19 7"/></svg>
|
|
Guardar Configuración
|
|
</button>
|
|
</div>
|
|
</form>
|
|
</div>
|
|
</div>
|