setChatTitle
Sets chat title.
Returns: On success, returns True.
Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
chat_id | Integer or String | Yes | Chat ID |
title | String | Yes | New title (1-128 characters) |
Example request
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setChatTitle" \
-H "Content-Type: application/json" \
-d '{"chat_id":123456789,"title":"Example"}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setChatTitle",
json={
"chat_id": 123456789,
"title": "Example"
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setChatTitle`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"chat_id": 123456789,
"title": "Example"
}),
});
console.log(await res.json());
Step-by-step guide: How to Create a Telegram Bot: Step by Step with BotFather and Python
Related methods
getChatGets chat information.getChatMemberGets chat member information.getChatMemberCountReturns the number of chat members.getChatAdministratorsReturns a list of chat administrators.setChatDescriptionSets chat description.setChatPhotoSets chat photo.deleteChatPhotoDeletes chat photo.setChatPermissionsSets chat permissions.leaveChatLeaves a chat.exportChatInviteLinkExports the main chat invite link.createChatInviteLinkCreates an invite link.editChatInviteLinkEdits an invite link.