Available methods

savePreparedKeyboardButton()

Stores a keyboard button that can be used by a user within a Mini App. Returns a PreparedKeyboardButton object.

parameters

parametertyperequireddescription
user_idnumberrequiredUnique identifier of the target user that can use the button
buttonKeyboardButtonrequiredA JSON-serialized object describing the button to be saved. The button must be of the type request_users, request_chat, or request_managed_bot.

returns

PreparedKeyboardButton

usage in yaebal

not (yet) hard-typed on Api — call it through the generic .call<T>() escape hatch documented in @yaebal/types.

bot.ts
import type { PreparedKeyboardButton, SavePreparedKeyboardButtonParams } from "@yaebal/types";

await bot.api.call<PreparedKeyboardButton>("savePreparedKeyboardButton", {
  user_id: 123456789,
  button: {} /* KeyboardButton */,
} satisfies SavePreparedKeyboardButtonParams);

context shortcut

also available as ctx.savePreparedKeyboardButton() on 16 context types — see @yaebal/contexts.

context shortcut
/** Stores a keyboard button that can be used by a user within a Mini App. Returns a [PreparedKeyboardButton](https://core.telegram.org/bots/api/#preparedkeyboardbutton) object. */
ctx.savePreparedKeyboardButton(params: Omit<SavePreparedKeyboardButtonParams, "user_id">)