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
412
votes
20 answers

Telegram Bot - how to get a group chat id?

I've been using telegram_bot, and trying to get groupChat id to send notifications to group chat, but don't know which methods I have to use for it. For getting chat id I use to message.chat.id when the bot participated in the chat but which I have…
Roman Podpryatov
  • 4,121
  • 3
  • 10
  • 5
164
votes
17 answers

How to obtain the chat_id of a private Telegram channel

I use curl to update my public channels. This kind of syntax: curl -X POST "https://api.telegram.org/bot144377327:AAGqdElkZ-77zsPRoAXXXXXXXXXX/sendMessage" -d "chat_id=@MyChannel&text=my sample text" But what's the chat_id of a private channel?…
aborruso
  • 4,938
  • 3
  • 23
  • 40
94
votes
4 answers

How do I add my bot to a Telegram channel?

I'm using my bot to tell important news, but when I use sendMessage to the channel I'm receiving the following error: {"ok":false,"error_code":403,"description":"Error: Forbidden: bot is not a participant of the channel"} In the Change Log they…
user4374121
88
votes
12 answers

How to obtain Telegram chat_id for a specific user?

How to obtain user chat_id in Telegram bot API? The documentation says: Integer | Unique identifier for the message recipient — User or GroupChat id
Ameer Mousavi
  • 1,305
  • 1
  • 17
  • 21
82
votes
14 answers

PHP: Telegram Bot: Insert line break to text message

"\n" and "\r\n", tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them. How I could printing line feed in telegram message sent by bot? CODE $txt = 'با تشکر از…
Hossein Shahsahebi
  • 6,348
  • 5
  • 24
  • 38
77
votes
6 answers

How to receive messages in group chats using telegram bot api

My telegram bot receives messages sent by user to my bot in private chats but not receives messages sent by users in group chats. Any options/api for getting group chat messages also,.
Jijo John
  • 819
  • 1
  • 7
  • 9
74
votes
6 answers

How do I download a file or photo that was sent to my Telegram bot?

I am using the telegram bot API but I cant see anyway to download a filé that was sent to my bot. I get a hash of the file but dont know what to do with it. Is there any way? Thanks.
Arthur Felipe
  • 1,404
  • 1
  • 13
  • 20
69
votes
8 answers

send bold & italic text on telegram bot with html

I've created a bot in telegram I want to send bold and italic text with HTML page to bot My HTML code is: Telegram
Mohammad Hossein
  • 709
  • 1
  • 6
  • 7
55
votes
7 answers

Telegram bot: How to mention user by its id (not its username)

I am creating a telegram bot and using sendMessage method to send the messages. it is easy to mention user using @username, But how to mention user when they don't have username? If using the telegram app/web, we can mentioned the user by…
Awang Setyawan
  • 551
  • 1
  • 4
  • 5
55
votes
4 answers

Elixir convert struct to map

I'm trying to convert a struct to a map to be able to clean all the nil values I'm currently using this code case Nadia.get_updates do {:ok, results} -> Map.from_struct(results) |> Enum.filter(fn {_, v} -> v != nil end) |>…
user2070502
  • 603
  • 1
  • 5
  • 8
51
votes
4 answers

How do I get authentication in a telegram bot?

Telegram Bots are ready now. If we use the analogy of web browser and websites, the telegram client applications are like the browser clients. The Telegram Chatrooms are like websites. Suppose we have some information we only want to restrict to…
Kim Stacks
  • 10,202
  • 35
  • 151
  • 282
49
votes
4 answers

How to add a bot to a Telegram Group?

I've been trying to add a bot to my Telegram group in Android Device but I am not able to do so. I tried @bot_name, /bot_name, but it doesn't work. Is it possible to add a bot to the group or should I create a new bot using Telegram API (not bot…
bazinga
  • 2,120
  • 4
  • 21
  • 35
47
votes
7 answers

How can I send a message to someone with my telegram bot using their Username

I am using the telepot python library, I know that you can send a message when you have someone's UserID(Which is a number). I wanna know if it is possible to send a message to someone without having their UserID but only with their username(The one…
42
votes
4 answers

How to show options in telegram bot?

I want to write a bot telegram.How to put possible option in my bot.I insert a picture of sample bot with this functionality.
maryam
  • 1,437
  • 2
  • 18
  • 40
42
votes
15 answers

How to send Emoji with Telegram Bot API?

I need to send messages containing emoji with my Telegram Bot. So I copy/paste emoji code :nine: for example, in my message text and send it to a user, BUT emoji didn`t work. This is my sample code and function: function tel_send($key, $t, $c) { …
Vlmake
  • 531
  • 1
  • 4
  • 5
1
2 3
99 100