This commit is contained in:
julien 2025-05-06 11:43:48 +02:00
parent b22fc85f2f
commit 2a59c059fc

View File

@ -81,6 +81,35 @@ app.post('/sendText', async (req, res) => {
res.status(500).json({ error: error.message || 'Erreur interne' });
}
});
// ✅ API POST : envoie un menu interactif (liste)
app.post('/sendListMenu', async (req, res) => {
const { phone, title, subtitle, description, buttonText, sections } = req.body;
console.log('📥 Requête LIST MENU :');
console.log('Phone:', phone);
console.log('Title:', title);
console.log('Subtitle:', subtitle);
console.log('Description:', description);
console.log('ButtonText:', buttonText);
console.log('Sections:', sections);
if (!client) return res.status(500).json({ error: 'Client WhatsApp non initialisé' });
try {
await client.sendListMenu(
`${phone}@c.us`,
title,
subtitle,
description,
buttonText,
sections
);
res.json({ success: true });
} catch (error) {
console.error('❌ Erreur sendListMenu:', error);
res.status(500).json({ error: error.message || 'Erreur interne' });
}
});