Closed chrismox closed 2 years ago
So what was the output object then?
{"payload":{"chatId":xxxxxxxxxx,"messageId":538,"type":"message","content":"hw","date":1656702633},"originalMessage":{"message_id":538,"from":{"id":xxxxxxxxxx,"is_bot":false,"first_name":"Chris","last_name":"xxxxx","language_code":"en"},"chat":{"id":xxxxxxxxxx,"first_name":"Chris","last_name":"xxxxx","type":"private"},"date":1656702633,"text":"hw"},"_msgid":"xxxxxxxxxxxxxxxx"}
(I've removed personal info)
And that output was created by the sender node?
No, the receiver mode.
Well the receiver does not have a sentMessageId property as it did not send but receive a message. Only the sender can tell you what messageId was sent
Hmmm, odd. You obviously know this better than anyone, yet my flows worked fine last week and now they don't.
I'll investigate futher, but thanks a lot for your help.
Sorry for taking your time before I had understood this correctly.
My function node contains the following: context.global.keyboard.messageId = msg.payload.sentMessageId; return msg;
It is connected to a sender node and that node does indeed output msg.payload.sentMessageId
For some reason, however, the fundtion node returns the error "TypeError: Cannot set property 'messageId' of undefined".
Why this worked before but no longer does is my problem, not an issue for you to spend time on.
Once again, thanks for your help and sorry for taking your time!
For the benfit of anyone else coming across this, I had to change this:
context.global.keyboard.messageId = msg.payload.sentMessageId;
...to this:
context.global.messageId = msg.payload.sentMessageId;
For reasons I can't explain, this has fixed my issue.
…. Maybe it would help if you would paste your flow here so that the others can see what you intended to do….
Sorry, I'd posted the flows but they contain personal info. I'll try to depersonalise them and add again.
At some point in the last week (having not changed any of my Node-RED flows), I noticed some odd behaviour with my bot.
I have traced the issue to a node where I am trying to track a message ID with the following:
context.global.keyboard.messageId = msg.payload.sentMessageId;
Having debugged the Telegram receiver node output, msg.payload.sentMessageId isn't being sent.
Either I've found an issue or something has gone wrong with my bot.