There are more and better projects to send detection alerts to Telegram. But sometimes one likes just to code.
This script should be ran in cron. For example every 5 minutes:
*/5 * * * * /location/elastic_alert.py
pip3 install -r requirements.txt
Create a .env file:
ELASTIC_HOST = ""
token = ""
chat_id = ""
api_key = ""
message_thread_id = ""
Check: From BotFather to 'Hello World'
I configured it to send messages to a Thread in a Telegram Group
- Connects to your Elastic
- Checks for open alerts in the last day
- Checks
processed_ids.txtto not repeat alerts - Sends alert