Credentials. The Telegram bot token must be kept in an environment variable and never committed to source control.
Who it is forA developer who wants a first working IM bot before building real agent logic.
The problemSetting up bot transport, parsing, and replies from scratch takes time before any agent logic can be tested.
The outcomeA running Telegram bot that replies to each message with an echo, showing the full inbound and outbound path.
What you need first
- Python 3.12+
- Credentials for each platform you connect, such as a Telegram bot token, Feishu app ID and secret, or a Discord bot token
- Access to the developer portal of each platform you use
- A processor function that reads InboundMessage and yields MessageEvent objects
Steps
- Run
pip install octop-gatewayin a Python 3.12+ environment. - Save the minimal echo bot example from the README as a Python file, and set the environment variable TELEGRAM_BOT_TOKEN to your bot token.
- Run the saved file with
python <your-file>.py. (inferred, check the README) - Send a text message to your Telegram bot and check that it replies with the text prefixed by 'Echo: '.
Prompt for your agent
Using the octop-gateway repo at TencentCloud/octop-gateway, install the core package and run the Telegram echo example with my bot token stored in TELEGRAM_BOT_TOKEN. Report whether the bot replies 'Echo: <message>' to a test message from <target chat>. Verify that the process stays running after startup.
Caveat. The README gives the Telegram example only; confirm your bot token and Python version before expecting a reply.
Use this in your AI agent
Ask your agent
Using the Deduped MCP, get the setup steps for TencentCloud/octop-gateway and "Run a working Telegram echo bot in under an hour"
Add Deduped to Claude Code once
claude mcp add --transport http deduped https://dedupedai.com/mcp
Every Monday: the 5 hottest repos and exactly how to use them. Free, one email a week, unsubscribe anytime.
Get them freeShare: X LinkedIn Hacker News Email Copy link
Third-party repos we don't own. AI-written use cases can be wrong. Disclaimer