Telegram BotApi, Send message to multiple chat_id
There is no way to make bot to sendMessage to multiple chat id but there is a trick that can fix it for now :)
Why not sending each chat id a message ?!
Let's look at this example in PHP :
<?php
$message = "Hi John";
$chatIds = array("xxx","xxx","xxx"); // AND SOME MORE
foreach($chatIds as $chatId) {
// Send Message To chat id
file_get_contents("https://api.telegram.org/botTOKKEN/sendMessage?chat_id=$chatId&text=".$message);
}
?>
Reply to multiple users telegram (Message Id) PHP Bot
each message has a different id, and you should reply to each message of any user separately.
https://api.telegram.org/mytoken/sendMessage?chat_id=user1ID&parse_mode=HTML&text=test&reply_to_message_id=user1MessageID
https://api.telegram.org/mytoken/sendMessage?chat_id=user2ID&parse_mode=HTML&text=test&reply_to_message_id=user2MessageID
telegram api send message to specific user
You cannot send a user specific message in a group. Still you have other options:
- Send a link to the group and mention the user to start your bot with that link for their message
- Send a message with inline button that would only work for that specific user. Then when the user clicks on that button, a callback alert appears with the message.
How to send '#' to chat with Telegram bot API?
You did not url-encode the string properly, it should be
Hello%20%23%20World
Instead off
Hello+%23+World
The complete url:
https://api.telegram.org/bot<TOKEN>/sendMessage?chat_id=<CHAT-ID>&text=Hello%20%23%20World
Python / Send message to specific telegram user?
you already have a bot and its token
after that you need to get the chat_id
:
- write message in the chat
- Visit
https://api.telegram.org/bot<YourBOTToken>/getUpdates
and get thechat_id
under the keymessage['chat']['id']
import requests
def telegram_bot_sendtext(bot_message):
bot_token = ''
bot_chatID = ''
send_text = 'https://api.telegram.org/bot' + bot_token + '/sendMessage?chat_id=' + bot_chatID + '&parse_mode=Markdown&text=' + bot_message
response = requests.get(send_text)
return response.json()
test = telegram_bot_sendtext("Testing Telegram bot")
print(test)
more info - https://medium.com/@ManHay_Hong/how-to-create-a-telegram-bot-and-send-messages-with-python-4cf314d9fa3e
Send Telegram bot messages with formatted text
Use one *
instead of two as detailed in the official documentation.
Related Topics
How to Configure Xampp to Send Mail from Localhost
Reference - Frequently Asked Questions About Pdo
Telegram Botapi, Send Message to Multiple Chat_Id
How to Expire a PHP Session After 30 Minutes
Php How to Loop Through a Post Array
Change the Maximum Upload File Size
How to Prevent SQL Injection in PHP
How to Check If a Row Exists in MySQL (I.E. Check If Username or Email Exists in MySQL)
Reference - What Does This Error Mean in PHP
How to Get the Client Ip Address in PHP
How to Extract and Access Data from Json With PHP
Project Links Do Not Work on Wamp Server
How to Add HTML and CSS into Pdf
How to Access and Manipulate Multi-dimensional Array by Key Names/Path