Skip to content

GramIO API Reference / @gramio/contexts/dist / InlineKeyboardButton

Class: InlineKeyboardButton

Defined in: contexts/index.d.ts:1985

This object represents one button of an inline keyboard. You must use exactly one of the optional fields.

Constructors

Constructor

new InlineKeyboardButton(payload): InlineKeyboardButton

Defined in: contexts/index.d.ts:1987

Parameters

ParameterType
payloadTelegramInlineKeyboardButton

Returns

InlineKeyboardButton

Properties

PropertyTypeDefined in
payloadTelegramInlineKeyboardButtoncontexts/index.d.ts:1986

Accessors

[toStringTag]

Get Signature

get [toStringTag](): string

Defined in: contexts/index.d.ts:1989

MDN

Returns

string


callbackData

Get Signature

get callbackData(): string

Defined in: contexts/index.d.ts:2003

Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes

Returns

string


callbackGame

Get Signature

get callbackGame(): CallbackGame

Defined in: contexts/index.d.ts:2033

Description of the game that will be launched when the user presses the button.

NOTE: This type of button must always be the first button in the first row.

Returns

CallbackGame


loginUrl

Get Signature

get loginUrl(): LoginUrl

Defined in: contexts/index.d.ts:1998

An HTTP URL used to automatically authorize the user. Can be used as a replacement for the Telegram Login Widget.

Returns

LoginUrl


pay

Get Signature

get pay(): boolean

Defined in: contexts/index.d.ts:2039

Specify true, to send a Pay button.

NOTE: This type of button must always be the first button in the first row.

Returns

boolean


switchInlineQuery

Get Signature

get switchInlineQuery(): string

Defined in: contexts/index.d.ts:2016

If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. Can be empty, in which case just the bot's username will be inserted.

Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it. Especially useful when combined with switch_pm… actions – in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.

Returns

string


switchInlineQueryCurrentChat

Get Signature

get switchInlineQueryCurrentChat(): string

Defined in: contexts/index.d.ts:2025

If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. Can be empty, in which case only the bot's username will be inserted.

This offers a quick way for the user to open your bot in inline mode in the same chat – good for selecting something from multiple options.

Returns

string


text

Get Signature

get text(): string

Defined in: contexts/index.d.ts:1991

Label text on the button

Returns

string


url

Get Signature

get url(): string

Defined in: contexts/index.d.ts:1993

HTTP or tg:// url to be opened when button is pressed

Returns

string