So basically, I created a Telegram bot to add data sent from Telegram to a spreadsheet. I created a few bots, and all of them work fine with almost identical scripts. These bots send data in private messages to the bot, which then stores all the data in a spreadsheet.
Now, I am trying to create a similar bot, but in this case, the users will send data from a group, not privately. The problem I am facing is with the webhook. I use the same webhook function:
function setWebhook() {
var url = telegramUrl + "/setWebhook?url=" + urlPublish;
var response = UrlFetchApp.fetch(url);
Logger.log("Webhook Response: " + response.getContentText());
}
In private, it works perfectly. However, in a group, after 30-40 minutes, the bot stops responding. When I check the webhook info using:
https://api.telegram.org/botTOKENHERE/getWebhookInfoI find the problem. Initially, after running the script, the response looks like this:
{
"ok": true,
"result": {
"url": "
https://script.google.com/macros/s/XXXXXXXX/exec",
"has_custom_certificate": false,
"pending_update_count": 0,
"max_connections": 40,
"ip_address": "216.58.206.46"
}
}
But after 30-40 minutes, the URL value changes to:
{
"ok": true,
"result": {
"url": "
https://technical-webhook.fun:8443/webhook/XXXXX",
"has_custom_certificate": false,
"pending_update_count": 0,
"max_connections": 40,
"ip_address": "188.114.96.3"
}
}
Can someone please help me understand what is happening?