Telegram bot and the method getUpdates - telegram-bot

I have a question about Telegram bot, I created a bot some weeks ago, it works fine but there is a strange behavior with the method getUpdates; indeed if I use the link:
https://api.telegram.org/bot<token>/getUpdates
now I can't see any message, but if I start a new bot this link works fine like the first day when I created the other bot.
There is a particular interval of time after which this link stops working?
There is a way to re-enable it?
Thanks in advance

From Telegram Bot API documentations:
Incoming updates are stored on the server until the bot receives them
... but they will not be kept longer than 24 hours.
So, getUpdates did not stop working. Old messages got deleted after a finite amount of time.

Use #BOtFather And /revoke command to Get New Token for your bot.

I had an issue with my bot API were it mysteriously crashes. I found it was due to it returning this HTML page instead of a JSON string very rarely. Even though the getUpdates interval was a fair 3 seconds. I've patched an update not long ago.
<html>
<head><title>502 Bad Gateway</title></head>
<body bgcolor="white">
<center><h1>502 Bad Gateway</h1></center>
<hr><center>nginx/1.10.1</center>
</body>
</html>
The only time the bot token becomes useless is when it's been manually /revoke on BotFather on the target bot.
If you still having issues. You could try my TelegramBot class that uses the getUpdates method that should be easy to use. I have no issues running my bot on Android and Windows 10 Node.js servers. https://github.com/NightfallAlicorn/telegrambot-nodejs-getupdates Be aware it's not 100% complete but it's stable and has all functionalities except inline bot stuff.

It can happen if someone get updates already. Maybe your bot is running somewhere. I also had this problem when the bot was not running for me, but something still received these updates. I think it will help you to get a new access token via /revoke in #BotFather, after that everything work good in my case.

Related

Telegram bot: uploading new features without rebooting bot

I have telegram bot written in Python with lot's of users. The question is: when I do some changes (for example adding new inline buttons to bot) all users need to reset it or to use '/start' command. How to make this process hidden, not to ask all users do it? Maybe there is a variant, when bot restarts itself by schedule? Every suggestion will be really valuable for me....

APISubscriptionError 400 Unable to reach callback URL

I found a lot of posts about this issue, but none is like mine.
I have a website that subscribes to IG real-time updates. Since some time ago trying to subscribe to new notifications returns the above error. Seems like IG can't reach the callback_url.
Interesting findings while troubleshooting:
I tried to manually (directly) access the callback_url and it works flawlessly.
When I run the site on my local machine and make sure the callback_url is to my server + the verify_token is a valid one then it all works as it should! IG reaches the callback_url.
I used the apigee console to make the subscription request and there it sometimes works.. Meaning - I craft the request to IG API and click Send. If it fails then I click again (I don't change parameters) and then it works..
Web server logs are in line with the results I get (when it complains it can't reach then there's no log of a request).
Does anyone have any tip or suggestion how to fix this?
Thanks!
While chasing my own tail for a solution I also contacted IG support. I described the issue using same description as above.
After 2 weeks suddenly everything started working again. Magic! Suddenly no errors at all! Needless to say nothing has changed on my end (hardware / network / code).
I didn't receive any response from their support, but considering that a previous email to them a few months ago took about 2 weeks to answer then I am quite sure some support guy simply fixed the issue on their side and didn't even bother to let me know what was going on.
This could be related to the fact that they killed most of their real time notifications API.
Anyway, leaving this here so that if anyone encounters a similar issue then just know you may need to email IG support.

GCM does not send message to notification_key & returns with an empty response body

We're using notification_key to group multiple devices. Since yesterday we're unable to send a message to a notification_key. The GCM endpoint returns with status 200 but the response body is empty. The GCM diagnostics inside Google Play shows that no message has been sent to the device and we additionally checked that the message does not arrive at the device.
However, sending a message to a single registration_id (one of which is managed by notification_key) works as expected.
We haven't touched the GCM related code on our side and it was working as expected the days before. I would like to know if this error is known and if other apps are affected as well. Also happy to hear from Google if they were any changes in the last few days.
The issue has been resolved by Google. This is the answer I got from the Google Group thread I've created for this issue:
Hi Andreas,
We had a recent issue in the send API, affecting a subset of the
notification_key requests. That issue should be fixed now.
Please try again. If the API is still not working for you please
report back using:
https://support.google.com/code/contact/gcm_dev_support
Thanks,
- Diego

Creating Chat function in iOS - Through continuous request

I was tasked to create a Chat function for our app in iOS. I found this tutorial which creates a Chat app from scratch.
http://www.ibm.com/developerworks/library/x-ioschat/index.html
The link above is very helpful, but there is a small problem. In the app, a request will be made every 5 seconds to look for new responses. One of my colleagues said that it is not advisable to make a request to the server every now and then.
So I decided to look for other alternatives. I learned about long-polling through this link.
From what I understood, once a request was made the server will "hold" the request until something interesting comes up. Does this mean that once a response was thrown to the user, the request ends? If that's true, this means that a request will be made every now and then as well, right?
If that's the case, can anyone tell me what's the best way to implement a chat function in iOS?
My friend showed me a AJAX JavaScript code (I just found out that he also used a plug-in, which I am not familiar with) where a single continuous request was made, and this request doesn't end even if a response was already thrown to the user. Is there a way to do this in iOS?
It is not a good approach to make http ajax request to send and receive chat. A chat response should be displayed at the moment when the other user press "Send". We cant ask for the users to wait 1 second to fetch if there any new responses.
You must use a chat server to accomplish this. I hope the following url would be helpful. I just wanted to give you the Idea of using a Chat Server.
http://wiki.remobjects.com/wiki/SuperHTTP_Chat_(iOS)Sample(Xcode)

Do any Google Voice APIs still work?

I am interested in writing a simple CLI program that will send an SMS using Google Voice.
There are several scripts and an API or two available, but I have run into an issue that none of them seem to work any longer; as they mostly rely on parsing returned web pages.
Is anyone familiar with a current API that works so that I can send an SMS on Google Voice?
Thanks!
Looks like Google Voice changed the login procedure, and it now expects you to pass back a cookie. This issue for the Python wrapper sums it up: http://code.google.com/p/pygooglevoice/issues/detail?id=60
UPDATE AND FIX: Actually all that needs to happen is to change the login URL in your code:
Old URL - https://www.google.com/accounts/ServiceLoginAuth?service=grandcentral
New URL - https://accounts.google.com/ServiceLogin?service=grandcentral