sddsdsdsds
This commit is contained in:
parent
08476f4b45
commit
fcbfef91a2
86
index.js
86
index.js
@ -458,41 +458,25 @@ app.post('/sendProductMessage', async (req, res) => {
|
||||
jid,
|
||||
{
|
||||
product: {
|
||||
productImage: { url: "https://wa.canguidev.fr/static/logo-merlo-cs-FR.jpg"},
|
||||
productImageCount: 1,
|
||||
title: "Title Product",
|
||||
description: "Description Product",
|
||||
priceAmount1000: 20000 * 1000,
|
||||
currencyCode: "IDR",
|
||||
retailerId: "Retail",
|
||||
url: "https://example.com",
|
||||
productImage: { url: productImageUrl },
|
||||
productImageCount,
|
||||
title: productTitle,
|
||||
description: productDescription,
|
||||
priceAmount1000,
|
||||
currencyCode,
|
||||
retailerId,
|
||||
url: productUrl,
|
||||
},
|
||||
businessOwnerJid: "33617452235@s.whatsapp.net",
|
||||
caption: "Description Of Messages", //Additional information
|
||||
title: "Title Of Messages",
|
||||
footer: "Footer Messages",
|
||||
businessOwnerJid,
|
||||
caption,
|
||||
title: messageTitle,
|
||||
footer,
|
||||
media: true,
|
||||
interactiveButtons: [
|
||||
{
|
||||
name: "quick_reply",
|
||||
buttonParamsJson: JSON.stringify({
|
||||
display_text: "Display Button",
|
||||
id: "ID"
|
||||
})
|
||||
interactiveButtons
|
||||
},
|
||||
{
|
||||
name: "cta_url",
|
||||
buttonParamsJson: JSON.stringify({
|
||||
display_text: "Display Button",
|
||||
url: "https://www.example.com"
|
||||
})
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
quoted : message
|
||||
}
|
||||
)
|
||||
quoted ? { quoted } : {}
|
||||
);
|
||||
|
||||
|
||||
return res.json({ success: true });
|
||||
} catch (e) {
|
||||
@ -602,6 +586,44 @@ app.post('/testHeaderImage', async (req, res) => {
|
||||
}
|
||||
});
|
||||
|
||||
const express = require('express');
|
||||
const app = express();
|
||||
app.use(express.json());
|
||||
|
||||
app.post('/sendImageWithBaileysPro', async (req, res) => {
|
||||
if (!sock || !isConnected) {
|
||||
return res.status(400).json({ error: 'Non connecté à WhatsApp' });
|
||||
}
|
||||
|
||||
const {
|
||||
phone, // ex: "33612345678"
|
||||
imageUrl, // ex: "https://example.com/image.jpg"
|
||||
caption, // ex: "Voici une image !"
|
||||
quoted // optionnel : message auquel répondre
|
||||
} = req.body;
|
||||
|
||||
if (!phone || !imageUrl) {
|
||||
return res.status(400).json({ error: 'Paramètres requis manquants (phone, imageUrl)' });
|
||||
}
|
||||
|
||||
const jid = `${phone}@s.whatsapp.net`;
|
||||
|
||||
try {
|
||||
await sock.sendMessage(
|
||||
jid,
|
||||
{
|
||||
image: { url: imageUrl },
|
||||
caption: caption || '',
|
||||
},
|
||||
quoted ? { quoted } : {}
|
||||
);
|
||||
|
||||
res.json({ success: true, to: jid });
|
||||
} catch (e) {
|
||||
console.error('❌ Erreur /sendImageWithBaileysPro :', e);
|
||||
res.status(500).json({ error: e.message });
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user