ddd
This commit is contained in:
parent
b3831dd726
commit
6152e927bf
8
index.js
8
index.js
@ -58,12 +58,14 @@ app.post('/sendText', async (req, res) => {
|
||||
|
||||
// --- API ENVOI BOUTONS ---
|
||||
app.post('/sendButtons', async (req, res) => {
|
||||
const { phone, title, message, buttons } = req.body;
|
||||
const { phone, body, buttons, title, footer } = req.body;
|
||||
|
||||
try {
|
||||
const formatted = new Buttons(message, buttons.map(b => b.text), title, '');
|
||||
await client.sendMessage(`${phone}@c.us`, formatted);
|
||||
const btn = new Buttons(body, buttons, title || '', footer || '');
|
||||
await client.sendMessage(`${phone}@c.us`, btn);
|
||||
res.json({ success: true });
|
||||
} catch (e) {
|
||||
console.error('❌ Erreur sendButtons:', e);
|
||||
res.status(500).json({ error: e.message });
|
||||
}
|
||||
});
|
||||
|
||||
Loading…
Reference in New Issue
Block a user