A lightweight, reliable webhook server that receives TradingView alerts and instantly forwards them to Telegram as clean, plain-text messages.
- Instant Delivery — Alerts arrive in Telegram within seconds
- Flexible Input — Accepts both JSON and plain text from TradingView
- Variable Preservation — All TradingView placeholders (
{{ticker}},{{close}}, etc.) work perfectly - Clean Messages — Plain text only, no charts or link previews
- Easy Deployment — One-click deploy to Railway, Render, or any VPS
- Health Monitoring — Built-in endpoints for status checks
- Open Telegram and message @BotFather
- Send
/newbotand follow the prompts - Copy your Bot Token
- Message your new bot (required to enable messaging)
- Message @userinfobot on Telegram
- Copy the Chat ID it returns
- Click the button above or go to railway.app
- Connect your GitHub repo
- Add environment variables:
Variable Value TELEGRAM_BOT_TOKENYour bot token from BotFather TELEGRAM_CHAT_IDYour chat ID - Deploy and copy your public URL
- Open any chart on TradingView
- Create an alert (press
Alt+A) - In Notifications, enable Webhook URL
- Enter:
https://your-app.up.railway.app/webhook - Set your message template (see below)
🚨 {{ticker}} @ {{close}}
{{interval}} timeframe
{
"ticker": "{{ticker}}",
"exchange": "{{exchange}}",
"price": "{{close}}",
"interval": "{{interval}}",
"message": "🚨 {{ticker}} alert triggered at ${{close}}"
}{
"ticker": "{{ticker}}",
"action": "{{strategy.order.action}}",
"price": "{{strategy.order.price}}",
"contracts": "{{strategy.order.contracts}}",
"message": "{{strategy.order.comment}}"
}| Placeholder | Description |
|---|---|
{{ticker}} |
Symbol (e.g., BTCUSDT) |
{{exchange}} |
Exchange name |
{{close}} |
Current/trigger price |
{{open}} |
Open price |
{{high}} |
High price |
{{low}} |
Low price |
{{volume}} |
Volume |
{{time}} |
Alert trigger time |
{{interval}} |
Timeframe (1m, 1h, 1D) |
{{strategy.order.action}} |
buy/sell |
{{strategy.order.price}} |
Order price |
{{strategy.order.contracts}} |
Position size |
{{strategy.order.comment}} |
Order comment |
| Endpoint | Method | Description |
|---|---|---|
/ |
GET | Basic health check |
/health |
GET | Detailed status with config info |
/webhook |
POST | Main endpoint for TradingView alerts |
/test |
POST | Send a test message to Telegram |
# Clone the repo
git clone https://github.com/YOUR_USERNAME/tradingview-telegram-webhook.git
cd tradingview-telegram-webhook
# Create virtual environment
python -m venv venv
source venv/bin/activate # Windows: venv\Scripts\activate
# Install dependencies
pip install -r requirements.txt
# Configure environment
cp .env.example .env
# Edit .env with your credentials
# Run server
uvicorn main:app --reload --port 5000docker build -t tv-webhook .
docker run -d -p 8000:8000 \
-e TELEGRAM_BOT_TOKEN=your_token \
-e TELEGRAM_CHAT_ID=your_chat_id \
tv-webhookAdd WEBHOOK_SECRET environment variable for additional security:
WEBHOOK_SECRET=your_random_secret_key| Issue | Solution |
|---|---|
| No messages in Telegram | Verify bot token & chat ID. Make sure you messaged the bot first. |
| 401 Unauthorized | Bot token is incorrect |
| 400 Bad Request | Chat ID is wrong. Use /getUpdates to find correct ID |
| TradingView alerts not working | Webhook requires TradingView Pro or higher |
MIT License — feel free to use for personal and commercial projects.
Pull requests are welcome! For major changes, please open an issue first.
⭐ Star this repo if it helped you!