diff --git a/index.js b/index.js index 6b27ffc..0607366 100644 --- a/index.js +++ b/index.js @@ -101,6 +101,80 @@ app.post('/sendText', async (req, res) => { res.status(500).json({ error: e.message }); } }); +app.post('/testButtons', 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 Wolrd !;", + footer: "© Fizzxy Dev", + buttons: [ + { + buttonId: '.tes', + buttonText: { + displayText: 'TESTING BOT' + }, + type: 1 + }, + { + buttonId: ' ', + buttonText: { + displayText: 'PRIVATE SCRIPT' + }, + type: 1 + }, + { + buttonId: 'action', + buttonText: { + displayText: 'ini pesan interactiveMeta' + }, + type: 4, + nativeFlowInfo: { + name: 'single_select', + paramsJson: JSON.stringify({ + title: 'message', + sections: [ + { + title: 'FizzxyDev - 2025', + highlight_label: '😜', + rows: [ + { + header: 'HEADER', + title: 'TITLE', + description: 'DESCRIPTION', + id: 'YOUR ID 1' + }, + { + header: 'HEADER', + title: 'TITLE', + description: 'DESCRIPTION', + id: 'YOUR ID 2' + } + ] + } + ] + }) + } + } + ], + headerType: 1, + viewOnce: true + }, { + quoted: null // ou tu peux injecter un msg pour reply ici + }); + + res.json({ success: true }); + } catch (e) { + console.error('❌ Erreur testButtons :', e); + res.status(500).json({ error: e.message }); + } +}); app.post('/sendButtons', async (req, res) => { const { phone } = req.body;