Back to articles
DocumentationSource: backend/agents/notes/telegram_bot_setup.md

AUTHOR: Tony Mudau

Telegram Bot Setup (Phone + Admin Panel)

This guide sets up one Telegram bot for:

  • agent status updates (orchestration + technical/execution summaries)
  • read-only Q&A with the agent assistant
  • manual market-news injection only when you intentionally prefix: market_agent:

1) Create your bot in Telegram (phone)

  1. Open Telegram on your phone.
  2. Search for @BotFather.
  3. Send /newbot.
  4. Follow prompts for bot name and bot username.
  5. Copy the bot token BotFather returns.

2) Start chat with your bot

  1. Search your new bot username.
  2. Open chat and send /start.
  3. Send any test message.

3) Get your Telegram chat ID

Use one of these:

  • Visit: https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates
  • Find your message payload and copy message.chat.id

If multiple admins should receive messages, collect each chat id.

4) Configure in Admin panel

Open the hidden admin page and go to:

  • Settings tab
  • Telegram integration section

Set:

  • Enable Telegram bot = ON
  • Bot token = token from BotFather
  • Allowed admin chat IDs = comma-separated chat IDs
  • Optional toggles:
    • cycle notifications
    • execution notifications
    • allow market_agent: ingest
    • allow assistant chat

Save settings.

5) Set Telegram webhook (required for inbound chat)

Use your backend public URL (must be reachable from Telegram, HTTPS):

https://<YOUR_BACKEND_HOST>/api/agent-force-1/telegram/webhook

Call Telegram API:

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/setWebhook?url=https://<YOUR_BACKEND_HOST>/api/agent-force-1/telegram/webhook

Verify:

https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getWebhookInfo

6) Message formats from Telegram

Read-only assistant Q&A (does NOT influence trading)

Send normal text, for example:

  • Why was EURUSD skipped today?
  • What is the latest execution result?

This uses the separate assistant endpoint and does not alter strategy/execution state.

Inject market news (allowed path to influence market analysis)

Use strict prefix:

market_agent: EURUSD CPI came in higher than expected and USD strengthened

Rules:

  • Must start with market_agent:
  • Include symbol + note
  • Only this path is ingested into market agent memory

7) Safety behavior implemented

  • Only chat IDs listed in admin settings are accepted.
  • Non-market_agent: messages are treated as Q&A only.
  • Q&A is read-only and cannot place/modify trades.
  • Market ingestion requires explicit market_agent: prefix.

8) Troubleshooting

  • No bot replies:
    • verify webhook is set and HTTPS is valid
    • ensure backend URL is reachable publicly
    • check allowed chat IDs in admin settings
  • No notifications:
    • ensure Telegram enabled and bot token is correct
    • ensure at least one allowed chat id is saved
    • run a cycle and confirm toggle settings
  • market_agent: ignored:
    • check exact prefix and symbol format (e.g., EURUSD)
    • ensure ingest toggle is enabled in admin settings