Incoming Webhook to telegram message
 
 
Go to file
Danyway b4aae3cc82
Update README.md
README.MD formatting : IPs
2022-02-01 00:12:55 +01:00
.github Updated stale.yml 2021-06-22 14:46:33 +02:00
assets Beautified code 2021-06-22 14:34:31 +02:00
service Add files via upload 2022-02-01 00:03:46 +01:00
.gitignore Initial commit 2020-04-21 16:05:31 +02:00
Dockerfile Minor updates 2021-08-05 07:02:06 +02:00
LICENSE Minor updates 2021-03-14 09:24:07 +01:00
README.md Update README.md 2022-02-01 00:12:55 +01:00
config.py Update config.py 2021-12-17 00:41:37 +01:00
docker-compose.yml Minor updates 2021-08-05 07:02:06 +02:00
handler.py Fixed underscore issue in msg body 2021-08-13 14:58:40 +02:00
main.py Beautified code 2021-06-22 14:34:31 +02:00
requirements.txt Beautified code 2021-06-22 14:34:31 +02:00

README.md

Python version GitHub license GitHub issues GitHub pull requests
GitHub stars GitHub forks GitHub watchers

AboutFeaturesInstallationImagesHelp

About

The TradingView Webhook Bot ⚙️ listens to TradingView alerts via webhooks using flask. All alerts can be instantly sent to Telegram, Discord, Twitter and/or Email.

Features

  • Telegram Support using the Python Telegram libary
  • Discord Support using webhooks
  • Slack Support using webhooks
  • Twitter Support using the tweepy libary
  • Email Support using smtplib
  • Alert channels can be enabled or disabled in config.py
  • Dynamically send alerts to different Telegram and/or Discord channels
  • TradingView {{close}}, {{exchange}} etc. variables support. Read more here

💡 Got a feature idea? Open an issue and I might implement it.

Installation

On any VPS

  1. Clone this repository git clone https://github.com/fabston/TradingView-Webhook-Bot.git
  2. Create your virtual environment python3 -m venv TradingView-Webhook-Bot
  3. Activate it source TradingView-Webhook-Bot/bin/activate && cd TradingView-Webhook-Bot
  4. Install all requirements pip install -r requirements.txt
  5. Edit and update config.py
  6. The Telegram ID should be set as an integer, but in some cases it is needed to define it as a sting, and to set the Channel name (@MyChannel) insteed of the Channel ID (-1001277977502).
  7. Setup TradingView alerts. An example alert message would be:
    {
     "key": "9T2q394M92",
     "telegram": "-1001277977502",
     "discord": "789842341870960670/BFeBBrCt-w2Z9RJ2wlH6TWUjM5bJuC29aJaJ5OQv9sE6zCKY_AlOxxFwRURkgEl852s3",
     "slack": "T00000000/B00000000/XXXXXXXXXXXXXXXXXXXXXXXX",
     "msg": "Long *#{{ticker}}* at `{{close}}`"
    }
    
    • key is mandatory! It has to match with sec_key in config.py. It's an extra security measurement to ensure nobody else is executing your alerts
    • telegram, discord, slack is optional. If it is not set it will fall back to the config.py settings
    • msg can be anything. Markdown for Telegram and Discord is supported as well
      • TradingViews variables like {{close}}, {{exchange}} etc. work too. More can be found here
    • Your webhook url would be http://<YOUR-IP>/webhook
  8. If you use a firewall be sure to open the corresponding port
  9. TradingView POST Request are made from the bellow IP Source - Ref : https://www.tradingview.com/?solution=43000529348
  • 52.89.214.238
  • 34.212.75.30
  • 54.218.53.128
  • 52.32.178.7

Run manually the bot with python main.py

Create a service

  1. Create a /root/startbot.sh

  2. Create a directory for logs : mkdir /root/TradingView-Webhook-Bot/logs

  3. Create a service file : /etc/systemd/system/telegrambotservice.service

  4. Start the service : systemctl start telegrambotservice.service

  5. You can stop or check the status of the service with the command bellow

  6. systemctl stop telegrambotservice.service

  7. systemctl status telegrambotservice.service

Docker

  1. Clone this repository git clone https://github.com/fabston/TradingView-Webhook-Bot.git
  2. Edit and update config.py
  3. docker-compose build
  4. docker-compose up

It is recommended to run flask on a different port like 8080. It is then necessary to forward port 80 to 8080.

Images

Webhook Bot

How can I help?

All kinds of contributions are welcome 🙌! The most basic way to show your support is to ⭐️ star the project, or raise 🐞 issues.


Buy Me A Coffee