{"id":22191285,"url":"https://github.com/dunderrrrrr/unifi-telegram-notifi","last_synced_at":"2026-05-01T10:32:24.404Z","repository":{"id":189505200,"uuid":"353080359","full_name":"dunderrrrrr/UniFi-Telegram-NotiFi","owner":"dunderrrrrr","description":"Get notified on Telegram if a new or unknown client connects to your UniFi network","archived":false,"fork":false,"pushed_at":"2025-03-05T22:50:39.000Z","size":17,"stargazers_count":2,"open_issues_count":5,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-24T20:43:31.693Z","etag":null,"topics":["flask","jinja2","monitoring","network-monitoring","notifications","pip","python","sqlite3","telegram","telegram-bot","telegram-bot-api","ubiquiti","unifi","unifi-api","unifi-controller"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dunderrrrrr.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2021-03-30T17:10:16.000Z","updated_at":"2024-05-18T08:25:37.000Z","dependencies_parsed_at":"2023-08-20T14:54:24.996Z","dependency_job_id":null,"html_url":"https://github.com/dunderrrrrr/UniFi-Telegram-NotiFi","commit_stats":null,"previous_names":["dunderrrrrr/unifi-telegram-notifi"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/dunderrrrrr/UniFi-Telegram-NotiFi","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunderrrrrr%2FUniFi-Telegram-NotiFi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunderrrrrr%2FUniFi-Telegram-NotiFi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunderrrrrr%2FUniFi-Telegram-NotiFi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunderrrrrr%2FUniFi-Telegram-NotiFi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dunderrrrrr","download_url":"https://codeload.github.com/dunderrrrrr/UniFi-Telegram-NotiFi/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dunderrrrrr%2FUniFi-Telegram-NotiFi/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32494270,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"online","status_checked_at":"2026-05-01T02:00:05.856Z","response_time":64,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["flask","jinja2","monitoring","network-monitoring","notifications","pip","python","sqlite3","telegram","telegram-bot","telegram-bot-api","ubiquiti","unifi","unifi-api","unifi-controller"],"created_at":"2024-12-02T12:15:17.371Z","updated_at":"2026-05-01T10:32:24.369Z","avatar_url":"https://github.com/dunderrrrrr.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"![screenshot](https://i.imgur.com/Dkc5LdK.png \"screenshot\")\r\n\r\n# UniFi Telegram NotiFi\r\nGet notified on Telegram if a new or unknown client connects to your network.\r\n\r\n# How it works\r\n`update.py` makes API requests to your controller and is querying `https://yourcontroller:8443/api/s/default/stat/sta` which contains a list of all _active_ clients on the site. These clients are stored in a sqlite3 database, `db/sqlite.db`. When the script discovers a new client not already stored in the database, a [Telegram](https://telegram.org/) message will be sent to you with all available client data. If you choose to delete a client it will be removed from the database. If the client reconnects you'll be notified again.\r\n\r\nThis script has been tested on UniFi Controller version 6.1.71, installed on Ubuntu 20.04 but will probably work with other versions aswell.  \r\n\r\n[API Documentation](https://ubntwiki.com/products/software/unifi-controller/api)  \r\n[Screenshot](https://i.imgur.com/Dkc5LdK.png)  \r\n[Install Ubiquiti Unifi Controller on Ubuntu 20.04](https://gist.github.com/dunderrrrrr/67fa6b11c6ba0048ddc16b0cd3d8089f)  \r\n\r\n# Installation\r\n1. Clone this repo, create [virtualenv](https://gist.github.com/dunderrrrrr/c3a6d5cba1b7320d6835b0fe995f5e6b) (optional but recommended) and install requirements. Also create log folder.\r\n```\r\n$ mkvirtualenv unifi-monitor\r\n$ pip install -r requirements.txt\r\n$ sudo mkdir /var/log/unifi-telegram-notifi\r\n```\r\n2. Copy `settings.sample.py` and edit settings.\r\n```\r\n$ cp settings.sample.py settings.py\r\n```\r\n3. Create database\r\n```\r\n$ python database.py\r\n```\r\n4. Insert existing clients to database. You can choose if you want a Telegram message for each client or not. If you have alot of clients connected it's recommended to apply the notelegram parameter (or you will recieve alot of messages)\r\n```\r\n$ python update.py\r\n$ python update.py --notelegram\r\n```\r\n5. The database should now be created and there should also be data inserted. You can now run the webgui.\r\n```\r\n$ python web.py\r\n```\r\nThe webserver is listening by default on `http://serverip:5000`.  \r\nIf everything looks fine you should schedule a cronjob triggering `update.py`.\r\n```\r\n$ sudo crontab -e\r\n```\r\n```\r\n* * * * * /home/user/virtualenvs/virtualenv_name/bin/python3.8 /home/user/path/unifi-telegram-notifi/update.py \u003e\u003e /var/log/unifi-telegram-notify/cron.log 2\u003e\u00261\r\n```\r\n# Telegram settings\r\nMessage [@Botfather](https://telegram.me/botfather) on Telegram and set up your bot. Make sure you save your token.\r\n\r\nTo get your Group ID (needs to be set in `settings.py`):  \r\n1. When your bot is created, send a random message to your bot.  \r\n2. Visit `https://api.telegram.org/bot\u003cYourBOTToken\u003e/getUpdates`.  \r\n3. Use the \"id\" of the \"chat\" object to send your messages.  \r\n\r\nMore information: [https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id](https://stackoverflow.com/questions/32423837/telegram-bot-how-to-get-a-group-chat-id)  \r\nPull requests are welcome.\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunderrrrrr%2Funifi-telegram-notifi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdunderrrrrr%2Funifi-telegram-notifi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdunderrrrrr%2Funifi-telegram-notifi/lists"}