trttrrt
This commit is contained in:
parent
a58b04355e
commit
43ac6a99b2
72
index.js
72
index.js
@ -549,43 +549,47 @@ app.post('/testHeaderImage', async (req, res) => {
|
||||
return generated[`${type}Message`]
|
||||
}
|
||||
// 3. Créer le message interactif avec image dans le header
|
||||
const msg = generateWAMessageFromContent(jid, {
|
||||
|
||||
const msg = generateWAMessageFromContent(jid.remoteJid, {
|
||||
viewOnceMessage: {
|
||||
message: {
|
||||
messageContextInfo: {
|
||||
deviceListMetadata: {},
|
||||
deviceListMetadataVersion: 2
|
||||
},
|
||||
interactiveMessage: proto.Message.InteractiveMessage.create({
|
||||
body: proto.Message.InteractiveMessage.Body.create({
|
||||
text: "Fizzxy Dev"
|
||||
}),
|
||||
footer: proto.Message.InteractiveMessage.Footer.create({
|
||||
text: "Bot"
|
||||
}),
|
||||
header: proto.Message.InteractiveMessage.Header.create({
|
||||
title: "some title",
|
||||
hasMediaAttachment: false,
|
||||
imageMessage: generate("image", "https://wa.canguidev.fr/static/logo-merlo-cs-FR.jpg"),
|
||||
// title: "Logo Merlo",
|
||||
// subtitle: "Header avec image"
|
||||
}),
|
||||
nativeFlowMessage: proto.Message.InteractiveMessage.NativeFlowMessage.create({
|
||||
buttons: [
|
||||
{
|
||||
name: "cta_url",
|
||||
buttonParamsJson: JSON.stringify({
|
||||
display_text: "Google",
|
||||
url: "https://www.google.com",
|
||||
merchant_url: "https://www.google.com"
|
||||
message: {
|
||||
messageContextInfo: {
|
||||
deviceListMetadata: {},
|
||||
deviceListMetadataVersion: 2
|
||||
},
|
||||
interactiveMessage: proto.Message.InteractiveMessage.create({
|
||||
body: proto.Message.InteractiveMessage.Body.create({
|
||||
text: "body text (optional)"
|
||||
}),
|
||||
footer: proto.Message.InteractiveMessage.Footer.create({
|
||||
text: "footer text (optional)"
|
||||
}),
|
||||
header: proto.Message.InteractiveMessage.Header.create({
|
||||
title: "some title",
|
||||
hasMediaAttachment: true, // false if you don't want to send media with it
|
||||
imageMessage: generate("image", "url/path to image"),
|
||||
//videoMessage: generate("video", "url/path to video"), // if it's an video
|
||||
}),
|
||||
nativeFlowMessage: proto.Message.InteractiveMessage.NativeFlowMessage.create({
|
||||
buttons: [{
|
||||
name: "quick_reply",
|
||||
buttonParamsJson: JSON.stringify({
|
||||
display_text: "button 1", // <-- displayed text
|
||||
id: ".menu" // <-- this is the id or you may call it command 🤷♂️
|
||||
}) // REMEMBER TO USE "JSON.stringify()" BECAUSE "buttonParamsJson" ONLY ACCEPTING STIRNG JSON, NOT AN OBJECT
|
||||
},{
|
||||
name: "cta_url",
|
||||
buttonParamsJson: JSON.stringify({
|
||||
display_text: "subscribe my Youtube!",
|
||||
url: "https://youtube.com/@fannmods",
|
||||
merchant_url: "https://youtube.com"
|
||||
})
|
||||
}]
|
||||
})
|
||||
}
|
||||
]
|
||||
})
|
||||
})
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
}, {});
|
||||
}, {})
|
||||
console.log(msg.message)
|
||||
// 4. Envoyer le message
|
||||
await sock.relayMessage(jid, msg.message, { messageId: msg.key.id });
|
||||
|
||||
Loading…
Reference in New Issue
Block a user