Markup Errors - mkotb/Telegram-Errors GitHub Wiki

This section outlines errors sent by the API when parsing markup such as inline keyboards, reply keyboards, etc.

If you do not send Telegram a JSON object, it will return Can't parse reply keyboard markup JSON object

InlineKeyboardButton

As sending an empty inline keyboard is completely valid, let's outline the errors that can occur with buttons:

text

If this is the only field sent, Telegram will return Can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard

Note that Telegram clients will cut off your text if it's too long, there is no known maximum that the API will not accept.

url

Telegram will respond with BUTTON\_URL\_INVALID if the URL is invalid or contains spaces.

callback_data

If the data is more than 64 bytes, Telegram will respond with BUTTON\_DATA\_INVALID

This MUST be sent, contradictory to the documentation. If not sent, Telegram will return Can't parse inline keyboard button: Text buttons are unallowed in the inline keyboard

KeyboardButton

request_contact and request_location

If any of these are set to true in private chats, Telegram will respond with X can be requested in a private chats only. X is either Phone number or Location

⚠️ **GitHub.com Fallback** ⚠️