Skip to content

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_idStringRequired
Unique identifier of the business connection
bioStringOptionalminLen 0maxLen 140
The 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

CodeErrorCause
400Bad Request: bio is too longbio exceeds 140 characters — truncate before sending
400Bad Request: BUSINESS_CONNECTION_INVALIDThe business_connection_id is invalid or the connection was revoked — re-fetch from the business_connection event
403Forbidden: not enough rightsBot lacks the can_change_bio business right — check ctx.canEditBio before calling
429Too Many Requests: retry after NRate 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 bio clears it. To remove the current bio, omit the bio field entirely or pass an empty string.
  • Check canEditBio before calling. The bot must have the can_change_bio business right granted by the account owner. Calling without this right returns a 403 error.
  • business_connection_id must be current. Store the connection ID when handling business_connection events (ctx.id). In business_message handlers, use ctx.businessConnectionId.
  • Connection can be revoked. Business owners can revoke bot access at any time. Handle BUSINESS_CONNECTION_INVALID gracefully and stop operations for that connection.

See Also