MessengersTelegram

Telegram: Profiles and bots

Choose and configure personal-account and bot profiles in the Telegram CLI, including profile selection, defaults and separate login credentials.

Choose the right account or bot when you have more than one. This guide explains named profiles and their settings so a task runs with the intended account.

Choose an account or bot →

A profile is a name for one login of tg on this computer: a Telegram account or a bot, with its own session and its own settings. tg never picks one for you: a command that uses an account names its profile as the first word (tg personal chats list) or through TG_PROFILE, every time, even with only one account.

Read this page when you want a second account, want your AI agent to have fewer rights than you, or want to run a bot. At the end you know how to pick a profile for a command, how to give it its own settings, and how to switch to a bot.

What profiles let you do

You want toHow
Use two Telegram accounts on one computerLog in once per profile: tg work session start
Give your agent fewer rights than you haveA profile with its own permissions
Keep an agent on that one profileTG_PROFILE_LOCK (profiles in login and sessions)
Run a Telegram bot next to your accountA bot profile: tg support bot api get-me
See every profile on this computertg account list

Choose a profile

Put the profile name before the command:

tg work config show

tg account list shows every profile on this computer and the account each is logged in as; tg work session end logs the profile work out.

A setting under profiles.work in the config file applies to that profile; values under defaults apply when it has no value of its own. The rules for profile names, and the order in which tg picks a profile, are in profiles in login and sessions.

Profiles are not separate operating-system users: an agent with unrestricted file access can still reach other data on that computer.

Switch to a bot

Put bot after the profile name:

tg support bot api get-me --json

These commands need a bot profile that is already connected. The bot's account and rights come from Telegram, not from your personal account. A Telegram bot explains how to connect a bot, with examples.

Settings and access