Skip to content

setMyName

Returns: TrueOfficial docs ↗

Use this method to change the bot's name. Returns True on success.

Parameters

nameStringOptionalminLen 0maxLen 64
New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
language_codeStringOptional
A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.

Returns

On success, True is returned.

GramIO Usage

ts
// Set the default bot name (shown to users without a localized name)
await 
bot
.
api
.
setMyName
({
name
: "My Awesome Bot" });
ts
// Set a localized name for Russian-speaking users
await 
bot
.
api
.
setMyName
({
name
: "Мой Бот",
language_code
: "ru",
});
ts
// Remove the localized name (falls back to the default)
await 
bot
.
api
.
setMyName
({
name
: "",
language_code
: "ru",
});
ts
// Read back the name to confirm it was saved
const 
result
= await
bot
.
api
.
getMyName
({
language_code
: "ru" });
console
.
log
(
result
.
name
);

Errors

CodeErrorCause
400Bad Request: name is too longname exceeds 64 characters — shorten the name
400Bad Request: LANGUAGE_CODE_INVALIDlanguage_code is not a valid ISO 639-1 two-letter code
429Too Many Requests: retry after NRate limit hit — check retry_after, use auto-retry plugin

TIP

Use GramIO's auto-retry plugin to handle 429 errors automatically.

Tips & Gotchas

  • 64 character limit. Bot names are displayed in many compact UI contexts (chat list, search results) — shorter names render better across all Telegram clients.
  • Language fallback applies. Users see the localized name matching their Telegram language setting; if none exists, they see the default name (set without language_code). Always set a default first.
  • Empty string removes the localized name. Passing name: "" with a language_code removes that translation; passing it without a code resets the default.
  • Different from the @username. The bot's display name set here is separate from its Telegram username (e.g., @mybot). The username can only be changed via @BotFather.
  • Rate limit applies. Telegram limits how frequently you can update bot metadata — avoid calling this in response to user messages.

See Also