sfdesdfez
This commit is contained in:
parent
d687a2c127
commit
fd2062fb04
10
index.js
10
index.js
@ -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',
|
||||||
},
|
},
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user