Problem after updating Telegram bot

Hello,
I updated telegram bot to10.0.4 and now I am not able to send pictures anymore with the sender object.
Before the update it was working by reading a file from absolute path with filein block in single buffer mode then with a function block setting the properties of the telegram sender with:

msg.payload.chatId = msg.originalMessage.chat.id;
msg.payload.type = "photo";
msg.payload.content = msg.payload; <-- this coming from FILEIN block

Now I get error ETELEGRAM: 400 Bad Request: message to copy not found when processing message.

Based on the documentation the type "photo" needs a value
msg.payload.content = photo[index].file_id
but I don't understand what should I set nor what is the array photo[index].

Before I was passing the BLOB object from FILEIN but now this method seems no more available.

Hope the problem is clear.

Thank you.

I'd be surprised if that ever worked since the payload from the file node will be a buffer.

Try changing the logic around a bit to ensure payload is a regular object...

let filedata = msg.payload;
msg.payload = {};//create new empty object
msg.payload.chatId = msg.originalMessage.chat.id;
msg.payload.type = "photo";
msg.payload.content = filedata;

(Untested, written on phone)

Hi Steve-Mcl,
I tested your code and it works.
Believe me before upgrading it was working passing directly the buffer from FILEIN as single object buffer. I don't know what telegram version was installed before.

Now the telegram sender sent me the picture and gave me 4 messages about "Failure (Bad values)" on the second output as errors but I received the picture on my chat.
I don't know how to make further tests but it works again.

Thank you

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