OpenClaw Telegram Bot Setup Guide with API Credentials

安装这个技能 https://github.com/crazypeace/openclaw-skill-telethon-session
telethon-session skill instructions: install dependencies, configure .env, log in to generate .session

You can choose to let openclaw handle the entire process with full permissions, so you will input api_id, api_hash, phone number, 2FA
This information will be exposed to the LLM model
api_id:
58192647
api_hash:
7c4a91f2d8be63a0ef54c7b129ad806e
phone number:
+86 186 1234 5678
openclaw-control-ui message view showing api_id, api_hash and phone number

Telegram notification with login code and new device login alert

Telegram Privacy and Security screen highlighting Two-Step Verification

Then you can read messages and send messages.
openclaw-control-ui reading a Telegram chat and sending a test message


* At the very beginning when installing the Python environment, openclaw may prompt you that elevated permissions are insufficient. You can set permissions so roughly like this
Set the configuration file
tools.exec.ask = off
tools.exec.security = full
Restart gateway


========

If your openclaw just refuses to install the Python environment, you must do it yourself. (I don't know why, but I've encountered it many times)

Or you don't want to expose information like api_id, api_hash, phone number, 2FA to the LLM model, 

Then, you can also run the script yourself in the SSH session command line. Refer to the contents of the SKILL.md file


Input api id, api hash, phone number, these will only be saved as system variables and not directly exposed to the LLM

The 2FA input will not be saved. In the future, reading messages and sending messages will only use the .session file.

Just like this:

OpenClaw terminal installing Telethon and running setup_env script

Terminal running login script, Telegram login code shown with 2FA password noted

After the .session file is generated, you can read and send messages within openclaw.

Just like the following

读取与 telegram @crazypeace 的对话记录
向 telegram @crazypeace 发送以下信息
test from openclaw 2026-3-30 15:57
openclaw-control-ui showing the last 5 messages with @crazypeace

========

End


========
update
openclaw v2026.4.1  Open permissions
Modify ~/.openclaw/exec-approvals.json
"defaults": {
  "security": "full",
  "ask": "off",
  "askFallback": "full",
  "autoAllowSkills": true
},
exec-approvals.json contents with defaults highlighted in yellow and the part to add outlined in red


========

Also want to see

《Openclaw uses multi-Agent collaboration to complete tasks in topic-based Telegram groups》

《Telegram antispam bot related functions - Kick out users without speaking permission who are not in the group Exceptions list》

《Telegram antispam bot related functions - Query all members in the group, compare ChannelParticipantsBanned and ChannelParticipantBanned》


Comments