This webhook receives alerts from TradingView and forwards them to a Telegram channel.
- Create a Telegram bot using @BotFather and get the bot token
- Add the bot to your Telegram group and get the chat ID
- Copy
.env.example
to.env
and fill in your bot token and chat ID - Install dependencies:
npm install
- Start the server:
npm start
Set up your TradingView alert with a webhook URL and the following JSON payload:
```json { "symbol": "{{ticker}}", "entry": "{{close}}", "stopLoss": "YOUR_STOP_LOSS", "takeProfit": "YOUR_TAKE_PROFIT" } ```
Deploy to any Node.js hosting platform (Heroku, DigitalOcean, Railway, etc.). Make sure to:
- Set environment variables (TELEGRAM_BOT_TOKEN and TELEGRAM_CHAT_ID)
- Use the provided webhook URL in your TradingView alerts
- Ensure your hosting platform supports incoming webhooks
You can test the webhook using curl:
```bash
curl -X POST http://localhost:3000/tradingview-webhook
-H "Content-Type: application/json"
-d '{"symbol":"GC","entry":"1920.50","stopLoss":"1910.00","takeProfit":"1935.00"}'
```