0

i am developping a bot and i want to link it with telegram. I want to use custom button in order to ask location , i saw in the documentation that its possible with the custom arguments but there is no more information about how to use it or examples. It will be great if someone could help me with an example ! I want a button that when the user click on it, it send the user’s location i saw that its possible to do it with some keyboardbutton but i am having trouble with it i am using python and the last version of rasa

Usefull link for the documentation : telegram api keyboard button , Rasa's documentation for telegram connector , python-telegram-bot , rasa dispatcher

Code that i have tried 1 :

location_keyboard = telegram.KeyboardButton(text="send_location", request_location=True)
    contact_keyboard = telegram.KeyboardButton(text="send_contact", request_contact=True)
    custom_keyboard = [[ location_keyboard, contact_keyboard ]]
    reply_markup = telegram.ReplyKeyboardMarkup(custom_keyboard)
    
    dispatcher.utter_message(text="loc",buttons= location_keyboard)

2 : b=JSONDict.stringify({"keyboard": [ [{ "text": "Location", "request_location": True }], [{ "text": "Contact", "request_contact": True }] ], "one_time_keyboard" : True}) dispatcher.utter_message(json_message=b)

  • Can you share what you have tried so far? And what documentation are you looking at? – vielkind Nov 19 '21 at 13:53
  • Hello, thanks for the reply I am using this documentation of [python-telegram-bot] (python-telegram-bot.readthedocs.io) and also [Rasa's documentation](https://rasa.com/docs/rasa/connectors/telegram) I have tried to use and adapt some examples like [this one](https://stackoverflow.com/questions/43424621/telegram-bot-location-python) or [this one](https://stackoverflow.com/questions/36734773/how-to-capture-users-phone-number-and-location-using-telegram-bot-api) while using the dispatcher of rasa. but anytime am getting error and when its not case, nothing happen in telegram chat – Mamadou Racine Ly Nov 21 '21 at 07:20

0 Answers0