sfdesdfez

This commit is contained in:
julien 2025-05-06 16:13:06 +02:00
parent d687a2c127
commit fd2062fb04

View File

@ -128,13 +128,19 @@ app.post('/sendInteractiveImage', async (req, res) => {
const imagePath = path.join(__dirname, 'public', 'logo-merlo-cs-FR.jpg'); const imagePath = path.join(__dirname, 'public', 'logo-merlo-cs-FR.jpg');
const imageBuffer = fs.readFileSync(imagePath); const imageBuffer = fs.readFileSync(imagePath);
// Configuration du message interactif // Préparation du média avec upload sécurisé
const uploadedMedia = await sock.uploadMedia(imageBuffer, {
mimetype: 'image/jpeg',
filename: 'merlo-image.jpg'
});
// Construction du message interactif
const message = { const message = {
interactive: { interactive: {
type: 'button', type: 'button',
header: { header: {
type: 'IMAGE', type: 'IMAGE',
image: imageBuffer, image: { url: uploadedMedia },
title: title || 'Titre par défaut', title: title || 'Titre par défaut',
subtitle: subtitle || 'Sous-titre', subtitle: subtitle || 'Sous-titre',
}, },