setBusinessAccountBio
Returns: TrueOfficial docs ↗
Changes the bio of a managed business account. Requires the can_change_bio business bot right. Returns True on success.
Parameters
business_connection_idStringRequiredUnique identifier of the business connection
bioStringOptionalminLen 0maxLen 140The new value of the bio for the business account; 0-140 characters
Returns
On success, True is returned.
GramIO Usage
ts
// Set the bio when a business connection is established
bot.on("business_connection", async (ctx) => {
if (ctx.canEditBio && ctx.isEnabled) {
await bot.api.setBusinessAccountBio({
business_connection_id: ctx.id,
bio: "Your trusted assistant — available 24/7. Reply within minutes.",
});
}
});ts
// Update bio from within a business message handler
bot.on("business_message", async (ctx) => {
if (ctx.text === "/setbio" && ctx.businessConnectionId) {
await bot.api.setBusinessAccountBio({
business_connection_id: ctx.businessConnectionId,
bio: "Automated replies powered by GramIO.",
});
await ctx.send("Bio updated!");
}
});ts
// Clear the bio by omitting it (or passing an empty string)
await bot.api.setBusinessAccountBio({
business_connection_id: "your_business_connection_id",
// bio omitted — clears the current bio
});Errors
| Code | Error | Cause |
|---|---|---|
| 400 | Bad Request: bio is too long | bio exceeds 140 characters — truncate before sending |
| 400 | Bad Request: BUSINESS_CONNECTION_INVALID | The business_connection_id is invalid or the connection was revoked — re-fetch from the business_connection event |
| 403 | Forbidden: not enough rights | Bot lacks the can_change_bio business right — check ctx.canEditBio before calling |
| 429 | Too Many Requests: retry after N | Rate limit hit — check retry_after field, use auto-retry plugin |
TIP
Use GramIO's auto-retry plugin to handle 429 errors automatically.
Tips & Gotchas
- Bio limit is 140 characters. Count carefully — Unicode characters like emoji count as multiple characters in some contexts; always validate on the bot side before calling.
- Omitting
bioclears it. To remove the current bio, omit thebiofield entirely or pass an empty string. - Check
canEditBiobefore calling. The bot must have thecan_change_biobusiness right granted by the account owner. Calling without this right returns a 403 error. business_connection_idmust be current. Store the connection ID when handlingbusiness_connectionevents (ctx.id). Inbusiness_messagehandlers, usectx.businessConnectionId.- Connection can be revoked. Business owners can revoke bot access at any time. Handle
BUSINESS_CONNECTION_INVALIDgracefully and stop operations for that connection.
See Also
- setBusinessAccountName — change the business account's display name
- setBusinessAccountUsername — change the business account's username
- setBusinessAccountProfilePhoto — change the profile photo
- BusinessConnection — business connection object with rights (
canEditBio,isEnabled, etc.)