Automated IPO application system for MeroShare (https://meroshare.cdsc.com.np) using Playwright.
Example of IPO notification received on Telegram with company details and verification status
- Logs in to MeroShare with your credentials
- Navigates to "My ASBA" page
- Scans for IPOs - Only processes Ordinary Shares (ignores Mutual Funds, etc.)
- Verifies details before applying:
- Share Value Per Unit = 100
- Min Unit = 10
- Applies automatically if criteria met:
- Fills form (Bank, Account, Kitta, CRN)
- Enters Transaction PIN
- Submits application
- Sends Telegram notifications:
- ✅ Success: IPO applied
⚠️ Needs Review: IPO open but didn't meet criteria- ❌ No IPO: Nothing available
-
Install dependencies:
npm install
-
Install Playwright browsers:
npx playwright install chromium
-
Create
.envfile in the project root:# MeroShare Credentials MEROSHARE_USERNAME=your_username MEROSHARE_PASSWORD=your_password MEROSHARE_DP_NP=your_depository_participant # IPO Application Settings MEROSHARE_BANK=your_bank_name MEROSHARE_P_ACCOUNT_NO=your_account_number MEROSHARE_KITTA_N0=10 MEROSHARE_CRN_NO=your_crn_number MEROSHARE_TXN_PIN=your_4_digit_pin # Telegram Bot (for notifications) TELEGRAM_BOT_TOKEN=your_telegram_bot_token TELEGRAM_CHAT_ID=your_telegram_chat_id
-
Setup Telegram Bot:
- Create a bot by messaging @BotFather on Telegram
- Get your bot token
- Get your chat ID by messaging @userinfobot
- Alternative: Get Chat ID programmatically (if the above doesn't work):
import requests import json your_token = "XYZ" # Let's get your chat id! Be sure to have sent a message to your bot. url = 'https://api.telegram.org/bot'+str(your_token)+'/getUpdates' response = requests.get(url) myinfo = response.json() if response.status_code == 401: raise NameError('Check if your token is correct.') try: CHAT_ID: int = myinfo['result'][1]['message']['chat']['id'] print('This is your Chat ID:', CHAT_ID) except: print('Have you sent a message to your bot? Telegram bot are quite shy 🤣.')
- Add both to your
.envfile
# Run automation (headless)
npm run automate
# Run with browser visible
npm run automate:headedThe project includes a GitHub Actions workflow that runs automatically at 9:00 AM Nepal Time daily.
You can set up the required secrets manually or using the provided Infrastructure as Code (OpenTofu/Terraform) configuration.
Go to: Settings → Secrets and variables → Actions → New repository secret
Add these secrets:
MEROSHARE_USERNAMEMEROSHARE_PASSWORDMEROSHARE_DP_NPMEROSHARE_BANKMEROSHARE_P_ACCOUNT_NOMEROSHARE_KITTA_N0MEROSHARE_CRN_NOMEROSHARE_TXN_PINTELEGRAM_BOT_TOKENTELEGRAM_CHAT_ID
If you want to manage secrets as code, use the infra/ folder:
-
Create a GitHub PAT: Generate a Personal Access Token with
repopermissions. -
Configure Variables: Create
infra/<example_secret>.tfvars:PAT = "your_github_pat" example_secret = { MEROSHARE_USERNAME = "..." MEROSHARE_PASSWORD = "..." # ... add all other secrets here ... }
-
Deploy:
cd infra tofu init tofu apply -var-file="<example_secret>.tfvars"
(Note: You can use
terraforminstead oftofuif you prefer.)Important: Never commit
example_secret.tfvars,terraform.tfstate, orterraform.tfstate.backupfiles as they contain plain-text secrets.
├── tests/meroshare/
│ ├── login.spec.js # Main test orchestration
│ └── helpers/
│ ├── index.js # Central export
│ ├── login.js # DP selection & authentication
│ ├── navigation.js # My ASBA navigation
│ ├── asba.js # IPO detection & verification
│ ├── ipo.js # Form filling & submission
│ ├── telegram.js # Notifications
│ └── common.js # Utilities
├── .github/workflows/
│ └── meroshare-automation.yml
├── playwright.config.js
├── .env
└── package.json
- ✅ Auto-login with DP selection
- ✅ Ordinary Shares detection (filters out Mutual Funds)
- ✅ Share verification (Value Per Unit & Min Unit)
- ✅ Auto-fill IPO application form
- ✅ Telegram notifications
- ✅ GitHub Actions scheduled automation
- ✅ Element-based waits (reliable)