Is it possible to view the contents of the last messageTelegram sent

I am trying to future-proof / idiot-proof a few of my notifications.

For example, I can tell our google home mini “Hey, I’m gonna go mow”. And it will send a telegram message to everyone in the family, saying “Someone is going to mow, would you like to turn off the camera notifications for 1 hour?”. With the included Yes or No, in inline keyboard commands. When they choose yes/no, it will go ahead and remove the options.

What I am trying to accomplish is if X amount of time passes and no option is selected, then to automatically remove the commands from that message. So that way, there won’t be a lingering command to press 3 hours later, when there is no longer a reason to turn off camera notifications, and avoid any problems that might cause.

I know that if you’re editing a message using the service telegram_bot.edit_message you can call {"message_id:" "last"} to go to the last message for that chat_id. But that won’t work. Because many more notifications could come between now and then. (“Front door, Opened!”, “Someone opened the mail box”, etc). And I want to be sure that I’m editing the correct message, when the time comes.

So my question is: Is there a way to view the information of the last message that Telegram sent out to a chat_id? That isn’t relying on user input, like telegram_callback.

The ideal flow would be something like this (I am using Node-Red):

  1. Send original Notification
  2. View and store contents of message that was just sent, to X person
  3. Delay 30 minutes
  4. Using the stored information, see if the inline commands were already cleared or not (Aka, if someone chose an option)
  5. If not cleared yet, automatically clear them.

So I just need to know how to accomplish #2, or if it’s even possible at all.

For something like Mowing the lawn and temporarily disabling notifications might be overkill and trivial. But when applied to other examples, like “House alarm has been set, Disarm?”, or “Its < 60 in your house, turn on heater?”, it bears a bit more weight.

Thanks in advanced for taking the time to read this long post, and trying to help out.

Another possibility would be to just store the message_id when the original message is being sent. But I don’t think that is possible with the way the Telegram Bot is currently set up.

Any help would be greatly appreciated.