Integrate WhatsApp Gateway for mail notifications
This commit is contained in:
@@ -1,6 +1,7 @@
|
||||
import { NextResponse } from 'next/server';
|
||||
import { prisma } from '@/lib/prisma';
|
||||
import { sendTelegramNotification } from '@/lib/notifications';
|
||||
import { sendWA } from '@/lib/whatsapp';
|
||||
|
||||
// Bu kısım normalde .env içinde olmalı
|
||||
const WEBHOOK_SECRET = process.env.WEBHOOK_SIGNAL_SECRET || 'besiktasK1903*';
|
||||
@@ -74,7 +75,14 @@ export async function POST(request: Request) {
|
||||
"" // Analiz bilgisini kaldırdık
|
||||
);
|
||||
|
||||
// 4. Bildirim Logu
|
||||
// 4. Bildirim Gönder (WhatsApp)
|
||||
// Şu an için varsayılan numaraya gönderiyoruz, ilerde User modeline alan eklenebilir.
|
||||
const waNumber = process.env.DEFAULT_WHATSAPP_NUMBER || '905543765103';
|
||||
const waMessage = `📩 *Yeni E-posta*\n\n*Gönderen:* ${mailData.from}\n*Konu:* ${mailData.subject}\n*Alıcı:* ${to}\n\n_AyrisMail Central_`;
|
||||
|
||||
await sendWA(waNumber, waMessage);
|
||||
|
||||
// 5. Bildirim Logu
|
||||
await prisma.notificationLog.create({
|
||||
data: {
|
||||
mailbox: to,
|
||||
|
||||
Reference in New Issue
Block a user