# ๐ฑ 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