Trading View Automation
  • Introduction
  • Setting Up Local Server
    • Setting Up HashiCorp Vault + EthSigner
    • Setting Up HashiCorp Vault (dev) + EthSigner
  • Setting Up Google Cloud Run
    • Setting Up Google KMS
  • Setting Up Heroku
  • Setting Up Env Vars
  • Setting Up Trading View Alert
  • Testing With sendAlert.js
  • Setting Up Google Sheets
  • Setting Up Telegram Notifications
  • Using Tmux
  • Using Git
Powered by GitBook
On this page
  • Page Contents
  • Create Telegram Bot With @BotFather
  • Download Files From Github
  • Launch Telegram Bot On Heroku
  • Test Setup

Setting Up Telegram Notifications

PreviousSetting Up Google SheetsNextUsing Tmux

Last updated 6 months ago

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

  1. Add @BotFather to Telegram

  2. Send message "/newbot"

  3. Enter a name (this appears as the name in bold in your list of Telegram chats)

  4. Enter a username (this appears after the "@")

  5. You will be given an access token

    1. 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.

  1. cd into folder where you want the repo folder downloaded

Launch Telegram Bot On Heroku

  1. Upload files to Heroku

    1. Create a Heroku account

    2. Create a new app on Heroku

      1. Go to New (top right) > Create new app

      2. Enter a name, choose region, and click Create app

      1. verify installation with heroku --version

      2. heroku update // updates heroku CLI

      3. heroku login

        1. press any key to continue

        2. Web browser should popup prompting login

    3. cd into the "telegram-trading-bot" folder

    4. 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

    5. push files to Heroku git URL with git push heroku main

      1. 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

    6. Code is uploaded if you see various logs appearing for 10-15s

  2. Set environment variables

    1. In your Heroku account, go to Settings > Config Vars > click Reveal Config Vars

    2. Enter the environment variables:

      • PORT=8080
        BOT_TOKEN=
        URL=
        BINANCE_TESTNET_API_KEY=
        BINANCE_TESTNET_SECRET_KEY=
        GOOGLE_SHEET_ID=
  3. To view logs, go to More (top right) > View logs to see bot status and logs

Test Setup

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.

https://github.com/brianonchain/gaia-telegram-bot.git
link
https://tv-test-2-fdfas8b39b.herokuapp.com/
Setting Up Env Vars
Create Telegram Bot
Download Files From Github
Launch Telegram Bot On Heroku
Test Setup