feat: WA jadi notifikasi saja (matikan interaksi/bot); interaksi pindah ke Telegram

This commit is contained in:
oxpoe committed 2026-10-09 09:10:53 +07:00
1 parent b65eb3195c
commit 7d54817b0c
2 files changed
+7 -12

No files matched your search

+4 -12
View File
@@ -1731,18 +1731,10 @@ app.post('/api/webhook/gowa', async (req, res) => {
.run(senderPhone, 'gowa_bot', custId, custName, text, 'received', String(p.id || '')); .run(senderPhone, 'gowa_bot', custId, custName, text, 'received', String(p.id || ''));
} catch (e) {} } catch (e) {}
const reply = async (msg) => { // ── WA = HANYA NOTIFIKASI (keluar) ─────────────────────────────────
try { // Interaksi/balasan bot DIPINDAH ke Telegram. Pesan masuk tetap dicatat
await require('./services/gowaWhatsappService').sendGowaMessage(senderPhone, msg); // (di atas) agar terlihat di Live Chat, TANPA balasan otomatis.
try { return;
const db2 = require('./config/database');
db2.prepare("INSERT INTO wa_chat_messages (direction, gateway, sender_phone, recipient_phone, customer_name, message_text, status) VALUES ('outbound','gowa',?,?,?,?,?)")
.run('gowa_bot', senderPhone, null, msg, 'sent');
} catch (e2) {}
} catch (e) { logger.error('[GOWA webhook] gagal balas: ' + e.message); }
};
const waBot = await import('./services/whatsappBot.mjs');
await waBot.processIncomingCommand({ senderPhone: senderPhone, text: text, reply: reply, senderName: p.from_name || p.sender_display_name || '' });
} catch (e) { logger.error('[GOWA webhook] proses error: ' + e.message); } } catch (e) { logger.error('[GOWA webhook] proses error: ' + e.message); }
}, 0); }, 0);
return; return;
+3
View File
@@ -2611,6 +2611,9 @@ export async function startWhatsAppBot() {
}); });
sock.ev.on('messages.upsert', async ({ messages, type }) => { sock.ev.on('messages.upsert', async ({ messages, type }) => {
// WA interaksi (perintah masuk) DINONAKTIFKAN — WA hanya untuk notifikasi keluar.
// Interaksi cepat kini di Telegram. (Fungsi kirim tetap aktif.)
return;
if (type !== 'notify') return; if (type !== 'notify') return;
for (const m of messages) { for (const m of messages) {
try { try {