Setting Up Telegram Notifications
Page Contents
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.
Create Telegram Bot With @BotFather
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.
Download Files From Github
Assumes you have Git and NodeJS installed.
cd into folder where you want the repo folder downloaded
Launch Telegram Bot On Heroku
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
Install the Heroku CLI (link)
verify installation with
heroku --versionheroku update// updates heroku CLIheroku loginpress 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 followsFind 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 mainmacOS 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 with
heroku 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:
URL is your Heroku Project URL (go to your Heroku account > project page > Settings > scroll down to Domains. It looks like https://tv-test-2-fdfas8b39b.herokuapp.com/)
To view logs, go to More (top right) > View logs to see bot status and logs
Test Setup
Test if the bot is up:
Be sure to add the TG_BOT_TOKEN and TG_CHAT_ID env vars in your server environment (see Setting Up Env Vars). 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.
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.
Last updated