This commit is contained in:
julien 2025-05-06 12:24:23 +02:00
parent 36a473fa14
commit e8e10a876e

View File

@ -60,6 +60,7 @@ app.post('/sendText', async (req, res) => {
const { phone, message } = req.body;
if (!sock || !isConnected) return res.status(400).json({ error: 'Non connecté' });
try {
await sock.sendMessage(`${phone}@s.whatsapp.net`, { text: message });
res.json({ success: true });
} catch (e) {
@ -76,6 +77,7 @@ app.post('/sendButtons', async (req, res) => {
buttons: buttons.map((b, i) => ({ buttonId: `btn_${i}`, buttonText: { displayText: b }, type: 1 })),
headerType: 1
};
console.log(btnMsg);
await sock.sendMessage(`${phone}@s.whatsapp.net`, btnMsg);
res.json({ success: true });
} catch (e) {