diff --git a/app-customer.js b/app-customer.js index b20b081..ef9eb77 100644 --- a/app-customer.js +++ b/app-customer.js @@ -1731,18 +1731,10 @@ app.post('/api/webhook/gowa', async (req, res) => { .run(senderPhone, 'gowa_bot', custId, custName, text, 'received', String(p.id || '')); } catch (e) {} - const reply = async (msg) => { - try { - await require('./services/gowaWhatsappService').sendGowaMessage(senderPhone, msg); - try { - 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 || '' }); + // ── WA = HANYA NOTIFIKASI (keluar) ───────────────────────────────── + // Interaksi/balasan bot DIPINDAH ke Telegram. Pesan masuk tetap dicatat + // (di atas) agar terlihat di Live Chat, TANPA balasan otomatis. + return; } catch (e) { logger.error('[GOWA webhook] proses error: ' + e.message); } }, 0); return; diff --git a/services/whatsappBot.mjs b/services/whatsappBot.mjs index 27bffc6..4327747 100644 --- a/services/whatsappBot.mjs +++ b/services/whatsappBot.mjs @@ -2611,6 +2611,9 @@ export async function startWhatsAppBot() { }); 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; for (const m of messages) { try {