Pier Giorgio Misley Pier Giorgio Misley - 1 year ago 326
C# Question

How to make Keyboard Button message text different from its caption in Telegram bot API using C#

I need my bot to print a different message than its caption (which shows by telegram client on keyboard button element).

My custom button has this text:

"Where am I?"
and when I click on it, it prints on the screen
"Where am I?"
I want the button to print
.(something different from its

How can I achieve it? I'm using
Telegram Bot API


What I want:

  • When the user clicks this button, telegram client send a messages with
    [as his typed message] but NOT send
    show my age
    (which is that button
    field )

So: I want a button with a
. when the user clicks the button I want the message sent to be different from that

Answer Source

There is a boolean field for location, did you set it to true? https://core.telegram.org/bots/api#keyboardbutton

Update: hen you are sending a reply to the user, you are also sending a ReplyKeyboardMarkup. ReplyKeyboardMarkup has a field called keyboard which is Array of Array of KeyboardButton. on each KeyboardButton you have a bool for location that you need to set to true if you want that button to send the location

Update 2

it is not possible to have a message different than your text. text- String->Text of the button. If none of the optional fields are used, it will be sent to the bot as a message when the button is pressed

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download