Research9 min read

How to Send NSE/BSE Filing Alerts to Telegram

By Deion DSouza
NSE and BSE market filing alerts delivered to Telegram

You can send NSE and BSE filing alerts to Telegram without building the entire pipeline yourself. The open-source Drishti Telegram template connects to Drishti's near-live WebSocket streams, filters events to your watchlist, formats the data, and posts each notification to a private chat or Telegram channel.

The shortest working setup is: create a Telegram bot, add your Drishti and Telegram credentials to .env, choose symbols and streams in config.yaml, run the built-in check, and start the CLI. If the alerts need to arrive while your laptop is closed, run the process on a virtual private server (VPS) with a process supervisor.

Key takeaways

  • The template supports announcements, earnings, news, conference calls, block deals, and market alerts.
  • A normal setup follows a symbol watchlist. Full-market delivery requires the appropriate Drishti Scale entitlement.
  • The check command validates the configuration, account access, Telegram destination, and each WebSocket subscription before the notifier starts.
  • The process must stay online. Version 1 does not replay missed WebSocket events or store failed notifications in a durable queue.
  • A VPS is useful for an always-on notifier, but you are still responsible for server updates, credentials, monitoring, and recovery.

What the template does

The template is a Python command-line application built on the official Drishti SDK. It opens the selected Drishti WebSocket streams and forwards matching events to Telegram.

PartWhat it handles
config.yamlSymbols, enabled streams, detailed mode, and fields shown in Telegram
Drishti WebSocketsNear-live filing and market events for the configured products
FormatterReadable headings, IST timestamps, links, tables, and populated detail fields
Telegram Bot APIPrivate-chat or channel delivery, rate-limit cooldowns, and retries
check commandConfiguration, account entitlement, destination access, and subscription validation

The default example follows RELIANCE and TCS. It enables six products: news, block deals, announcements, earnings, conference calls, and alerts. You can disable everything except announcements if the only job is to receive NSE/BSE corporate filing alerts.

The application does not scrape exchange websites. Drishti is an independent API that receives data from licensed providers and exposes it through documented APIs and WebSockets.

How it works under the hood

The notifier has a small pipeline rather than one large script. At startup, it loads the API key, bot token, and Telegram destination from .env, then reads the watchlist and stream settings from config.yaml. Keeping credentials and routing rules separate means you can change symbols or message fields without putting a secret into the YAML file.

Before listening for filings, the CLI calls Drishti's /v1/account endpoint to confirm that the account is active and has access to every enabled WebSocket product. It also asks Telegram for the bot identity and destination details. For a channel, it checks that the bot is an administrator with permission to post. This is why check can catch a wrong chat ID or missing Drishti add-on before the live process starts.

Code
.env + config.yaml
        |
        v
Drishti account check + Telegram destination check
        |
        v
One managed WebSocket session
        |
        v
Announcement event -> 1-second batch -> Telegram formatter
        |
        v
Telegram sendMessage -> private chat or channel

The application opens one managed Drishti WebSocket session and sends a separate subscription for each enabled product. For this guide, that is the announcements product with the configured symbol list. The notifier waits for Drishti to acknowledge the accepted tier and watchlist before it begins forwarding data.

When a filing arrives, the event enters a one-second in-memory batch. The formatter selects the configured fields, removes null or empty values, converts timestamps to Indian Standard Time, escapes unsafe HTML, and builds a readable Telegram message. If the result exceeds Telegram's 4,096-character text limit, the template splits it into smaller messages before calling sendMessage.

Delivery is paced to one message per second for a destination. If Telegram responds with a rate limit, the client waits for Telegram's requested cooldown. Other temporary delivery errors use increasing retry delays. These retries live only in memory: a final failure is logged and discarded rather than stored for later delivery.

The Drishti SDK reconnects after a dropped socket and sends the subscriptions again. That restores future delivery, but it does not recover filings published while the connection was down. A production extension should query the REST announcements endpoint for the missing time window, discard IDs already processed, and then resume the live stream.

What you need before starting

Prepare these four items:

  1. Python 3.10 or newer.
  2. A Drishti API key with the WebSocket add-on for every stream you enable.
  3. A Telegram account and a bot token from the verified BotFather.
  4. A private Telegram chat or a channel where the bot is allowed to post.

Drishti Sandbox accounts do not include live WebSocket streams. Check the Drishti pricing page before choosing the streams and watchlist size. Telegram's official guide says a user must contact a bot before the bot can send a private message, so send /start to the new bot before looking up your chat ID.

1. Install the NSE/BSE Telegram alert template

Clone the repository and enter the template directory:

Code
git clone https://github.com/manasijatech/drishti-templates.git
cd drishti-templates/drishti-telegram-channel

Create a virtual environment and install the CLI:

Code
python3 -m venv .venv
source .venv/bin/activate
python -m pip install --upgrade pip
python -m pip install -e .

The repository README also provides PowerShell commands for Windows. The rest of this guide uses Linux commands because they match the later VPS setup.

2. Create the Telegram bot and get the chat ID

Open @BotFather, send /newbot, choose a display name, and choose a unique username ending in bot. Copy the token and keep it private. Telegram treats that token as the bot's credential.

Now open the new bot's chat and send /start. Create the local files:

