[Django]-Python telegram bot: Access to contact information

8πŸ‘

βœ…

I am not sure with django-telegrambot. But if I’m not wrong your reply_markup is the one under python-telegram-bot. When the button is pressed, the user’s phone number will be sent to your bot as a Contact object. You can catch it with a MessageHandler and a Filters.contact filter.

from telegram.ext import MessageHander, Filters

def contact_callback(bot, update):
    contact = update.effective_message.contact
    phone = contact.phone_number

dispatcher.add_handler(MessageHandler(Filters.contact, contact_callback))
πŸ‘€jeffffc

Leave a comment