我目前正在尝试通过 Twilio 将多张图片发送到 WhatsApp,并使其能够与其中一张图片配合使用。 已经阅读了其他问题,这个问题可能很简单。
如何在一条消息中发送多个图像?
这是我目前所拥有的和我尝试过的,但第二张图像从未发送:
exports.handler = function(context, event, callback) {
var client = context.getTwilioClient();
console.log("Sende Antwort")
client.messages.create({
to: event.From,
from: event.To,
body: "Sekunde, mache dir eben deinen Stoff klar."
}, function(err, res){
console.log("Sende Katzenbilder")
let twiml = new Twilio.twiml.MessagingResponse();
let message = twiml.message();
message.body("Hier ist dein wöchentlicher Cat-Content!")
message.media("https://images.unsplash.com/photo-1566927467984-6332be7377d0?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=1350&q=80");
message.media("https://images.unsplash.com/photo-1548247416-ec66f4900b2e?ixlib=rb-1.2.1&ixid=eyJhcHBfaWQiOjEyMDd9&auto=format&fit=crop&w=663&q=80")
callback(null, twiml)
})
};
最佳答案
这是不可能通过底层 API 实现的
发送媒体消息
https://developers.facebook.com/docs/whatsapp/api/messages/media
The above sample shows multiple different objects such as audio, document, image, sticker, and video for illustration purposes only. A valid request body contains only one of them.
关于image - Twilio 向 WhatsApp 发送多张图像,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/60777778/