setMyName
Returns: TrueOfficial docs ↗
Use this method to change the bot's name. Returns True on success.
Parameters
nameStringOptionalminLen 0maxLen 64New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
language_codeStringOptionalA 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
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: name is too long | name exceeds 64 characters — shorten the name |
| 400 | Bad Request: LANGUAGE_CODE_INVALID | language_code is not a valid ISO 639-1 two-letter code |
| 429 | Too Many Requests: retry after N | Rate 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 alanguage_coderemoves 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
- getMyName — read the current bot name
- setMyDescription — change the bot's description
- setMyShortDescription — change the short description shown on profile page
- BotName — the return type of getMyName