Help with generating a jpg from raw mqtt data and sending via telegam

I really hope someone can help me here as I'm stuck..(before I pull more hair out).

Got mqtt snapshot data coming in and I can preview the image with the view node.
But how do I render those raw data bytes to send as an image? I see the view node does this magically so you can preview the images, but this is the image I want to send along to my telegram. (From Frigate)
Many thanks!

You set the buffer as msg.payload.content

Here are 3 working examples...

1 Like

Thanks for the examples. Still struggling to convert that mqtt data to a buffer msg.payload.content somehow. Your flows are great but not quite there for me yet.

It is being fed by the mqtt snapshot data from frigate. How does the image preview node using just the payload show the image? What is the coding behind that?

Think I need to wait down late Saturday night with a cool beer after the family are in bed and spend some time on this.

This is the output if I try a function with the content payload and markdown.

image

Many thanks

Also just to add the output from the mqtt is buffer.
Does this shed some light on the issue I'm having?

image

Also if I use the direct output of the mqtt buffer through your function example

msg.payload = {
  content: msg.payload, //the image buffer
  caption: `There's someone at the door. `,
  type : 'photo',
  chatId: "xxxx"
}
msg.payload.options = { parse_mode : "Markdown" };

return msg;

the debug shows buffer content. If I understand correctly this should send the image?

image

Correct. However, there are more than one telegram contrib node.

Which one are you using?

1 Like

ah - using the other one to yours - telegrambot-home.
So you would suggest I use your version? Could this be the issue?

May cause a conflict with both connected - had this issue before but I'll give it a go..

Thanks

Thanks so much. Had a spare bot, used your version of telegram and voila!! Picture came through!!

Awesome, thanks again

2 Likes

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.