Connect your Telegram bot to OE Runtime and automate message monitoring and notifications. The agent reads recent bot updates, summarises incoming messages, and sends AI-composed notifications back to any chat — all from a single YAML file with no code.
/newbot and follow the prompts to name your bot123456789:ABCdef...)https://api.telegram.org/bot<TOKEN>/getUpdates in a browser — look for message.chat.id in the responseCreate a file called agent.yaml inside a telegram/ directory:
name: Telegram Notifier description: Read recent Telegram messages and send a summary notification instructions: | You are a Telegram bot agent. Read recent updates from the bot and send notification messages. Always confirm the bot is connected before reading messages. Complete all steps fully before writing your report. steps: - name: Verify Bot Connection content: | Call the Telegram connector: GET /getMe Note the bot username, id, and display name to confirm the connection is working. - name: Read Recent Updates content: | Call the Telegram connector: GET /getUpdates with params: { "limit": "10", "allowed_updates": "message" } For each message note: chat_id, from username, message text, and date. Remember the chat_id from the most recent message — you will use it to send the reply. If no updates are found, note that the bot has no recent messages and skip the next step. - name: Send Summary Notification content: | Compose a brief summary of the recent messages. Use the chat_id from the most recent update (from Step 2). Send it via the Telegram connector: POST /sendMessage with body: { "chat_id": <chat_id from Step 2>, "text": "<your summary message>", "parse_mode": "Markdown" } - name: Report content: | Summarize what was done: - Bot name and username confirmed - Number of recent messages read - Summary of message content - Notification sent to chat_id (confirm with message_id returned) connectors: - connection_name: My Telegram Bot connection_type: telegram
Create oe-config.json in the same directory. The Telegram Bot Token is embedded directly in the baseUrl — no separate auth header is required:
{
"llm": {
"provider": "openai",
"model": "gpt-4o",
"apiKey": "YOUR_OPENAI_API_KEY"
},
"server": {
"enabled": false,
"port": 3333,
"apiKey": "your-secret-api-key"
},
"connectors": [
{
"connection_name": "My Telegram Bot",
"connection_type": "telegram",
"baseUrl": "https://api.telegram.org/botYOUR_BOT_TOKEN"
}
]
}Replace YOUR_BOT_TOKEN with the token from BotFather. The token becomes part of the URL — this is how the Telegram Bot API authenticates requests.
# Run the agent (pass your chat_id as a param) oe-runtime-win.exe telegram/agent.yaml --config telegram/oe-config.json
# Make executable (first time only) chmod +x oe-runtime-macos # Run the agent oe-runtime-macos telegram/agent.yaml --config telegram/oe-config.json
# Make executable (first time only) chmod +x oe-runtime-linux # Run the agent oe-runtime-linux telegram/agent.yaml --config telegram/oe-config.json
macOS Gatekeeper: On first run, macOS may block the binary. Go to System Settings → Privacy & Security → click "Allow Anyway" next to oe-runtime-macos.
No chat_id needed: The agent reads the chat_id automatically from the most recent message in getUpdates. Just send any message to your bot before running the agent and it will reply to that chat.
Add --serve to start OE Runtime as an HTTP server on port 3333:
oe-runtime-win.exe --serve --config telegram/oe-config.json
Then trigger the agent via API:
curl -X POST http://localhost:3333/run \
-H "Content-Type: application/json" \
-d '{"yaml": "telegram/agent.yaml", "params": {}}'Download OE Runtime and run any AI agent locally or as a server — no cloud required.
Get OE Runtime →