feat: WhatsApp AI hattı (n8n + Evolution API) için yeni uç nokta

chat.controller.ts'teki dosya-bağlamı toplama mantığı (belgeler + analiz
özeti + geçmiş mesajlar) buildCaseChatContext() olarak paylaşılan hale
getirildi — mevcut SSE sohbeti (chatMessage) davranış değişmeden bunu
kullanıyor, yeni POST /api/whatsapp/message uç noktası da aynı motoru
tek-seferlik (non-streaming) çağırıyor.

Kimlik doğrulama farklı: bu uç nokta bir Supabase oturumu taşımıyor
(n8n'den gelen anonim WhatsApp mesajı), X-Webhook-Secret ile korunuyor.
Telefon → hesap eşleştirmesi profiles.phone üzerinden, hangi dava
dosyasıyla konuşulduğu whatsapp_sessions'ta tutuluyor (bkz. laawos
sql/20_whatsapp_integration.sql).

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
Mustafa Yildiz
2026-08-18 13:08:02 +03:00
co-authored by Claude Sonnet 5
parent fed881de49
commit 5fe4b0b8bc
4 changed files with 265 additions and 58 deletions
+2
View File
@@ -7,6 +7,7 @@ import templateRoutes from './template.routes';
import draftingRoutes from './drafting.routes';
import googleDriveRoutes from './googleDrive.routes';
import authRoutes from './auth.routes';
import whatsappRoutes from './whatsapp.routes';
const router = Router();
@@ -21,6 +22,7 @@ router.use('/cases', caseRoutes);
router.use('/templates', templateRoutes);
router.use('/drafting', draftingRoutes);
router.use('/google-drive', googleDriveRoutes);
router.use('/whatsapp', whatsappRoutes); // POST /api/whatsapp/message (n8n webhook, ayrı X-Webhook-Secret doğrulaması)
router.use('/', precedentRoutes); // Keeps the same paths like /api/search-precedents
export default router;