setBusinessAccountProfilePhoto
设置商业账户头像。
返回值: 调用成功时返回 True。
参数
| 参数 | 类型 | 必填 | 说明 |
|---|---|---|---|
business_connection_id | String | 是 | 商业连接 ID |
photo | InputProfilePhoto | 是 | 头像(InputProfilePhoto) |
is_public | Boolean | 可选 | 公开头像——即使主头像被隐私设置隐藏也可见 |
请求示例
curl
curl -s -X POST "https://api.telegram.org/bot$TOKEN/setBusinessAccountProfilePhoto" \
-H "Content-Type: application/json" \
-d '{
"business_connection_id": "BUSINESS_CONNECTION_ID",
"photo": {
"type": "static",
"photo": "attach://photo"
}
}'
Python
import requests
TOKEN = "123456789:AAEexampleTokenReplaceWithYours"
resp = requests.post(
f"https://api.telegram.org/bot{TOKEN}/setBusinessAccountProfilePhoto",
json={
"business_connection_id": "BUSINESS_CONNECTION_ID",
"photo": {
"type": "static",
"photo": "attach://photo"
}
},
timeout=30,
)
print(resp.json())
JavaScript
const TOKEN = "123456789:AAEexampleTokenReplaceWithYours";
const res = await fetch(`https://api.telegram.org/bot${TOKEN}/setBusinessAccountProfilePhoto`, {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
"business_connection_id": "BUSINESS_CONNECTION_ID",
"photo": {
"type": "static",
"photo": "attach://photo"
}
}),
});
console.log(await res.json());
分步教程: Telegram 机器人教程:从零创建 Telegram 机器人并发送第一条消息
相关方法
getBusinessAccountStarBalance返回商业账户的 Stars 余额。getBusinessAccountGifts返回商业账户的礼物。transferBusinessAccountStars将 Stars 从商业账户转移到机器人余额。readBusinessMessage代表商业账户将收到的消息标记为已读。deleteBusinessMessages代表商业账户删除消息。setBusinessAccountName设置商业账户名称。setBusinessAccountUsername设置商业账户用户名。setBusinessAccountBio设置商业账户个人简介。removeBusinessAccountProfilePhoto移除商业账户头像。setBusinessAccountGiftSettings配置商业账户的礼物设置。