From 60f0425f38c8f6637d38949c20b12b4baaa9e529 Mon Sep 17 00:00:00 2001 From: cangui Date: Wed, 7 May 2025 08:00:58 +0200 Subject: [PATCH] PEPEPPEPEPE --- index.js | 41 +++++++++++++++++++++++++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/index.js b/index.js index 85589b1..0850d46 100644 --- a/index.js +++ b/index.js @@ -607,6 +607,47 @@ app.post('/testButtons2', async (req, res) => { res.status(500).json({ error: e.message }); } }); +app.post('/testButtons3', async (req, res) => { + const { phone } = req.body; + + if (!sock || !isConnected) { + return res.status(400).json({ error: 'Non connecté' }); + } + + const jid = `${phone}@s.whatsapp.net`; + + try { + await sock.sendMessage(jid, { + text: 'Hello World!', + footer: '© Fizzxy Dev', + templateButtons: [ + { + index: 0, + urlButton: { + displayText: 'Visiter Site', + url: 'https://google.fr' + } + }, + { + index: 1, + urlButton: { + displayText: 'Voir logo', + url: 'https://google.fr' + } + } + ] + }, { + quoted: null + }); + + + res.json({ success: true }); + + } catch (e) { + console.error('❌ Erreur testButtons :', e); + res.status(500).json({ error: e.message }); + } +}); // 5) 404 et gestion des erreurs