Не работает api telegram org

Доступ к api telegram без vpn

Хорошего дня! На debian есть bash скрипт, который по событию слал сообщение в Телегу через api telegram. Из-за блокировки РКН, теперь не работает. Вопроса два:

1. Как обойти блокировку апи телеги без использования VPS, VPN и не бояться сломать работающий сервер=)?

2. Какие средства уведомления о событиях на debian сервере можете еще посоветовать? Не почту и не смс. Все варианты интересны. Спасибо!

P.s. Можно варианты с использованием python, bash, lua, jabber

Как обойти блокировку апи телеги без использования VPS, VPN и не бояться сломать работающий сервер=)?

Перенести сервер вне юрисдикции РКН.

Электронную почту уже советовали? Попробуй, может, электронную почту?

Перенести не могу. Никаким образом.

Почта это классика. Последний мой вариант.

Как обойти блокировку апи телеги без использования VPS, VPN

не бояться сломать работающий сервер

Стоит пересмотреть архитектуру сервера, раз уж там «на соплях»

Источник

Не работает АПИ телеграмм

Добрый день.
Пытаюсь подключиться к телеграм через АПИ (NuGet пакет Telegram.Bot)
Делаю так (на C#):

string Key= «некий ключ»;
TelegramBotClient _Bot = new TelegramBotClient(Key); // инициализируем API
await _Bot.SetWebhookAsync(«»); // Обязательно! Убираем старую привязку к вебхуку для бота

_Bot.OnUpdate += (object su, UpdateEventArgs evu) =>
<
if (evu.Update.CallbackQuery != null || evu.Update.InlineQuery != null) return; // в этом блоке нам келлбэки и инлайны не нужны
var update = evu.Update;
var message = update.Message;
if (message == null) return;
if (message.Type == Telegram.Bot.Types.Enums.MessageType.Text)
<
//telegram_id = message.Chat.Id.ToString();
//if(confirm_uid)
listBox1.Items.Add(message.Text);
>
>;

// запускаем прием обновлений
_Bot.StartReceiving();

но на строке await _Bot.SetWebhookAsync(«»); выдает ошибку:

Telegram.Bot.Exceptions.ApiRequestException
HResult=0x80131500
Сообщение = Unauthorized
Источник = Telegram.Bot
Трассировка стека:
в Telegram.Bot.TelegramBotClient. d__55`1.Mov eNext()
в System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSucce ss(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccess AndDebuggerNotification(Task task)
в System.Runtime.CompilerServices.TaskAwaiter.GetResult()
в BotApp.Form1. d__1.MoveNext() в D:\Шуравин\ТелеграмБот\BotApp\BotApp\Form1.cs:строка 26

Подскажите, пожалуйста, что делаю не так? Раньше подобный код работал.

Источник

Бот telegram не может подключиться к https://api.telegram.org:443: (Java)

Здравствуйте! Возникла такая проблема при запуске бота в intelij idea ultimate программа выдает такое сообщение:»юн. 02, 2018 8:42:11 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to ->https://api.telegram.org:443: Network is unreachable: connect
июн. 02, 2018 8:42:11 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to ->https://api.telegram.org:443
июн. 02, 2018 8:42:32 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to ->https://api.telegram.org:443: Network is unreachable: connect
июн. 02, 2018 8:42:32 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to ->https://api.telegram.org:443
июн. 02, 2018 8:42:53 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: I/O exception (java.net.SocketException) caught when processing request to ->https://api.telegram.org:443: Network is unreachable: connect
июн. 02, 2018 8:42:53 ПП org.apache.http.impl.execchain.RetryExec execute
INFO: Retrying request to ->https://api.telegram.org:443
org.telegram.telegrambots.exceptions.TelegramApiRequestExcep tion: Error executing setWebook method
at org.telegram.telegrambots.bots.TelegramLongPollingBot.clearW ebhook(TelegramLongPollingBot.java:55)
at org.telegram.telegrambots.TelegramBotsApi.registerBot(Telegr amBotsApi.java:120)
at Hikky.SellerHelp.main(SellerHelp.java:31)
Caused by: java.net.SocketException: Network is unreachable: connect
at java.base/java.net.DualStackPlainSocketImpl.connect0(Native Method)
at java.base/java.net.DualStackPlainSocketImpl.socketConnect(DualStackPla inSocketImpl.java:79)
at java.base/java.net.AbstractPlainSocketImpl.doConnect(AbstractPlainSock etImpl.java:400)
at java.base/java.net.AbstractPlainSocketImpl.connectToAddress(AbstractPl ainSocketImpl.java:243)
at java.base/java.net.AbstractPlainSocketImpl.connect(AbstractPlainSocket Impl.java:225)
at java.base/java.net.PlainSocketImpl.connect(PlainSocketImpl.java:148)
at java.base/java.net.SocksSocketImpl.connect(SocksSocketImpl.java:402)
at java.base/java.net.Socket.connect(Socket.java:591)
at org.apache.http.conn.ssl.SSLConnectionSocketFactory.connectS ocket(SSLConnectionSocketFactory.java:339)
at org.apache.http.impl.conn.DefaultHttpClientConnectionOperato r.connect(DefaultHttpClientConnectionOperator.java:142)
at org.apache.http.impl.conn.PoolingHttpClientConnectionManager .connect(PoolingHttpClientConnectionManager.java:359)
at org.apache.http.impl.execchain.MainClientExec.establishRoute (MainClientExec.java:381)
at org.apache.http.impl.execchain.MainClientExec.execute(MainCl ientExec.java:237)
at org.apache.http.impl.execchain.ProtocolExec.execute(Protocol Exec.java:185)
at org.apache.http.impl.execchain.RetryExec.execute(RetryExec.j ava:89)
at org.apache.http.impl.execchain.RedirectExec.execute(Redirect Exec.java:111)
at org.apache.http.impl.client.InternalHttpClient.doExecute(Int ernalHttpClient.java:185)
at org.apache.http.impl.client.CloseableHttpClient.execute(Clos eableHttpClient.java:83)
at org.apache.http.impl.client.CloseableHttpClient.execute(Clos eableHttpClient.java:108)
at org.telegram.telegrambots.bots.TelegramLongPollingBot.clearW ebhook(TelegramLongPollingBot.java:43)
. 2 more».

Еще неделю назад бот прекрасно работал.

Помощь в написании контрольных, курсовых и дипломных работ здесь.

Telegram бот на Java
Подскажите, есть Telegram бот написанный на Java, использую официальное API, также же имеется БД с.

Подключение к аккаунту Telegram через JAVA API (не через бота!)
Пытаюсь написать простенький Java-клиент, который будет подключаться к личному Телеграм аккаунту.

Как обращаться к api.telegram.org с самого Mikrotik’a?
Хочу отправлять сообщения c Mikrotik в телеграмм через api telegram.

Бот Telegram
Доброго времени суток, уважаемые форумчане! Прошу помощи в элементарной для опытного программиста.

Источник

Bots: An introduction for developers

Bots are third-party applications that run inside Telegram. Users can interact with bots by sending them messages, commands and inline requests. You control your bots using HTTPS requests to our Bot API.

To name just a few things, you could use bots to:

Get customized notifications and news. A bot can act as a smart newspaper, sending you relevant content as soon as it’s published.

Accept payments from Telegram users. A bot can offer paid services or work as a virtual storefront. Read more »
Demo Shop Bot, Demo Store

Create custom tools. A bot may provide you with alerts, weather forecasts, translations, formatting or other services.
Markdown bot, Sticker bot, Vote bot, Like bot

Build single- and multiplayer games. A bot can offer rich HTML5 experiences, from simple arcades and puzzles to 3D-shooters and real-time strategy games.
GameBot, Gamee

Build social services. A bot could connect people looking for conversation partners based on common interests or proximity.

Do virtually anything else. Except for dishes — bots are terrible at doing the dishes.

At the core, Telegram Bots are special accounts that do not require an additional phone number to set up. Users can interact with bots in two ways:

  • Send messages and commands to bots by opening a chat with them or by adding them to groups.
  • Send requests directly from the input field by typing the bot’s @username and a query. This allows sending content from inline bots directly into any chat, group or channel.

Messages, commands and requests sent by users are passed to the software running on your servers. Our intermediary server handles all encryption and communication with the Telegram API for you. You communicate with this server via a simple HTTPS-interface that offers a simplified version of the Telegram API. We call that interface our Bot API.

A detailed description of the Bot API is available on this page »

There’s a… bot for that. Just talk to BotFather (described below) and follow a few simple steps. Once you’ve created a bot and received your authorization token, head down to the Bot API manual to see what you can teach your bot to do.

You may also like to check out some code examples here »

  • Bots have no online status and no last seen timestamps, the interface shows the label ‘bot’ instead.
  • Bots have limited cloud storage — older messages may be removed by the server shortly after they have been processed.
  • Bots can’t initiate conversations with users. A user must either add them to a group or send them a message first. People can use t.me/ links or username search to find your bot.
  • Bot usernames always end in ‘bot’ (e.g. @TriviaBot, @GitHub_bot).
  • When added to a group, bots do not receive all messages by default (see Privacy mode).
  • Bots never eat, sleep or complain (unless expressly programmed otherwise).

Telegram bots are unique in many ways — we offer two kinds of keyboards, additional interfaces for default commands and deep linking as well as text formatting, integrated payments and more.

Users can interact with your bot via inline queries straight from the text input field in any chat. All they need to do is start a message with your bot’s username and then type a query.

Having received the query, your bot can return some results. As soon as the user taps one of them, it is sent to the user’s currently opened chat. This way, people can request content from your bot in any of their chats, groups or channels.

Check out this blog to see a sample inline bot in action. You can also try the @sticker and @music bots to see for yourself.

We’ve also implemented an easy way for your bot to switch between inline and PM modes.

You can use bots to accept payments from Telegram users around the world.

  • Send invoices to any chat, including to groups and channels.
  • Create invoices that can be forwarded and used by multiple buyers to order things.
  • Use inline mode to help users show your goods and services to their friends and communities.
  • Allow tips from users with preset and custom amounts.
  • Accept payments from users on mobile or desktop apps.
  • Try @ShopBot to create a test invoice – or start a message with @ShopBot . in any chat for an inline invoice.
  • Check out Demo Shop for an example of a Telegram Channel used as virtual storefront.

Bots can offer their users HTML5 games to play solo or to compete against each other in groups and one-on-one chats. The platform allows your bot to keep track of high scores for every game played in every chat. Whenever there’s a new leader in the game, other playing members in the chat are notified that they need to step it up.

Since the underlying technology is HTML5, the games can be anything from simple arcades and puzzles to multiplayer 3D-shooters and real-time strategy games. Our team has created a couple of simple demos for you to try out:

You can also check out the @gamee bot that has more than 20 games.

Traditional chat bots can of course be taught to understand human language. But sometimes you want some more formal input from the user — and this is where custom keyboards can become extremely useful.

Whenever your bot sends a message, it can pass along a special keyboard with predefined reply options (see ReplyKeyboardMarkup). Telegram apps that receive the message will display your keyboard to the user. Tapping any of the buttons will immediately send the respective command. This way you can drastically simplify user interaction with your bot.

We currently support text and emoji for your buttons. Here are some custom keyboard examples:

For more technical information on custom keyboards, please consult the Bot API manual (see sendMessage).

There are times when you’d prefer to do things without sending any messages to the chat. For example, when your user is changing settings or flipping through search results. In such cases you can use Inline Keyboards that are integrated directly into the messages they belong to.

Unlike with custom reply keyboards, pressing buttons on inline keyboards doesn’t result in messages sent to the chat. Instead, inline keyboards support buttons that work behind the scenes: callback buttons, URL buttons and switch to inline buttons.

When callback buttons are used, your bot can update its existing messages (or just their keyboards) so that the chat remains tidy. Check out these sample bots to see inline keyboards in action: @music, @vote, @like.

Commands present a more flexible way to communicate with your bot. The following syntax may be used:

A command must always start with the ‘/’ symbol and may not be longer than 32 characters. Commands can use latin letters, numbers and underscores. Here are a few examples:

Messages that start with a slash are always passed to the bot (along with replies to its messages and messages that @mention the bot by username). Telegram apps will:

  • Suggest a list of supported commands with descriptions when the user enters a ‘/’ (for this to work, you need to have provided a list of commands to the BotFather). Tapping on a command in the list immediately sends the command.
  • Show an additional (/) button in the input field in all chats with bots. Tapping it types a ‘/’ and shows the list of commands.
  • Highlight /commands in messages. When the user taps a highlighted command, the command is sent at once.

If multiple bots are in a group, it is possible to add bot usernames to commands in order to avoid confusion:

This is done automatically when commands are selected via the list of suggestions. Please remember that your bot needs to be able to process commands that are followed by its username.

In order to make it easier for users to navigate the bot multiverse, we ask all developers to support a few basic commands. Telegram apps will have interface shortcuts for these commands.

  • /start — begins interaction with the user, e.g., by sending a greeting message. This command can also be used to pass additional parameters to the bot (see Deep linking)
  • /help — returns a help message. It can be a short text about what your bot can do and a list of commands.
  • /settings — (if applicable) returns the bot’s settings for this user and suggests commands to edit these settings.

Users will see a Start button when they first open a conversation with your bot. Help and Settings links will be available in the menu on the bot’s profile page.

You can use bold, italic or fixed-width text, as well as inline links in your bots’ messages. Telegram clients will render them accordingly.

Bots are frequently added to groups in order to augment communication between human users, e.g. by providing news, notifications from external services or additional search functionality. This is especially true for work-related groups. Now, when you share a group with a bot, you tend to ask yourself “How can I be sure that the little rascal isn’t selling my chat history to my competitors?” The answer is — privacy mode.

A bot running in privacy mode will not receive all messages that people send to the group. Instead, it will only receive:

  • Messages that start with a slash ‘/’ (see Commands above)
  • Replies to the bot’s own messages
  • Service messages (people added or removed from the group, etc.)
  • Messages from channels where it’s a member

On one hand, this helps some of us sleep better at night (in our tinfoil nightcaps), on the other — it allows the bot developer to save a lot of resources, since they won’t need to process tens of thousands irrelevant messages each day.

Privacy mode is enabled by default for all bots, except bots that were added to the group as admins (bot admins always receive all messages). It can be disabled, so that the bot receives all messages like an ordinary user (the bot will need to be re-added to the group for this change to take effect). We only recommend doing this in cases where it is absolutely necessary for your bot to work — users can always see a bot’s current privacy setting in the group members list. In most cases, using the force reply option for the bot’s messages should be more than enough.

Telegram bots have a deep linking mechanism, that allows for passing additional parameters to the bot on startup. It could be a command that launches the bot — or an auth token to connect the user’s Telegram account to their account on some external service.

Each bot has a link that opens a conversation with it in Telegram — https://t.me/ . You can add the parameters start or startgroup to this link, with values up to 64 characters long. For example:

A-Z , a-z , 0-9 , _ and — are allowed. We recommend using base64url to encode parameters with binary and other types of content.

Following a link with the start parameter will open a one-on-one conversation with the bot, showing a START button in the place of the input field. If the startgroup parameter is used, the user is prompted to select a group to add the bot to. As soon as a user confirms the action (presses the START button in their app or selects a group to add the bot to), your bot will receive a message from that user in this format:

PAYLOAD stands for the value of the start or startgroup parameter that was passed in the link.

Suppose the website example.com would like to send notifications to its users via a Telegram bot. Here’s what they could do to enable notifications for a user with the ID 123 .

  1. Create a bot with a suitable username, e.g. @ExampleComBot
  2. Set up a webhook for incoming messages
  3. Generate a random string of a sufficient length, e.g. $memcache_key = «vCH1vGWJxfSeofSAs0K5PA»
  4. Put the value 123 with the key $memcache_key into Memcache for 3600 seconds (one hour)
  5. Show our user the button https://t.me/ExampleComBot?start=vCH1vGWJxfSeofSAs0K5PA
  6. Configure the webhook processor to query Memcached with the parameter that is passed in incoming messages beginning with /start . If the key exists, record the chat_id passed to the webhook as telegram_chat_id for the user 123 . Remove the key from Memcache.
  7. Now when we want to send a notification to the user 123 , check if they have the field telegram_chat_id. If yes, use the sendMessage method in the Bot API to send them a message in Telegram.

Some bots need extra data from the user to work properly. For example, knowing the user’s location helps provide more relevant geo-specific results. The user’s phone number can be very useful for integrations with other services, like banks, etc.

Bots can ask a user for their location and phone number using special buttons. Note that both phone number and location request buttons will only work in private chats.

When these buttons are pressed, Telegram clients will display a confirmation alert that tells the user what’s about to happen.

BotFather is the one bot to rule them all. It will help you create new bots and change settings for existing ones.

Use the /newbot command to create a new bot. The BotFather will ask you for a name and username, then generate an authorization token for your new bot.

The name of your bot is displayed in contact details and elsewhere.

The Username is a short name, to be used in mentions and t.me links. Usernames are 5-32 characters long and are case insensitive, but may only include Latin characters, numbers, and underscores. Your bot’s username must end in ‘bot’, e.g. ‘tetris_bot’ or ‘TetrisBot’.

The token is a string along the lines of 110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw that is required to authorize the bot and send requests to the Bot API. Keep your token secure and store it safely, it can be used by anyone to control your bot.

If your existing token is compromised or you lost it for some reason, use the /token command to generate a new one.

The remaining commands are pretty self-explanatory:

  • /mybots — returns a list of your bots with handy controls to edit their settings
  • /mygames — does the same for your games

Edit bots

  • /setname – change your bot’s name.
  • /setdescription — change the bot’s description, a short text of up to 512 characters, describing your bot. Users will see this text at the beginning of the conversation with the bot, titled ‘What can this bot do?’.
  • /setabouttext — change the bot’s about info, an even shorter text of up to 120 characters. Users will see this text on the bot’s profile page. When they share your bot with someone, this text is sent together with the link.
  • /setuserpic — change the bot’s profile pictures. It’s always nice to put a face to a name.
  • /setcommands — change the list of commands supported by your bot. Users will see these commands as suggestions when they type / in the chat with your bot. Each command has a name (must start with a slash ‘/’, alphanumeric plus underscores, no more than 32 characters, case-insensitive), parameters, and a text description. Users will see the list of commands whenever they type ‘/’ in a conversation with your bot.
  • /deletebot — delete your bot and free its username.

Edit settings

  • /setinline — toggle inline mode for your bot.
  • /setinlinegeo — request location data to provide location-based inline results.
  • /setjoingroups — toggle whether your bot can be added to groups or not. Any bot must be able to process private messages, but if your bot was not designed to work in groups, you can disable this.
  • /setprivacy — set which messages your bot will receive when added to a group. With privacy mode disabled, the bot will receive all messages. We recommend leaving privacy mode enabled. You will need to re-add the bot to existing groups for this change to take effect.

Manage games

  • /newgame — create a new game.
  • /listgames — get a list of your games.
  • /editgame — edit a game.
  • /deletegame — delete an existing game.

Please note, that it may take a few minutes for changes to take effect.

Millions choose Telegram for its speed. To stay competitive in this environment, your bot also needs to be responsive. In order to help developers keep their bots in shape, Botfather will send status alerts if it sees something is wrong.

We will be checking the number of replies and the request/response conversion rate for popular bots (

300 requests per minute: but don’t write this down as the value may change in the future). If we get abnormally low readings, you will receive a notification from Botfather.

By default, you will only get one alert per bot per hour. Each alert has the following buttons:

  • Fixed. Use this if you found an issue with your bot and fixed it. If you press the fix button, we will resume sending alerts in the regular way so that you can see if your fix worked within 5-10 minutes instead of having to wait for an hour.
  • Support. Use this to open a chat with @BotSupport if you don’t see any issues with your bot or if you think the problem is on our side.
  • Mute for 8h/1w. Use this if you can’t fix your bot at the moment. This will disable all alerts for the bot in question for the specified period of time. We do not recommend using this option since your users may migrate to a more stable bot. You can unmute alerts in your bot’s settings via Botfather.

We will currently notify you about the following issues:

1.

Your bot is sending much fewer messages than it did in the previous weeks. This is useful for newsletter-style bots that send out messages without prompts from the users. The larger the value, the more significant the difference.

2.

Your bot is not replying to all messages that are being sent to it (the request/response conversion rate for your bot was too low for at least two of the last three 5-minute periods). To provide a good user experience, please respond to all messages that are sent to your bot. Respond to message updates by calling send… methods (e.g. sendMessage).

3.

Your bot is not replying to all inline queries that are being sent to it, calculated in the same way as above. Respond to inline_query updates by calling answerInlineQuery.

4.

Your bot is not replying to all callback queries that are being sent to it (with or without games), calculated in the same way as above. Respond to callback_query updates by calling answerCallbackQuery.

Please note that the status alerts feature is still being tested and will be improved in the future.

That’s it for the introduction. You are now definitely ready to proceed to the BOT API MANUAL.

If you’ve got any questions, please check out our Bot FAQ »

Источник

Читайте также:  Как настроить часы lap memory 60
Оцените статью