Telegram Bot API getUpdates() does not deliver updates after user have not interacted with the bot for a few days - telegram-bot

As a telegram bot api developer, I noticed a weird behaviour of the getUpdates() api method:
If the user have not interacted with the bot for a few days, then the next time it sends a message to the bot, the message does not get delivered via the long-poll.
The workaround is to "cleanup the chat" - then all of a sudden the messages get delivered again. But this workaround is ugly.
What can be the cause of this issue, and is there any "lighter" workaround that will not touch the chat history?

Related

Share telegram bot messages with another user

I have a telegram bot that I send messages to via Python. I would like another user to be able to see these messages as well. Can't seem to figure out how to do it, nor what to do?

How could the app send a message to the phone when certain mission fulfilled?

I can use FCM console to send messages to all users or certain users at a certain time.
Now I want the app send a message to specified users when their in-game energy is full. How to realize it with FCM? And can I know the messages' sends, opens, conversions?
Sending a message to a user can only be done from a trusted environment, such as the Firebase console, or a place where you can trust that the code running is yours (such as your development machine, a server that you control, or something like Cloud Functions/Cloud Run).
For examples of how to send a message by calling FCM's API, see the documentation on building send requests, and this sample use-case of notifying the user when something interesting happens using Cloud Functions.

Incoming webhook message appears from 'Unknown User' in mobile app, correct webhook name in web interface

I have an incoming webhook in a Google Chat room called 'Github Bot'. A Python script hits the webhook URL with a standard message POST payload.
The web interface at https://chat.google.com shows the correct name 'Github Bot' in any messages received to this webhook.
But the mobile Chat application shows those same messages as coming from 'Unknown User'.
Is there any way to make the mobile app use the webhook's name as the sender, same as the web interface does? E.G, is there some attribute I can send as part of the payload, or is this simply a bug/non-implementation on the mobile app and I can't do anything about it?
Thanks!
This seems to be a bug:
The webhook name and the Bot label are not shown properly on the iOS mobile app if an avatar is added to the webhook:
On Android, and on the web browser, the name and the Bot label are displayed correctly:
Reported in Issue Tracker:
I went ahead and reported this behavior in Google Issue Tracker:
Messages from incoming webhooks are not displayed properly on iOS
I'd suggest you to star this issue in order to keep track of this and to help prioritizing it.

How to check, that telegram bot is alive automatically?

I wrote a telegram bot, but it go frizes sometimes, and don't answer to the messages.
How to check the state of bot automaticaly (for exmaple from another server).
I think, that I need something like heartbeat check:
Send a message from non-webhook server.
Catch telegram response
If response not comes in reasonable time, bot is die.
But, I need telegram client on linux server to do it.
Do you have any ideas, how to check telegram bot state?
You need to find out why the bot freezes, the health check is not the answer to your problem. However If you really want to implement some kind of automated health check, you need to use Telegram CLI to send requests to your own bot in fixed intervals and check for incoming messages from that CLI user.
If you are experiencing problem with Telegram's webhook, try long pulling the updates using the getUpdates method. I know a few high traffic bots that use that method, Webhooks have a max amount of concurrent requests so if you just delay them for a few milliseconds, it will start accumulating delay.

GCM Notification arrives after 30seconds

I am using Google development sample codes to receive GCM notifications. I have spent nearly a week to find why I receive notifications after 25~30 seconds!!! did not find any answer.
I receive other apps' notifications (such as Viber, Line and WhatsApp) almost instantly!
It has the same slow behaviour in both emulator and my Samsung Galaxy S5.
I receive respond with message ID from Google GCM server instantly when I send a notifications so it means the problem is from Google GCM server to my app.
Any help would be much appreciated.