Setting Up Telegram Notifications
Last updated
Last updated
Here, you will create your own Telegram bot, which will receive notifications of successful or failed trades from the Trading View alert. The trading function of the Bot is not fully finished. For now, you can trade Spot Binance tickers on the Binance Testnet.
Add @BotFather to Telegram
Send message "/newbot"
Enter a name (this appears as the name in bold in your list of Telegram chats)
Enter a username (this appears after the "@")
You will be given an access token
Store it somewhere safe. The token can be used to take full control of your bot.
Assumes you have Git and NodeJS installed.
cd into folder where you want the repo folder downloaded
Upload files to Heroku
Create a Heroku account
Create a new app on Heroku
Go to New (top right) > Create new app
Enter a name, choose region, and click Create app
verify installation with heroku --version
heroku update
// updates heroku CLI
heroku login
press any key to continue
Web browser should popup prompting login
cd into the "telegram-trading-bot" folder
git remote add heroku <yourHerokuGitURL>
// adds a remote called "heroku", which is an alias for the URL that follows
Find the HTTPS URL in the your Heroku account > project page > Settings tab (top center). Look in the App Information category for the Heroku git URL. It looks like https://git.heroku.com/example-app.git
git remote -v
// check if remote is added
push files to Heroku git URL with git push heroku main
macOS may show a prompt for additional authentication. If so, type "blank" into username field and enter API Key into the password field. You can generate API Key withheroku auth:token
Code is uploaded if you see various logs appearing for 10-15s
Set environment variables
In your Heroku account, go to Settings > Config Vars > click Reveal Config Vars
Enter the environment variables:
To view logs, go to More (top right) > View logs to see bot status and logs
Test if the bot is up:
Test notifications:
Every time you make a successful or failed trade with the Trading View alert bot, a message should show. Use sendAlert.js or a real Trading View alert to make a trade.
Test trading features:
The "trading" features on the Telegram bot is only experimental. So far, you can only do trades on Binance Testnet. Add your Binance Testnet API keys into Heroku. Then enter "/start" and follow the keyboard buttons to make a market buy order of 100 DOGE, using USDT as the quote token.
git clone
Install the Heroku CLI ()
URL is your Heroku Project URL (go to your Heroku account > project page > Settings > scroll down to Domains. It looks like )
Be sure to add the TG_BOT_TOKEN and TG_CHAT_ID env vars in your server environment (see ). On your Telegram App, search for and start talking to the Telegram bot. To test if the bot is up, send a "/start" message. A menu should appear.