feat: WhatsApp webhook — reescritura del controller y rutas en web.php

Simplifica WhatsAppWebhookController: messages crea WhatsappLog con tipo
'recibido', statuses actualiza el log existente por whatsapp_mensaje_id,
opt-out detecta solo STOP/cancelar con regex. Agrega rutas GET/POST
/webhook/whatsapp fuera del grupo auth en web.php (POST sin CSRF).

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-05-24 22:01:37 -06:00
parent 61b18df8e8
commit f246a709c4
2 changed files with 34 additions and 123 deletions
+4
View File
@@ -54,6 +54,10 @@ Route::get('/',function(){return view('auth.login');});
Route::get('/prueba',function(){return view('prueba.index');});
Route::post('/stripe/webhook', [StripeWebhookController::class, 'handle']);
Route::get('/webhook/whatsapp', [\App\Http\Controllers\WhatsAppWebhookController::class, 'verify']);
Route::post('/webhook/whatsapp', [\App\Http\Controllers\WhatsAppWebhookController::class, 'handle'])
->withoutMiddleware([\App\Http\Middleware\VerifyCsrfToken::class]);
Route::middleware(['auth:sanctum',config('jetstream.auth_session'),'verified',
])->group(function () {