According to the API API documentation for the user keyboard, the reply_markup parameter is reply_markup , the value of which is the JSON keyboard specification for the keyboard. Assuming your TelegramAPI.post() function is not intended for JSON serialization, 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 must be non-empty.
source share