# ๐Ÿ“ฑ NTFY Push Notifications
**๐Ÿ”” Real-time push notifications to your devices** *Stay informed wherever you are*
--- ## ๐ŸŽฏ What is NTFY? NTFY is a **simple HTTP-based pub-sub notification service** that sends push notifications to your phone, desktop, or web browser. Perfect for real-time alerts about script events and errors. ### **Key Features** - ๐Ÿ“ฑ **Mobile & Desktop** โ€” Push to any device - ๐Ÿ†“ **Free & Open Source** โ€” No vendor lock-in - ๐Ÿ  **Self-hostable** โ€” Complete privacy control - โšก **Real-time delivery** โ€” Instant notifications - ๐Ÿ”’ **Authentication support** โ€” Secure topics ### **Official Links** - **Website** โ€” [ntfy.sh](https://ntfy.sh) - **Documentation** โ€” [docs.ntfy.sh](https://docs.ntfy.sh) - **GitHub** โ€” [binwiederhier/ntfy](https://github.com/binwiederhier/ntfy) --- ## โš™๏ธ Configuration ### **Basic Setup** ```json { "notifications": { "ntfy": { "enabled": true, "url": "https://ntfy.sh", "topic": "rewards-script", "authToken": "" } } } ``` ### **Configuration Options** | Setting | Description | Example | |---------|-------------|---------| | `enabled` | Enable NTFY notifications | `true` | | `url` | NTFY server URL | `"https://ntfy.sh"` | | `topic` | Notification topic name | `"rewards-script"` | | `authToken` | Authentication token (optional) | `"tk_abc123..."` | --- ## ๐Ÿš€ Setup Options ### **Option 1: Public Service (Easiest)** ```json { "notifications": { "ntfy": { "enabled": true, "url": "https://ntfy.sh", "topic": "your-unique-topic-name" } } } ``` **Pros:** - โœ… No server setup required - โœ… Always available - โœ… Free to use **Cons:** - โŒ Public server (less privacy) - โŒ Rate limits apply - โŒ Dependent on external service ### **Option 2: Self-Hosted (Recommended)** ```json { "notifications": { "ntfy": { "enabled": true, "url": "https://ntfy.yourdomain.com", "topic": "rewards", "authToken": "tk_your_token_here" } } } ``` **Self-Hosted Setup:** ```yaml # docker-compose.yml version: '3.8' services: ntfy: image: binwiederhier/ntfy container_name: ntfy ports: - "80:80" volumes: - ./data:/var/lib/ntfy command: serve ``` --- ## ๐Ÿ”’ Authentication ### **When You Need Auth** Authentication tokens are **optional** but required for: - ๐Ÿ” **Private topics** with username/password - ๐Ÿ  **Private NTFY servers** with authentication - ๐Ÿ›ก๏ธ **Preventing spam** on your topic ### **Getting an Auth Token** #### **Method 1: Command Line** ```bash ntfy token ``` #### **Method 2: Web Interface** 1. Visit your NTFY server (e.g., `https://ntfy.sh`) 2. Go to **Account** section 3. Generate **new access token** #### **Method 3: API** ```bash curl -X POST -d '{"label":"rewards-script"}' \ -H "Authorization: Bearer YOUR_LOGIN_TOKEN" \ https://ntfy.sh/v1/account/tokens ``` ### **Token Format** - Tokens start with `tk_` (e.g., `tk_abc123def456...`) - Use Bearer authentication format - Tokens are permanent until revoked --- ## ๐Ÿ“ฒ Receiving Notifications ### **Mobile Apps** - **Android** โ€” [NTFY on Google Play](https://play.google.com/store/apps/details?id=io.heckel.ntfy) - **iOS** โ€” [NTFY on App Store](https://apps.apple.com/app/ntfy/id1625396347) - **F-Droid** โ€” Available for Android ### **Desktop Options** - **Web Interface** โ€” Visit your NTFY server URL - **Desktop Apps** โ€” Available for Linux, macOS, Windows - **Browser Extension** โ€” Chrome/Firefox extensions ### **Setup Steps** 1. **Install** NTFY app on your device 2. **Add subscription** to your topic name 3. **Enter server URL** (if self-hosted) 4. **Test** with a manual message --- ## ๐Ÿ”” Notification Types ### **Error Notifications** **Priority:** Max ๐Ÿšจ | **Trigger:** Script errors and failures ``` [ERROR] DESKTOP [LOGIN] Failed to login: Invalid credentials ``` ### **Warning Notifications** **Priority:** High โš ๏ธ | **Trigger:** Important warnings ``` [WARN] MOBILE [SEARCH] Didn't gain expected points from search ``` ### **Info Notifications** **Priority:** Default ๐Ÿ† | **Trigger:** Important milestones ``` [INFO] MAIN [TASK] Started tasks for account user@email.com ``` ### **Buy Mode Notifications** **Priority:** High ๐Ÿ’ณ | **Trigger:** Point spending detected ``` ๐Ÿ’ณ Spend detected (Buy Mode) Account: user@email.com Spent: -500 points Current: 12,500 points Session spent: 1,200 points ``` ### **Conclusion Summary** **End-of-run summary with rich formatting:** ``` ๐ŸŽฏ Microsoft Rewards Summary Accounts: 3 โ€ข 0 with issues Total: 15,230 -> 16,890 (+1,660) Average Duration: 8m 32s Cumulative Runtime: 25m 36s ``` --- ## ๐Ÿค Integration with Discord ### **Complementary Setup** Use **both** NTFY and Discord for comprehensive monitoring: ```json { "notifications": { "webhook": { "enabled": true, "url": "https://discord.com/api/webhooks/..." }, "conclusionWebhook": { "enabled": true, "url": "https://discord.com/api/webhooks/..." }, "ntfy": { "enabled": true, "url": "https://ntfy.sh", "topic": "rewards-script" } } } ``` ### **Coverage Comparison** | Feature | NTFY | Discord | |---------|------|---------| | **Mobile push** | โœ… Instant | โŒ App required | | **Rich formatting** | โŒ Text only | โœ… Embeds + colors | | **Desktop alerts** | โœ… Native | โœ… App notifications | | **Offline delivery** | โœ… Queued | โŒ Real-time only | | **Self-hosted** | โœ… Easy | โŒ Complex | --- ## ๐ŸŽ›๏ธ Advanced Configuration ### **Custom Topic Names** Use descriptive, unique topic names: ```json { "topic": "rewards-production-server1" } { "topic": "msn-rewards-home-pc" } { "topic": "rewards-dev-testing" } ``` ### **Environment-Specific** ```json { "notifications": { "ntfy": { "enabled": true, "url": "https://ntfy.internal.lan", "topic": "homelab-rewards", "authToken": "tk_homelab_token" } } } ``` --- ## ๐Ÿงช Testing & Debugging ### **Manual Test Message** ```bash # Public server (no auth) curl -d "Test message from rewards script" https://ntfy.sh/your-topic # With authentication curl -H "Authorization: Bearer tk_your_token" \ -d "Authenticated test message" \ https://ntfy.sh/your-topic ``` ### **Script Debug Mode** ```powershell $env:DEBUG_REWARDS_VERBOSE=1; npm start ``` ### **Server Health Check** ```bash # Check NTFY server status curl -s https://ntfy.sh/v1/health # List your topics (with auth) curl -H "Authorization: Bearer tk_your_token" \ https://ntfy.sh/v1/account/topics ``` --- ## ๐Ÿ› ๏ธ Troubleshooting | Problem | Solution | |---------|----------| | **No notifications** | Check topic spelling; verify app subscription | | **Auth failures** | Verify token format (`tk_`); check token validity | | **Wrong server** | Test server URL in browser; check HTTPS/HTTP | | **Rate limits** | Switch to self-hosted; reduce notification frequency | ### **Common Fixes** - โœ… **Topic name** โ€” Must match exactly between config and app - โœ… **Server URL** โ€” Include `https://` and check accessibility - โœ… **Token format** โ€” Must start with `tk_` for authentication - โœ… **Network** โ€” Verify firewall/proxy settings --- ## ๐Ÿ  Homelab Integration ### **Official Support** NTFY is included in: - **Debian Trixie** (testing) - **Ubuntu** (latest versions) ### **Popular Integrations** - **Sonarr/Radarr** โ€” Download completion notifications - **Prometheus** โ€” Alert manager integration - **Home Assistant** โ€” Automation notifications - **Portainer** โ€” Container status alerts ### **Docker Stack Example** ```yaml version: '3.8' services: ntfy: image: binwiederhier/ntfy container_name: ntfy ports: - "80:80" volumes: - ./ntfy-data:/var/lib/ntfy environment: - NTFY_BASE_URL=https://ntfy.yourdomain.com command: serve rewards: build: . depends_on: - ntfy environment: - NTFY_URL=http://ntfy:80 ``` --- ## ๐Ÿ”’ Privacy & Security ### **Public Server (ntfy.sh)** - โš ๏ธ Messages pass through public infrastructure - โš ๏ธ Topic names visible in logs - โœ… Suitable for non-sensitive notifications ### **Self-Hosted Server** - โœ… Complete control over data - โœ… Private network deployment possible - โœ… Recommended for sensitive information ### **Best Practices** - ๐Ÿ” Use **unique, non-guessable** topic names - ๐Ÿ”‘ Enable **authentication** for sensitive notifications - ๐Ÿ  Use **self-hosted server** for maximum privacy - ๐Ÿ”„ **Regularly rotate** authentication tokens ### **Data Retention** - ๐Ÿ“จ Messages are **not permanently stored** - โฑ๏ธ Delivery attempts **retried** for short periods - ๐Ÿ—‘๏ธ **No long-term** message history --- ## โšก Performance Impact ### **Script Performance** - โœ… **Minimal overhead** โ€” Fire-and-forget notifications - โœ… **Non-blocking** โ€” Failed notifications don't affect script - โœ… **Asynchronous** โ€” No execution delays ### **Network Usage** - ๐Ÿ“Š **Low bandwidth** โ€” Text-only messages - โšก **HTTP POST** โ€” Simple, efficient protocol - ๐Ÿ”„ **Retry logic** โ€” Automatic failure recovery --- ## ๐Ÿ”— Related Guides - **[Discord Webhooks](./conclusionwebhook.md)** โ€” Rich notification embeds - **[Getting Started](./getting-started.md)** โ€” Initial setup and configuration - **[Buy Mode](./buy-mode.md)** โ€” Manual purchasing notifications - **[Security](./security.md)** โ€” Privacy and data protection