I’m currently playing with telegram bot api via the telegram python package. So far I don’t have any problem creating custom keyboards with the following code:
bot.sendMessage(chat_id,
text=”Where are you now? ”
“/cancel to abort”,
reply_markup=ReplyKeyboardMarkup([[‘Home’, ‘Office’]], one_time_keyboard=True))
Basically the above will give me two button, “Home” and “Office”.
I’m now trying to capture user’s phone number and location, which should be doable based on the Telegram API Bot documentation at https://core.telegram.org/bots/api#keyboardbutton. However I’m really having a hard time figuring out how to get it to work.
Any ideas?
2
Answers
here is an example:
Hope it helps!
from telegram import (KeyboardButton)
…
…
…