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
17
votes
8 answers

Clear "pending_update_count" in Telegram Bot

I want to clear all pending_update_count in my bot! The output of below command : https://api.telegram.org/botxxxxxxxxxxxxxxxx/getWebhookInfo Obviously I replaced the real API token with xxx is this : { "ok":true,"result": { "url":"", …
Hamed Kamrava
  • 12,359
  • 34
  • 87
  • 125
17
votes
1 answer

what information about user can a telegram bot access?

I'm new to telegram bots, I want to know when we add a telegram bot to a group, can it access to any information about group members?? and I know about privacy mode, whether it is on or off , can bot access to any information about the user who…
FazeL
  • 916
  • 2
  • 13
  • 30
17
votes
3 answers

How to receive images with the Telegram API?

Is it possible to receive images (and store it on the server) which was sent by any user to the bot? If a image was sent, I receive this JSON post. This is a link to the Telegram Bot-API description. I don't know if it's possible to receive the…
C.E.
  • 664
  • 2
  • 5
  • 21
16
votes
4 answers

How should I use parse_mode='HTML' in telegram python bot?

I'm trying to send a message in a channel with a bot, using Telegram API's send_photo() method. It takes a caption parameter (type String) but I can't format it through parse_mode='HTML' parameter... If I use something like this: send_photo(chat_id,…
Federico
  • 415
  • 1
  • 3
  • 15
16
votes
2 answers

Telegram Bot with Telegraf.js - Send messages to chat

I want to create a Telegram Bot with Node.js and I am using Telegraf for it. I know I can answer to messages like this: app.hears('hi', (ctx) => ctx.reply('Hey there!')) But how can I send a message without getting a message before? I want to read…
Nono
  • 1,073
  • 4
  • 23
  • 46
16
votes
1 answer

'stream.ReadTimeout' threw an exception of type 'System.InvalidOperationException' sending photo to telegram bot

I wrote below code for sending a photo to my bot, but in my stream, I have two exceptions for read and write and my photo was not send. I think maybe the reason was this error, but I couldn't fix it: stream.ReadTimeout threw an exception of type…
Maryam Ghafarinia
  • 417
  • 1
  • 5
  • 21
16
votes
1 answer

Retrieve all chat ids using Telegram bot

the main question is how do I get the chat ids for all the conversations ever held with the bot? Imagine that during the execution of the bot there is a conversation with the user A. Now I stop the bot process and start it again. How do I get the…
Cristian T
  • 2,245
  • 3
  • 25
  • 45
16
votes
4 answers

How can I detect whether a user deletes the Telegram Bot chat?

Is it possible to check, via an API, whether somebody has deleted the Bot Chat in Telegram? My test : Currently if a user deletes a chat, new messages will not stop sending to user.
Yoones Mehdian
  • 482
  • 1
  • 4
  • 18
16
votes
4 answers

Telegram bot and the method getUpdates

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/getUpdates now I can't see any message,…
davboc
  • 173
  • 1
  • 2
  • 6
15
votes
1 answer

Async SQLite python

I write asynchronous telegram bot using the aiogram library. I decided to use SQLite as a database for storing immutable values. How do I implement asynchronous reads from my database?
rdfsx
  • 152
  • 1
  • 1
  • 7
15
votes
3 answers

Add clickable buttons to telegram-bot

I'm developing a simple telegram bot with node.js telegram-bot. https://github.com/yagop/node-telegram-bot-api For now I want user to stop typing messages (with letters), just pressing one of a few buttons. And when he clicks on the button, his…
Kamiky
  • 601
  • 2
  • 8
  • 25
15
votes
6 answers

How to get a Telegram Channel Id without sending a message to it

Is there any way to find a telegram channel id without sending a message to it ? Right now I go this way and find the channel id by calling this URL in my code and get the JSON as…
MohamadNik
  • 151
  • 1
  • 2
  • 5
15
votes
1 answer

Telegram: get fileid from telegram client

Telegram bots use fileid to download a file. How can I get this fileid from Telegram client (My Unofficial version) ? Files in mtproto have this location class that indicates their address. File Location Parameters dc_id int Number of…
Behrouz.M
  • 3,445
  • 6
  • 37
  • 64
15
votes
8 answers

Send an image link to telegram without display image url

I need send an image url to telegram without display image url and hidden url. I see a telegram bot and it's do it very well and send long message with image I'm attach this bot result image see it. Now how can do it in my custom bot? It's possible…
Matin
  • 597
  • 3
  • 8
  • 18
15
votes
3 answers

How to hide ReplyKeyboardMarkup after user click in Telegram Bot API

I am using Node.js telegram-bot-api. Idea: Show a custom keyboard with one button - "Share my phone number". When user clicks this button, contact should be sent and button should be removed from screen. Here is a code I am using right…
Nazar
  • 1,769
  • 1
  • 15
  • 31