This commit is contained in:
cangui 2025-05-07 08:11:04 +02:00
parent 412e6b888c
commit 15e5852440

View File

@ -356,44 +356,44 @@ app.post('/sendInteractiveImage', async (req, res) => {
} }
}); });
// app.post('/sendInteractiveImage', async (req, res) => { app.post('/sendInteractiveImage2', async (req, res) => {
// const { phone, caption, title, subtitle, footer } = req.body; const { phone, caption, title, subtitle, footer } = req.body;
// if (!sock || !isConnected) return res.status(400).json({ error: 'Non connecté' }); if (!sock || !isConnected) return res.status(400).json({ error: 'Non connecté' });
// try { try {
// const imagePath = path.join(__dirname, 'public', 'logo-merlo-cs-FR.jpg'); const imagePath = path.join(__dirname, 'public', 'logo-merlo-cs-FR.jpg');
// const resizedBuffer = fs.readFileSync(imagePath); const resizedBuffer = fs.readFileSync(imagePath);
// await sock.sendMessage(`${phone}@s.whatsapp.net`, { await sock.sendMessage(`${phone}@s.whatsapp.net`, {
// image: resizedBuffer, image: resizedBuffer,
// caption: caption || 'Description par défaut', caption: caption || 'Description par défaut',
// title: title || 'Titre par défaut', title: title || 'Titre par défaut',
// subtitle: subtitle || 'Sous-titre', subtitle: subtitle || 'Sous-titre',
// footer: footer || 'Pied de page', footer: footer || 'Pied de page',
// media: true, media: true,
// interactiveButtons: [ interactiveButtons: [
// { {
// name: 'cta_url', name: 'cta_url',
// buttonParamsJson: JSON.stringify({ buttonParamsJson: JSON.stringify({
// display_text: 'Proposition', display_text: 'Proposition',
// url: 'https://merlo-ch.com/uploads/proposition/f_p_250505_0000136_00008_EB00001909.pdf' url: 'https://merlo-ch.com/uploads/proposition/f_p_250505_0000136_00008_EB00001909.pdf'
// }) })
// }, },
// { {
// name: 'cta_url', name: 'cta_url',
// buttonParamsJson: JSON.stringify({ buttonParamsJson: JSON.stringify({
// display_text: 'Spec machine', display_text: 'Spec machine',
// url: 'https://merlo-ch.com/uploads/proposition/d_p_250505_0000136_00008_EB00001909.pdf' url: 'https://merlo-ch.com/uploads/proposition/d_p_250505_0000136_00008_EB00001909.pdf'
// }) })
// } }
// ] ]
// }); });
// res.json({ success: true }); res.json({ success: true });
// } catch (e) { } catch (e) {
// console.error('❌ Erreur interactive image :', e); console.error('❌ Erreur interactive image :', e);
// res.status(500).json({ error: e.message }); res.status(500).json({ error: e.message });
// } }
// }); });
app.post('/sendProductMessage', async (req, res) => { app.post('/sendProductMessage', async (req, res) => {
// On vérifie sock et isConnected, pas client // On vérifie sock et isConnected, pas client
if (!sock || !isConnected) { if (!sock || !isConnected) {