Code
cp .env.example .env
cp config.example.yaml config.yaml

Add the credentials to .env, leaving the destination as pending for the moment:

Code
DRISHTI_API_KEY=your-drishti-api-key
TELEGRAM_BOT_TOKEN=your-telegram-bot-token
TELEGRAM_CHAT_ID=pending

Then ask the CLI to read recent Telegram updates and show the private chat IDs it can find:

Code
drishti-telegram --config config.yaml chat-id

Put the numeric result into TELEGRAM_CHAT_ID. Do not use your personal @username for a private chat.

To post to a Telegram channel instead, add the bot as a channel administrator, allow it to post messages, and use the public channel username such as @my_market_alerts. Telegram accepts a channel username as the chat_id for sendMessage when the bot has the required access.

3. Choose the companies and filing stream

For a filing-only watchlist, keep the configuration small:

Code
symbols:
  - RELIANCE
  - TCS

full_feed: false

streams:
  news:
    enabled: false
  block-deals:
    enabled: false
  announcements:
    enabled: true
    detailed: true
    fields: [symbol, company_name, summary, category, important, date]
  earnings:
    enabled: false
  concalls:
    enabled: false
  alerts:
    enabled: false

Use fields: ["*"] when you want every populated detailed field. A shorter list makes a busy channel easier to scan. The formatter omits null and empty values but keeps meaningful values such as false and 0.

Do not enable full_feed: true unless the account has full-feed access. For most personal and team workflows, a focused watchlist is easier to operate and produces fewer irrelevant notifications.

4. Validate the complete setup

Run the preflight check:

Code
drishti-telegram --config config.yaml check

This checks the YAML and environment variables, Drishti account status and WebSocket add-ons, Telegram destination, each configured subscription, and the acknowledged WebSocket tier. It does not send a test message.

Fix every reported error before starting the live process. Common failures are a missing .env, a bot that has not received /start, an inaccessible Telegram channel, or a stream enabled in config.yaml but not on the Drishti account.

5. Start sending filings to Telegram

Start the notifier:

Code
drishti-telegram --config config.yaml run

Keep the terminal open. A new matching event is formatted with its company, symbol, summary, category, importance flag, and Indian Standard Time timestamp, depending on the selected fields. Telegram messages are split at its 4,096-character text limit, links remain clickable, and sends are paced to avoid flooding one destination.

Start with two companies and the announcements stream. Once you have seen a complete filing reach the right chat, add more symbols or streams. For a REST-based history and recovery workflow, use the Python announcements guide. For category-specific monitoring, see the NSE/BSE order-win guide.

Run it continuously on a VPS

A laptop is fine for testing, but it is a poor home for an alert process that should run overnight or while you travel. The template only forwards events received while it is online. Putting it on a VPS gives the process an always-on machine and network connection; it does not add replay or a durable queue.

Hostinger VPS is one option for running the notifier. Hostinger describes its VPS as self-managed, with root access, firewall controls, a web terminal, and Linux operating-system templates. This is a referral link; the publisher may receive a referral reward or commission if you purchase through it. You can use another Linux VPS provider if you prefer.

On a fresh Ubuntu server, connect over SSH, install Python and Git, clone the repository, and repeat the virtual-environment and configuration steps above. Run check again on the server. Do not copy a working .env into a public repository or paste its contents into support messages.

For automatic restarts, create a systemd service. Replace ubuntu and the paths below with the account and directory used on your server:

Code
[Unit]
Description=Drishti filings to Telegram
Wants=network-online.target
After=network-online.target

[Service]
Type=simple
User=ubuntu
WorkingDirectory=/home/ubuntu/drishti-templates/drishti-telegram-channel
ExecStart=/home/ubuntu/drishti-templates/drishti-telegram-channel/.venv/bin/drishti-telegram --config /home/ubuntu/drishti-templates/drishti-telegram-channel/config.yaml run
Restart=always
RestartSec=5

[Install]
WantedBy=multi-user.target

Save it as /etc/systemd/system/drishti-telegram.service, then enable it:

Code
sudo systemctl daemon-reload
sudo systemctl enable --now drishti-telegram
sudo systemctl status drishti-telegram

This application makes outbound connections; it does not expose a public dashboard or listening port. Keep SSH restricted, apply operating-system updates, review service logs, and protect .env with filesystem permissions such as chmod 600 .env.

Know the delivery limits

The current template deliberately stays small. It has no REST catch-up, persistent queue, or deduplication database. Telegram sends are retried in memory; after the retry limit, a failed notification is logged and discarded. If the process or WebSocket is offline when an event is published, the template cannot replay that event later.

For a personal watchlist, that may be an acceptable starting point. For operational or customer-facing alerts, add a REST recovery window after downtime, persist provider event IDs, queue outbound messages, and monitor the service. The Drishti WebSocket guide explains the connection and replay boundary.

Build the first working alert

Clone the template, configure one or two symbols, enable only announcements, and send the output to a private Telegram chat. Once the check command passes and one real filing arrives, move the same setup to a VPS if you need it to stay online continuously.

The open-source Drishti Telegram template contains the complete setup instructions, configuration examples, tests, and troubleshooting table. Use it as the starting point instead of recreating the Telegram and WebSocket plumbing from scratch.

Keep exploring