Debian Codegraph @

pkg/services/push/pushover/doc.go

raw symbols SCIP
1 // Package pushover provides a notification service for sending push notifications via Pushover.
2 //
3 // The Pushover service allows sending push notifications to devices running the Pushover
4 // application on iOS, Android, and Desktop. Pushover is a simple notification service
5 // that delivers instant notifications from scripts, applications, and devices to your
6 // phone or desktop. It supports different priority levels, custom sounds, and
7 // notification titles.
8 //
9 // # URL Format
10 //
11 // The service URL follows the format:
12 //
13 // pushover://userKey:apiToken@host[?query]
14 //
15 // Where:
16 // - userKey: Pushover user key (required, found in your Pushover dashboard)
17 // - apiToken: Pushover application API token (required, created in your application)
18 // - host: optional, but typically not used (included for URL scheme compatibility)
19 // - query: configuration parameters
20 //
21 // # Configuration Options
22 //
23 // The following query parameters can be used to configure the service:
24 //
25 // - devices: comma-separated list of target device names (optional, sends to all devices if not specified)
26 // - priority: message priority (-2 to 1, default: 0)
27 // - title: notification title (optional, defaults to application name)
28 // - encryptionkey: 64-character hex AES-256 key for end-to-end encryption (optional, alias: key)
29 //
30 // Priority levels:
31 // - -2: lowest - no sound, no notification, stored for later
32 // - -1: low - no sound, vibration only
33 // - 0: normal (default) - normal notification behavior
34 // - 1: high - bypasses quiet hours, plays sound
35 //
36 // # Templates
37 //
38 // Pushover does not use templates in the Shoutrrr sense, but supports notification
39 // customization through its native features like titles and priority levels.
40 //
41 // # Usage Examples
42 //
43 // ## Basic notification to all devices
44 //
45 // url := "pushover://userkey:apitoken@"
46 // err := shoutrrr.Send(url, "Hello from Shoutrrr!")
47 //
48 // ## Notification to specific devices
49 //
50 // url := "pushover://userkey:apitoken@?devices=phone,tablet"
51 // err := shoutrrr.Send(url, "Hello on specific devices!")
52 //
53 // ## Notification with custom title
54 //
55 // url := "pushover://userkey:apitoken@?title=Alert"
56 // err := shoutrrr.Send(url, "System is down!")
57 //
58 // ## High priority notification
59 //
60 // url := "pushover://userkey:apitoken@?priority=1"
61 // err := shoutrrr.Send(url, "Critical alert - immediate attention required!")
62 //
63 // ## Quiet notification (no sound)
64 //
65 // url := "pushover://userkey:apitoken@?priority=-1"
66 // err := shoutrrr.Send(url, "Background notification")
67 //
68 // # Common Use Cases
69 //
70 // ## System Monitoring Alerts
71 //
72 // Send alerts from monitoring systems like Nagios, Prometheus, or Zabbix:
73 //
74 // url := "pushover://userkey:apitoken@?title=Alert&priority=1"
75 // err := shoutrrr.Send(url, "Disk space critical: 95% used")
76 //
77 // ## CI/CD Pipeline Notifications
78 //
79 // Notify about build status from Jenkins, GitHub Actions, or GitLab CI:
80 //
81 // url := "pushover://userkey:apitoken@?title=Build%20Failed&priority=1"
82 // err := shoutrrr.Send(url, "Build #123 failed on main branch")
83 //
84 // ## Home Automation
85 //
86 // Integrate with home automation systems:
87 //
88 // url := "pushover://userkey:apitoken@?title=Security&priority=1"
89 // err := shoutrrr.Send(url, "Motion detected at front door")
90 //
91 // ## Backup Completion Notifications
92 //
93 // Notify when backups complete:
94 //
95 // url := "pushover://userkey:apitoken@?title=Backup"
96 // err := shoutrrr.Send(url, "Daily backup finished successfully")
97 //
98 // ## Application Health Monitoring
99 //
100 // Send health check notifications from applications:
101 //
102 // url := "pushover://userkey:apitoken@?title=Health%20Check&priority=-1"
103 // err := shoutrrr.Send(url, "All services are healthy")
104 //
105 // ## Incident Response
106 //
107 // Send urgent notifications for incident response:
108 //
109 // url := "pushover://userkey:apitoken@?title=INCIDENT&priority=1"
110 // err := shoutrrr.Send(url, "Database connection lost - immediate attention required")
111 //
112 // ## End-to-end encryption
113 //
114 // Encrypt message and title with a 256-bit key also configured in the Pushover app:
115 //
116 // url := "pushover://:apitoken@userkey?encryptionkey=0123456789abcdef0123456789abcdef0123456789abcdef0123456789abcdef"
117 // err := shoutrrr.Send(url, "This message is encrypted")
118 //
119 // # Error Handling
120 //
121 // The service returns errors for various failure scenarios. Always check the returned error:
122 //
123 // err := shoutrrr.Send(url, message)
124 // if err != nil {
125 // log.Printf("Failed to send Pushover notification: %v", err)
126 // }
127 //
128 // Common error scenarios:
129 // - Invalid or missing user key
130 // - Invalid or missing API token
131 // - Network connectivity issues
132 // - Invalid device names (devices that don't exist in your Pushover account)
133 // - HTTP error status codes from the Pushover API
134 // - Empty message content
135 //
136 // # Security Considerations
137 //
138 // - Store API tokens and encryption keys securely - avoid hardcoding them in source code or configuration files
139 // - Use appropriate priority levels - high priority notifications bypass quiet hours and should be reserved for critical events
140 // - Consider device-specific targeting when needed using the devices parameter
141 // - The user key is not secret, but the API token and encryption key should be treated as secrets
142 // - When encryptionkey is set, message and title are encrypted client-side; an invalid key or encryption failure refuses to send
143 // - Pushover notifications may contain sensitive information - consider this when sending notifications
144 // - Review Pushover's terms of service for any usage restrictions
145 //
146 // # Limitations and Behaviors
147 //
148 // - Message content cannot be empty
149 // - Priority can be set to values between -2 and 1
150 // - Priority 2 (emergency) requires additional parameters (retry, expire) which are not currently supported
151 //
152 // - Device names must match exactly how they appear in your Pushover account
153 // - HTTP client timeout is set to 10 seconds for API requests
154 // - The Pushover API endpoint is https://api.pushover.net/1/messages.json
155 // - Notifications are delivered instantly under normal conditions
156 // - Priority -2 messages are stored for 7 days, -1 and 0 for 30 days, 1 for 7 days
157 // - Maximum message length is 1024 characters; encrypted fields are larger than plaintext and can exceed this limit
158 // - End-to-end encryption is supported by the Pushover iOS and Android apps when the same key is configured on the device
159 package pushover