Proxying
This method is outdated. We recommend using MtProto or API instead, as they are more flexible and reliable.
The Telegram Bot API operates on two work schemes:
webhook: when a user writes to the bot, the Telegram server automatically sends a HTTPS request to your bot's address
getUpdates (long polling): your bot independently requests updates from the Telegram server

To make connecting to the platform simple and fast, we have developed a special proxy server that is installed between the Telegram server and your bot.

If your bot operates via Webhook
You can manually connect your bot (without entering a token), for this when adding a bot you need to select the appropriate item and follow the instructions. You will need to replace your webhook with ours.
If your bot operates via getUpdates
There are two ways to connect a bot working through the getUpdate method, via the API (see the section "Connecting a bot via the API") or by replacing the host with api.telegram.org .
Bots of this type independently request updates from Telegram using HTTPS requests using the getUpdate method. To connect the bot to analytics, you need to change the host api.telegram.org to the host that the system will give you when you connect.
After changing the host, our platform will proxy all requests to the host api.telegram.org and collect statistics for you. Not only getUpdate requests can be sent to this address, but also all other types of requests (sending messages, files, etc.). All requests are proxied to the Telegram servers unchanged.
How to change the host connection in the bot?
Changing the host api.telegram.org provided by the Telegram Bot API, most libraries have the ability to change this address.
If you have not found the instructions for your library or you have problems connecting, please contact our technical support or fill out the form at the end of this page.
Important. The examples use the address "https://tgrasp.co ", you can use this address only if the bot token was specified in your personal account. In other cases, use only the address that you received in your personal account at the stage of setting up the bot.
If you have set a token for the bot in your personal account, the system will give you the address "https://tgrasp.co " otherwise the address will be "https://{code} .tgrasp.co"
Connection instructions for specific libraries
Select the library you are using
Python
PHP
JavaScript
Go
Java
Possible errors
All errors related to the work of the bot fall into the bot errors section in the personal account.
409
Conflict: terminated by other getUpdates request; make sure that only one bot instance is running
The error occurs when the telegram servers record two simultaneous getUpdates requests. Make sure that you have only one data acquisition thread running
502
502 Bad Gateway
Make sure that you are sending the request with the correct structure. Sometimes problems occur on telegram servers and they may respond with this error.
404
404 Not Found
Make sure you are using the correct address for the connection. Compare it with the address provided by the system. The address tgrasp.co can only be used if a token has been provided.
If you are using tgrasp.co, ensure that the bot ID (the first part of the token) matches the one you provided in graspil. The current bot ID in graspil is displayed below the connection address field.
Last updated