I have problem with Telegram Bot Api and with "ReplyKeyboard". I'm using Python 2.7 and I send post request:
TelegramAPI.post(TELEGRAM_URL + "sendMessage", data=dict(chat_id=CHAT_ID, text="", keyboard={'keyboard': keyboard, 'one_time_keyboard': False, 'resize_keyboard': True})
keyboard in this format:
[["A button"], ["B button"]]
But in Telegram I don't see keyboard. What problem can be?
According to the Bot API documentations, a custom keyboard requires a reply_markup
parameter, whose value is a JSON-serialized specification of the keyboard. Assuming your TelegramAPI.post()
function does not JSON-serialize for you, I would try the following:
import json
json_keyboard = json.dumps({'keyboard': [["A button"], ["B button"]],
'one_time_keyboard': False,
'resize_keyboard': True})
TelegramAPI.post(TELEGRAM_URL + "sendMessage",
data=dict(chat_id=CHAT_ID,
text="Has to be non-empty",
reply_markup=json_keyboard))
Note that text
has to be non-empty.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With