Questions tagged [telegram-bot]

The Bot API is an HTTP-based interface created for developers keen on building bots for Telegram which is an instant-messaging app with documented API. Use this tag if you're writing a telegram bot and have a specific question regarding the Bot API.

Available methods

  • getMe
  • sendMessage
  • forwardMessage
  • sendPhoto
  • sendAudio
  • sendDocument
  • sendSticker
  • sendVideo
  • sendVideoNote
  • sendVoice
  • sendLocation
  • sendVenue
  • sendContact
  • sendChatAction
  • getUserProfilePhotos
  • getUpdates
  • setWebhook
  • removeWebhook
  • getFile

Links:

4905 questions
6
votes
2 answers

How Can I download media to specific path on Telethon

I'm working on telethon download_media and _download_document methods for downloading media from telegram. My code is something like this: from telethon import TelegramClient api_id = 12345 api_hash = '0123456789abcdef0123456789abcdef' client =…
6
votes
2 answers

Is there a way to validate telegram bot api's markdown syntax?

I'm currently working on with telegram Bot API, but I have to validate the markdown syntax to prevent parse errors. But telegram bot api's markdown doesn't follow the regular markdown syntax so I'm kind of struggling how to do it. Is there a proper…
Alex Won
  • 177
  • 2
  • 11
6
votes
1 answer

How do telegram determine user language

API object User has property language_code - how do Telegram determine user's language, and how do I change it? I wish to create response for user based on language_code language, but I am not sure I can trust this value, because fore example my…
Valera Kvip
  • 334
  • 5
  • 14
6
votes
2 answers

Need download voice message from Telegram on Python

I started developing a pet project related to telegram bot. One of the points was the question, how to download a voice message from the bot? Task: Need to download a audiofile from telegram bot and save in project…
6
votes
1 answer

How to get callback_data from Telegram in PHP

I want to get callback data from response but array is empty. I am trying to show in message callback_data array. Here is my code: $botToken = "token"; $botAPI = "https://api.telegram.org/bot" . $botToken; $update =…
Akram Baratov
  • 143
  • 1
  • 3
  • 13
6
votes
2 answers

Python Telegram Bot how to wait for user answer to a question And Return It

Context: I am using PyTelegramBotAPi or Python Telegram Bot I have a code I am running when a user starts the conversation. When the user starts the conversation I need to send him the first picture and a question if He saw something in the picture,…
Espoir Murhabazi
  • 5,973
  • 5
  • 42
  • 73
6
votes
6 answers

How to manage invite link in private channel?

What I did: I developed a Telegram bot using TelegrafJS framework. This bot allow the user to subscribe to a paid channel, this channel is privated. So after that the payment is completed, the bot send the invitation link to let the user join to the…
sfarzoso
  • 1,356
  • 2
  • 24
  • 65
6
votes
1 answer

Telegram bot API is the chat_id unique for each user contacting the bot?

We are using python API for telegram bots and need to be able to identify the user. Is the chat_id unique for each user connecting the bot? Can we trust the chat_id to be consistent? e.g same chat_id will tell us that this is the same user, and…
6
votes
3 answers

pyTelegramBotAPI disable link preview

Currently writing my first bot using pyTelegramBotAPI. I want to disable link previews on certain messages. How do I do this?
Philippe
  • 299
  • 2
  • 3
  • 13
6
votes
2 answers

Change telegram bot name on the fly

I have a telegram bot that messages on a group. I want the telegram bot to change its “name” from time to time - just like a user can. Is this possible? This means that when I see a message from the bot it can say “ABCbot”, but later it can say…
6
votes
1 answer

Telegram MTProto Java: how to get user token

This says that to get a user's token I need to send a request auth.sentCode#efed51d9 phone_registered:Bool phone_code_hash:string send_call_timeout:int is_password:Bool = auth.SentCode; somewhere? I've read it's a MTProto request, but I'm not sure…
parsecer
  • 4,758
  • 13
  • 71
  • 140
6
votes
2 answers

How to validate JSON field with name "from"

I want to validate JSON object (it is in Telegram Bot API) which contains from field (which is reserved word in Python) by using pydantic validator. So my model should look like the following: class Message(BaseModel): message_id: int from:…
likern
  • 3,744
  • 5
  • 36
  • 47
6
votes
2 answers

telegram bot can't send messages to super group

this is my code private async void Bot_OnMessage(object sender, Telegram.Bot.Args.MessageEventArgs e) { var message = e.Message; if (message == null || message.Type != MessageType.Text) return; await…
syaneteu
  • 63
  • 1
  • 1
  • 5
6
votes
1 answer

Telegram API throwing PeerFloodError: Too many requests

I am not using bot API. I am using Telegram API to send messages. Messages are being sent easily but the problem occurs after 19 users. On the 20th user, I receive PeerFloodError. Even after, searching a lot, I didn't find any specific limits and…
6
votes
2 answers

Telegram Bot API Webhooks with Go, GoLang on Heroku

I use go-telegram-bot-api for building a Telegram Bot and deploying it on Heroku. I need to set Webhooks as I used to do in Python like in this Python case. Can't understand how to set Webhooks in go-telegram-bot-api without providing certificate…
franchb
  • 1,174
  • 4
  • 19
  • 42