I just need the url to remove the ReplyKeyboard.
I am using Python but not the Python BotLibrary. I do all the work with requests because I want the full flexibility.
I just need the url to remove the ReplyKeyboard.
I am using Python but not the Python BotLibrary. I do all the work with requests because I want the full flexibility.
I looked it up and tested it in PHP:
$removeKeyboard = array('remove_keyboard' => true);
$removeKeyboardEncoded = json_encode($removeKeyboard);
file_get_contents("https://api.telegram.org/BOTTOKEN/sendmessage?chat_id=CHATID&reply_markup=".$removeKeyboardEncoded")
The URL logic is the same in Python as it is in PHP, you just have to adjust the JSON encode function (...).
I learned Python in the last two years so here's the actual code:
import json
import urllib.request
removeKeyboard = {'remove_keyboard':True}
removeKeyboardEncoded = json.dumps(removeKeyboard)
urllib.request.urlopen("https://api.telegram.org/BOTTOKEN/sendmessage?chat_id=CHATID&text=MESSAGE&reply_markup=" + removeKeyboardEncoded).read()
In the current version of the Bot API you now have to add the text
parameter -or else you get a Bad Request: message text is empty
- but the rest works like it worked back then.
You can sendMessage via HTTPS request with ReplyKeyboardRemove.