windkh / node-red-contrib-telegrambot

Telegram bot nodes for node-red.
Other
265 stars 118 forks source link

How to send multiple photo's in one message #204

Closed elvee77 closed 3 years ago

elvee77 commented 3 years ago

Hi,

I want to send a message with 5 photo's in that one message. Now I send 5 different messages with the same "payload.mediaGroupId" and with "payload.blob" set to true at practically the same time but I receive every picture as a separate message.

Is there any advice on how to send multiple photo's in one message?

Thx!

windkh commented 3 years ago

Have a look at the media group example

elvee77 commented 3 years ago

Aha! Thanks for the right direction. Sometimes one just searches forever but the answer is right in front of you 😁.

`// sendMediaGroup example: send between 2 and 10 media. // Note that type can also be video. // and the caption property is optional. // see https://core.telegram.org/bots/api#inputmediaphoto // see https://core.telegram.org/bots/api#inputmediavideo

msg.payload.type = "mediaGroup"; msg.payload.content = [ { type : "photo", media : "/pic/frame_1.jpg", caption : "Photo 1" }, { type : "photo", media : "/pic/frame_2.jpg", caption : "Photo 2" } ];

return msg; `