setChatDescription
Returns: TrueOfficial docs ↗
Use this method to change the description of a group, a supergroup or a channel. The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights. Returns True on success.
Parameters
chat_idIntegerStringRequiredUnique identifier for the target chat or username of the target channel (in the format
@channelusername)descriptionStringOptionalminLen 0maxLen 255New chat description, 0-255 characters
Returns
On success, True is returned.
GramIO Usage
ts
// Set a description for a channel or supergroup
await bot.api.setChatDescription({
chat_id: "@mychannel",
description: "The official GramIO community — TypeScript Telegram bot framework.",
});ts
// Clear the description by omitting the field (or passing an empty string)
await bot.api.setChatDescription({
chat_id: -1001234567890,
// description omitted → clears existing description
});ts
// From a message context — update the current chat's description
bot.command("setdesc", async (ctx) => {
const newDesc = ctx.text?.split(" ").slice(1).join(" ") ?? "";
await ctx.setChatDescription(newDesc);
await ctx.send("Description updated!");
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: chat not found | Invalid or inaccessible chat_id |
| 400 | Bad Request: chat description is not modified | The new description is identical to the current one |
| 400 | Bad Request: CHAT_ABOUT_TOO_LONG | description exceeds 255 characters |
| 403 | Forbidden: not enough rights to change chat description | Bot lacks the can_change_info admin right |
| 403 | Forbidden: bot is not a member of the channel chat | Bot was removed from the channel |
Tips & Gotchas
can_change_inforight is required. The bot must be an admin with thecan_change_infoflag set totrue. Without it, the call returns403 not enough rights.- Groups, supergroups, and channels only. Private chats do not support a description field; this method will error on them.
- Omitting
descriptionclears it. Passingdescription: ""or simply not including the parameter removes the current description — useful for resetting it. - 255-character limit. Anything longer returns
CHAT_ABOUT_TOO_LONG. Trim before calling if the source is user-provided text. - Context shorthand is
ctx.setChatDescription(description). Available inMessageContextand other contexts withChatControlMixin;chat_idis inferred automatically.
See Also
setChatTitle— change the chat namesetChatPhoto— change the chat photogetChat— read current description and other chat infoChatFullInfo— type returned bygetChatcontaining thedescriptionfield