d
This commit is contained in:
parent
b22fc85f2f
commit
2a59c059fc
29
index.js
29
index.js
@ -81,6 +81,35 @@ app.post('/sendText', async (req, res) => {
|
|||||||
res.status(500).json({ error: error.message || 'Erreur interne' });
|
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' });
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user