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
8
votes
1 answer

How to Obtain Reactions Updates via Telegram Bot API

Good day, Is it any chance to obtain via webhooks or long-pooling requests updates related to reactions to messages which was posted by bot? Or at least obtain any reactions updates in channel/group to which a bot was added. In documentation found…
pryabov
  • 702
  • 2
  • 7
  • 23
8
votes
1 answer

How to create unit test for a Python Telegram Bot

I've built this Telegram Bot in Python, with python-telegram-bot. It's not so complex, but I want to do some regression tests to check if everything works fine after a new feature or a change, and more generally to test specific features to find…
8
votes
3 answers

Regex match Telegram username and delete whole line in PHP

I wanna match Telegram username in message text and delete entire line, I've tried this pattern but the problem is that it matches emails too: .*(@(?=.{5,64}(?:\s|$))(?![_])(?!.*[_]{2})[a-zA-Z0-9_]+(?
Ali Raghebi
  • 205
  • 2
  • 6
8
votes
1 answer

Telegram bot api : issue with GIF upload/download size

Faced with issue, when i am trying to send GIF to my bot, but bot can't access to original size of image. Seems like telegram servers converting it to mp4 (it is a good idea, looks fine) and when i trying to download it - it always looks like a…
Nigrimmist
  • 10,289
  • 4
  • 52
  • 53
8
votes
1 answer

How do scenes and stages work in telegraf

I've searched telegram bot api for "scenes" and "stages" that are part of telegraf. Here is an example. It seems they are implementations of telegraf and not the API. If this is the case how does telegraf implement those?
Aven Desta
  • 2,114
  • 12
  • 27
8
votes
1 answer

How forward message to other contact with telethon

How do I forward a message to another chat as soon as I receive it from a contact? I created this example just to test routing, but it doesn't work. #!/usr/local/bin/python3 from telethon import TelegramClient, events api_id = 9999900 api_hash =…
8
votes
0 answers

curl: (35) TCP connection reset by peer

I want to setup telegram bot webhook from CentOS, but receive an error: curl: (35) TCP connection reset by peer My request: curl -F "url=https://12.34.56.78:8443" \ -F "certificate=@/home/mts/mtspredbot/mtspredbot.pem"…
Aleksey N Yakushev
  • 443
  • 1
  • 3
  • 11
8
votes
1 answer

Stage.enter doesn't start the wizard

I created an application which display a survey wizard to the user. When the user launch the /start command, I call the AddProject: const Telegraf = require('telegraf'); const bot = new Telegraf(process.env.BOT_TOKEN); const session =…
sfarzoso
  • 1,356
  • 2
  • 24
  • 65
8
votes
3 answers

How to send File via Telegram Bot

I need to send txt File using TelegramBot API . I already tried https://api.telegram.org/botMYT0KEN/sendDocument?chat_id=569502265&document=/Users/users/Desktop/file.txt and have issue : {"ok":false,"error_code":400,"description":"Bad Request:…
JennyB
  • 81
  • 1
  • 1
  • 2
8
votes
3 answers

Telegram REST API, send newline in message text?

I want to send an message via the Telegram API in a
 block or ``` (HTML or markdown parse mode, I have no preference).
The text is a long string with some line breaks. To make it easy to read I want to send it as code. The new lines are in the…
NVO
  • 2,566
  • 5
  • 27
  • 57
8
votes
2 answers

Send messages to telegram group without user input

I'm trying to build a bot which automatically sends a message whenever there is an update in the latest news using python. Following is what I did. companies = { "name_1": { "rss": "name_1 rss link", "link": "name_1 link" …
Joe
  • 291
  • 1
  • 3
  • 18
8
votes
3 answers

Telegram check if user is admin

I am using the telegram bot api to make a bot. I have some commands that can only be sent from admins. Like kick and ban commands. How do I check if the sender is an admin or not? I am using the python-telegram-bot api. I do not want everyone to be…
ICanKindOfCode
  • 1,000
  • 1
  • 11
  • 32
8
votes
1 answer

How do I get the user profile picture of someone using the Telegram bot chat API?

I'm making a basic Control Panel for managing my Bot with PHP. Basically I want to display the Profile picture / avatar of the user who is sending message to the bot. However the user object has no photo_id, so is there way to get the user's avatar?
user8454964
8
votes
3 answers

(python) Telegram bot- how to send messages periodically?

I have a dilemma regarding my telegram bot. Let's say I have to create a function that will ask, every user connected to the bot, one time per week/month, a question: def check_the_week(bot, update): reply_keyboard = [['YES',…
Vasile
  • 801
  • 2
  • 13
  • 31
8
votes
5 answers

How to send empty message in telegram bot?

I have this keyboard in my telegram bot: When i click the right arrow i get this new keyboard: the code is this: $url = $GLOBALS["website"]."/sendMessage?chat_id=".$chatID."&text=''&parse_mode=html&reply_markup=".json_encode($keyboard3); …
sclero
  • 173
  • 1
  • 1
  • 8