I'm trying to write up a Telegram bot from scratch using Python and Flask, without existing libraries, for learning sake.
I'm still stuck with custom keyboard and its syntax. Can anyone show me the right method with a simple example? Starting from here:
#!/usr/bin/env python
import json, requests
keyboard = json.dumps({'inline_keyboard': [[ "<user1>", "<user2>" ]]})
headers = {'Accept': 'application/json'}
url = "https://api.telegram.org/bot<bot-id>/sendMessage"
kbd = {'text':'Whatever','chat_id':'<channel>','reply_markup': keyboard}
send_kbd = requests.post(url,data=kbd,headers=headers)
Thanks in advance.
$customKeyboard = json_encode(['inline_keyboard' => [[['text' => "BUTTON 1", 'url' => "LINK 1"]], [['text' => "BUTTON 2", 'url' => "LINK 2"]]]]); file_get_contents("https://api.telegram.org/bot".$botToken."/sendmessage?chat_id=".$chatID."&text=".$message."&parse_mode=Markdown&reply_markup=".$customKeyboard);I guess you already checked this documentation or the official documentation on this?