@kody/telegram
Read Telegram chats the bot can see and send confirmed messages through the Bot API using telegramBotToken.
README.md
85 lines · 3.3 KB · Markdown@kody/telegram
Official Telegram paper-plane mark from telegram.org/img/t_logo.svg.
Intent
Provide reusable, account-agnostic Telegram Bot API helpers so Kody can read
updates and chats a bot can see, and send explicitly confirmed messages, using
a saved telegramBotToken — never Telegram Login Widget OAuth.
What it does
- Read bot identity (
getMe), chat metadata, webhook info, and polled updates - Preview or send messages with
dryRun/confirmguards - Escape-hatch
requestfor any Bot API method - Guide export with BotFather steps and the prefilled secret URL
Prerequisites / setup
Auth: bot token, not OAuth, not an API key
This package calls https://api.telegram.org/bot<token>/METHOD. That token is
created by @BotFather. It is not an OAuth access
token and not a user account password.
Do not connect https://kody.codes/connect/oauth?provider=telegram for this
package. That URL is Telegram Login Widget identity (openid / profile on
oauth.telegram.org) and cannot send or read Bot API messages.
Telegram Bot API has no OAuth scopes. What the bot can do is:
- chat membership (private chats require the user to send
/start) - admin rights in groups and channels
- BotFather privacy mode (
/setprivacy) for reading non-command group messages
If Telegram returns 401/403, the error names the missing access and the next setup step.
Required setup
- Open Telegram and message @BotFather.
- Send
/newbot(or/tokenfor an existing bot) and copy the token. Never paste the token into chat. - Save it in Kody and approve host
api.telegram.org:
- Send
/startto the bot in a private chat. Add the bot to groups you want it in. For channels, add it as an administrator. - To read all group messages (not just commands and replies), either:
- @BotFather →
/setprivacy→ Disable, or - make the bot a group administrator.
- @BotFather →
- Smoke-test (see
AGENTS.md).
Required host: api.telegram.org.
Additional bots
Default secret name is telegramBotToken. Pass
secretName: "telegramBotToken-<slug>" (lowercase letters and digits) for
another bot, and save that secret with the same host:
Mutation safety
Mutations never call Telegram when dryRun: true. Live sends require
confirm: true after the user explicitly approves the chat and text.
Agents: see AGENTS.md for import paths, smoke checks, confirm
guards, and error tables.
Done when
telegramBotTokenis saved; hostapi.telegram.orgis approved- Smoke test returns
ok: true(livegetMewithisBot: truewhen the token exists) - Sends refuse unless
confirm: true;dryRun: truenever posts
Branding
community-icon.svg is Telegram's official paper-plane mark from
telegram.org/img/t_logo.svg. Telegram is
a trademark of Telegram FZ-LLC. This package is not affiliated with or endorsed
by Telegram.