skip to Main Content

I have successfully created a bot with and am able to fetch messages from a chat using the getupdates method (long polling).

The getUpdates method is only showing user posted messages (clientside). When I post messages directly using the sendmessage method (serverside) these messages do appear in the chat, but do not in the getUpdates log.

This page https://github.com/LibreLabUCM/teleg-api-bot/wiki/Getting-started-with-the-Telegram-Bot-API#getupdates
states it logs only when "An user messages your bot, either directly or in a group." and some other ways, but the sendMessage way is not mentioned.

I’ve read a bit on the setwebhook method (push) but am not sure this will fix my issue.

Is this possible?

3

Answers


  1. According to Bot FAQ, bots will not be able to see messages from other bots regardless of mode.

    Login or Signup to reply.
  2. The getUpdates method shows only updates from users, not from the bot itself. This means that when you fetch the new messages with the getUpdates method, the Telegram API will list only the messages sent by the users, not the messages sent by the bot via any method (e.g sendMessage, sendPhoto …).

    To get old messages you can store the entire update (or only the parts of the update you need) for each message (even those sent by the bot with the sendMessage method) in a file or in a database and when you need an old message you can simply fetch it form the database or the files.

    Login or Signup to reply.
  3. I managed to get the bot messages using two bots.
    One does the sendMessage method and the other one does the getUpdates method.

    @Giolacca9 answer inspired me to try this workaround and it works, "not from the bot itself" 🙂

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search