Available methods

setBusinessAccountUsername()

Changes the username of a managed business account. Requires the can_change_username business bot right. Returns True on success.

parameters

parametertyperequireddescription
business_connection_idstringrequiredUnique identifier of the business connection
usernamestringoptionalThe new value of the username for the business account; 0-32 characters

returns

boolean

usage in yaebal

setBusinessAccountUsername is directly typed on Api — call it straight off bot.api.

bot.ts
import type { SetBusinessAccountUsernameParams } from "@yaebal/types";

await bot.api.setBusinessAccountUsername({
  business_connection_id: "...",
} satisfies SetBusinessAccountUsernameParams);

context shortcut

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

context shortcut
/** Changes the username of a managed business account. Requires the *can\_change\_username* business bot right. Returns *True* on success. */
ctx.setBusinessAccountUsername(params: Omit<SetBusinessAccountUsernameParams, "business_connection_id"> & { business_connection_id?: string })