telegram-bot

How do I add my bot to a channel?

落爺英雄遲暮 提交于 2019-11-28 03:38:40
I'm using my bot to tell important news, but when I using 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 mention it's not possible via the client to send a message to a channel, but then what is the other way to do that? So, the question is, how to add my bot to the channel? Now all clients allow to do it, but it's not pretty simple. In any Telegram client: Open Channel info (in app title) Choose Administrators Add Administrator There will be no bots in

create dynamic Keyboard telegram bot in c# , MrRoundRobin API

荒凉一梦 提交于 2019-11-27 23:15:42
I want to create custom keyboard in telegram.bot For example: We have an array of string that gets from the database or other recurses how we can push data from the array to InlineKeyboardMarkup in for loop or function //array of Button string[] ButtonItem= new string[] { "one", "two", "three", "Four" }; //function or solution to create keyboard like this var keyboard = new InlineKeyboardMarkup(new[] { new[] { new InlineKeyboardButton("one"), new InlineKeyboardButton("two"), }, new[] { new InlineKeyboardButton("three"), new InlineKeyboardButton("Four"), } }); You could use a separate function

How to obtain the chat_id of a private Telegram channel?

 ̄綄美尐妖づ 提交于 2019-11-27 17:04:40
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? It's not the one you have in the private invite. Because now we can pass a channel username (in the format @channelusername) in the place of chat_id in all methods (and instead of from_chat_id in forwardMessage). But what's the @channelusername of a private channel that I administer? I found the way to write in private channels. You should convert it

Telegram bot - how to get a group chat id?

旧街凉风 提交于 2019-11-27 16:52:17
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 to use for getting group chat id can't find/ Maverick_Java In order to get the group chat id, do as follows: Add the Telegram BOT to the group. Get the list of updates for your BOT: https://api.telegram.org/bot<YourBOTToken>/getUpdates Ex: https://api.telegram.org/bot123456789:jbd78sadvbdy63d37gda37bd8/getUpdates Look for the "chat" object: {

How to get user_id of a phone number in telegram

无人久伴 提交于 2019-11-27 13:48:13
问题 Im creating a bot to send message to multiple contact in Telegram. user can share contact with bot. then i use getUpdates and obtain the phone number. For using the sendMessage Method i need the chat_id. now how to get chat_id of a user with his phone number? Is there any way better than this method to do this? 回答1: For internet services to stay alive, they need to fight with any type of spam. As the result, Telegram bots can't start sending messages to users that didn't start using the bot

How to set Telegram bot webhook?

岁酱吖の 提交于 2019-11-27 13:10:46
问题 I'm developing a Telegram bot, and I want to set the webhook to my domain's URL. I've already generated a self-signed certificate following the Telegram's guide. However, I'm not able to set the webhook. I've searched previous answers and found this one, but it doesn't work to me. Can anybody explain me how to upload the SSL certificate and set the webhook? 回答1: I created a file on my server for conveniently setting up telegram webhooks. You can use the same file on your server. This should

How to obtain Telegram chat_id for a specific user?

做~自己de王妃 提交于 2019-11-27 11:46:12
How to obtain user chat_id in Telegram bot API? The documentation says: Integer | Unique identifier for the message recipient — User or GroupChat id The message updates you receive via getUpdates or your webhook will contain the chat ID for the specific message. It will be contained under the message.chat.id key. This seems like the only way you are able to retrieve the chat ID. So if you want to write something where the bot initiates the conversation you will probably have to store the chat ID in relation to the user in some sort of key->value store like MemCache or Redis. I believe their

PHP: Telegram Bot: Insert line break to text message

冷暖自知 提交于 2019-11-27 11:27:28
问题 "\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 = 'با تشکر از عضویت شما، هر روز حدود ساعت 10 شب یک ویدئوی جالب برای شما ارسال خواهد شد.'; $txt .= " \n "; $txt .= 'Thanks for joining, Every day at almost 18:30 GMT an intersting video will be sent'; Message Demo Any help will be appreciated. 回答1: There is a better

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

随声附和 提交于 2019-11-27 09:44:55
问题 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. 回答1: This is now available! https://core.telegram.org/bots/api#getfile Hooray! It was added on Sep 18th: https://core.telegram.org/bots/api Usage: In the JSON of the message you will receive a file_id as before. An example of a message object with a voice file: { message_id: 2675, from: { id: 10000001, first_name

How do I add my bot to a channel?

青春壹個敷衍的年華 提交于 2019-11-27 00:11:45
问题 I'm using my bot to tell important news, but when I using 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 mention it's not possible via the client to send a message to a channel, but then what is the other way to do that? So, the question is, how to add my bot to the channel? 回答1: Now all clients allow to do it, but it's not pretty simple. In any