I have a simple PHP script (using Botman) called by my Telegram bot via a webhook. It's supposed to respond on receiving a keyword. This works, sending response messages to my phone.
Randomly however it repeats the messages, without any input. Though random, its so frequent I would estimate it does this at least 10 times per minute.
Thinking this could be due to some web bots calling my URL, I modified the script to check the presence (and value of) and query parameter and all random messages stopped. The web bots wouldn't know this secret parameter, right?
As expected, once I updated the PHP script (without updating Telegram with the modified webhook), the messages stopped. So far so good.
Next, updated the Telegram with the webhook containing the secret query parameter, then waited 5 minutes. No messages: still looking good.
Alas, once I send my keyword, it gives the expected response but then keeps repeating endlessly again.
Where do I look to fix this?
Ps. To test, the script also returns general info of the user. I can see it keeps returning my info in the repeated message, as if I made each request. Could this be a bug with Telegram?
According to your description, it seems that your webhook architecture it still looking for the most recent updates returned by Telegram getUpdates method: if your script repeats answering to the same exact message, it means that it's receiving the same exact update object more than one time.
A good solution to solve this problem could be have a look at the webhook working of, how it communicates with Telegram servers in order to understand how does it handle updates received from the Telegram Chatbot itself.