Skip to content

getMe

A simple method for testing your bot's authentication token. Requires no parameters. Returns basic information about the bot in form of a User object.

Returns

On success, the User object is returned.

GramIO Usage

ts
// Verify the token and log the bot's identity
const 
me
= await
bot
.
api
.
getMe
();
console
.
log
(`Logged in as @${
me
.
username
} (ID: ${
me
.
id
})`);
ts
// Read bot-specific capability flags
const 
me
= await
bot
.
api
.
getMe
();
console
.
log
(`Username: @${
me
.
username
}`);
console
.
log
(`Can join groups: ${
me
.
can_join_groups
}`);
console
.
log
(`Privacy mode off: ${
me
.
can_read_all_group_messages
}`);
console
.
log
(`Supports inline: ${
me
.
supports_inline_queries
}`);
console
.
log
(`Business integration: ${
me
.
can_connect_to_business
}`);
console
.
log
(`Has main Web App: ${
me
.
has_main_web_app
}`);
ts
// Use getMe for a startup health check before launching
async function 
start
() {
const
me
= await
bot
.
api
.
getMe
();
console
.
log
(`Bot @${
me
.
username
} is ready`);
await
bot
.
start
();
}
start
();
ts
// Conditionally register inline query handler only if the bot supports it
const 
me
= await
bot
.
api
.
getMe
();
if (
me
.
supports_inline_queries
) {
bot
.
on
("inline_query", (
ctx
) =>
ctx
.
answer
([]));
}

Errors

CodeErrorCause
401Unauthorized: invalid token specifiedThe bot token is wrong or has been revoked — check BOT_TOKEN env var
429Too Many Requests: retry after NRate limit hit — check retry_after, use the auto-retry plugin

Tips & Gotchas

  • Call it once at startup, not repeatedly. getMe is useful for a one-time token validation and capability check. The returned data doesn't change at runtime — cache it rather than calling on every update.
  • Bot-specific fields are only present in getMe responses. Fields like can_join_groups, can_read_all_group_messages, supports_inline_queries, can_connect_to_business, and has_main_web_app are only returned by getMe — they are absent from User objects you receive in updates.
  • can_read_all_group_messages: true means privacy mode is disabled. By default bots only receive messages that mention them; disabling privacy mode lets the bot read all group messages. This is configured in @BotFather.
  • A failed getMe call is always a token problem. If this call throws 401 Unauthorized, the token is wrong or the bot was deleted. No other recovery is possible.
  • is_bot is always true. For the object returned by getMe, is_bot will always be true — you can use it to distinguish bots from regular users in other contexts.

See Also