| 1 |
# Publishing |
| 2 |
Publishing messages can be done via HTTP PUT/POST or via the [ntfy CLI](subscribe/cli.md#publish-messages) ([install instructions](install.md)). |
| 3 |
Topics are created on the fly by subscribing or publishing to them. Because there is no sign-up, **the topic is essentially a password**, so pick |
| 4 |
something that's not easily guessable (see [picking a topic](#picking-a-topic) for a handy topic name generator). |
| 5 |
|
| 6 |
Here's an example showing how to publish a simple message using a POST request: |
| 7 |
|
| 8 |
=== "Command line (curl)" |
| 9 |
``` |
| 10 |
curl -d "Backup successful 😀" ntfy.sh/mytopic |
| 11 |
``` |
| 12 |
|
| 13 |
=== "ntfy CLI" |
| 14 |
``` |
| 15 |
ntfy publish mytopic "Backup successful 😀" |
| 16 |
``` |
| 17 |
|
| 18 |
=== "HTTP" |
| 19 |
``` http |
| 20 |
POST /mytopic HTTP/1.1 |
| 21 |
Host: ntfy.sh |
| 22 |
|
| 23 |
Backup successful 😀 |
| 24 |
``` |
| 25 |
=== "JavaScript" |
| 26 |
``` javascript |
| 27 |
fetch('https://ntfy.sh/mytopic', { |
| 28 |
method: 'POST', // PUT works too |
| 29 |
body: 'Backup successful 😀' |
| 30 |
}) |
| 31 |
``` |
| 32 |
|
| 33 |
=== "Go" |
| 34 |
``` go |
| 35 |
http.Post("https://ntfy.sh/mytopic", "text/plain", |
| 36 |
strings.NewReader("Backup successful 😀")) |
| 37 |
``` |
| 38 |
|
| 39 |
=== "PowerShell" |
| 40 |
``` powershell |
| 41 |
$Request = @{ |
| 42 |
Method = "POST" |
| 43 |
URI = "https://ntfy.sh/mytopic" |
| 44 |
Body = "Backup successful" |
| 45 |
} |
| 46 |
Invoke-RestMethod @Request |
| 47 |
``` |
| 48 |
|
| 49 |
=== "Python" |
| 50 |
``` python |
| 51 |
requests.post("https://ntfy.sh/mytopic", |
| 52 |
data="Backup successful 😀".encode(encoding='utf-8')) |
| 53 |
``` |
| 54 |
|
| 55 |
=== "PHP" |
| 56 |
``` php-inline |
| 57 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 58 |
'http' => [ |
| 59 |
'method' => 'POST', // PUT also works |
| 60 |
'header' => 'Content-Type: text/plain', |
| 61 |
'content' => 'Backup successful 😀' |
| 62 |
] |
| 63 |
])); |
| 64 |
``` |
| 65 |
|
| 66 |
If you have the [Android app](subscribe/phone.md) installed on your phone, this will create a notification that looks like this: |
| 67 |
|
| 68 |
<figure markdown> |
| 69 |
{ width=500 } |
| 70 |
<figcaption>Android notification</figcaption> |
| 71 |
</figure> |
| 72 |
|
| 73 |
There are more features related to publishing messages: You can set a [notification priority](#message-priority), |
| 74 |
a [title](#message-title), and [tag messages](#tags-emojis) 🥳 🎉. Here's an example that uses some of them at together: |
| 75 |
|
| 76 |
=== "Command line (curl)" |
| 77 |
``` |
| 78 |
curl \ |
| 79 |
-H "Title: Unauthorized access detected" \ |
| 80 |
-H "Priority: urgent" \ |
| 81 |
-H "Tags: warning,skull" \ |
| 82 |
-d "Remote access to phils-laptop detected. Act right away." \ |
| 83 |
ntfy.sh/phil_alerts |
| 84 |
``` |
| 85 |
|
| 86 |
=== "ntfy CLI" |
| 87 |
``` |
| 88 |
ntfy publish \ |
| 89 |
--title "Unauthorized access detected" \ |
| 90 |
--tags warning,skull \ |
| 91 |
--priority urgent \ |
| 92 |
mytopic \ |
| 93 |
"Remote access to phils-laptop detected. Act right away." |
| 94 |
``` |
| 95 |
|
| 96 |
=== "HTTP" |
| 97 |
``` http |
| 98 |
POST /phil_alerts HTTP/1.1 |
| 99 |
Host: ntfy.sh |
| 100 |
Title: Unauthorized access detected |
| 101 |
Priority: urgent |
| 102 |
Tags: warning,skull |
| 103 |
|
| 104 |
Remote access to phils-laptop detected. Act right away. |
| 105 |
``` |
| 106 |
|
| 107 |
=== "JavaScript" |
| 108 |
``` javascript |
| 109 |
fetch('https://ntfy.sh/phil_alerts', { |
| 110 |
method: 'POST', // PUT works too |
| 111 |
body: 'Remote access to phils-laptop detected. Act right away.', |
| 112 |
headers: { |
| 113 |
'Title': 'Unauthorized access detected', |
| 114 |
'Priority': 'urgent', |
| 115 |
'Tags': 'warning,skull' |
| 116 |
} |
| 117 |
}) |
| 118 |
``` |
| 119 |
|
| 120 |
=== "Go" |
| 121 |
``` go |
| 122 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/phil_alerts", |
| 123 |
strings.NewReader("Remote access to phils-laptop detected. Act right away.")) |
| 124 |
req.Header.Set("Title", "Unauthorized access detected") |
| 125 |
req.Header.Set("Priority", "urgent") |
| 126 |
req.Header.Set("Tags", "warning,skull") |
| 127 |
http.DefaultClient.Do(req) |
| 128 |
``` |
| 129 |
|
| 130 |
=== "PowerShell" |
| 131 |
``` powershell |
| 132 |
$Request = @{ |
| 133 |
Method = "POST" |
| 134 |
URI = "https://ntfy.sh/phil_alerts" |
| 135 |
Headers = @{ |
| 136 |
Title = "Unauthorized access detected" |
| 137 |
Priority = "urgent" |
| 138 |
Tags = "warning,skull" |
| 139 |
} |
| 140 |
Body = "Remote access to phils-laptop detected. Act right away." |
| 141 |
} |
| 142 |
Invoke-RestMethod @Request |
| 143 |
``` |
| 144 |
|
| 145 |
=== "Python" |
| 146 |
``` python |
| 147 |
requests.post("https://ntfy.sh/phil_alerts", |
| 148 |
data="Remote access to phils-laptop detected. Act right away.", |
| 149 |
headers={ |
| 150 |
"Title": "Unauthorized access detected", |
| 151 |
"Priority": "urgent", |
| 152 |
"Tags": "warning,skull" |
| 153 |
}) |
| 154 |
``` |
| 155 |
|
| 156 |
=== "PHP" |
| 157 |
``` php-inline |
| 158 |
file_get_contents('https://ntfy.sh/phil_alerts', false, stream_context_create([ |
| 159 |
'http' => [ |
| 160 |
'method' => 'POST', // PUT also works |
| 161 |
'header' => |
| 162 |
"Content-Type: text/plain\r\n" . |
| 163 |
"Title: Unauthorized access detected\r\n" . |
| 164 |
"Priority: urgent\r\n" . |
| 165 |
"Tags: warning,skull", |
| 166 |
'content' => 'Remote access to phils-laptop detected. Act right away.' |
| 167 |
] |
| 168 |
])); |
| 169 |
``` |
| 170 |
|
| 171 |
<figure markdown> |
| 172 |
{ width=500 } |
| 173 |
<figcaption>Urgent notification with tags and title</figcaption> |
| 174 |
</figure> |
| 175 |
|
| 176 |
You can also do multi-line messages. Here's an example using a [click action](#click-action), an [action button](#action-buttons), |
| 177 |
an [external image attachment](#attach-file-from-a-url) and [email publishing](#e-mail-publishing): |
| 178 |
|
| 179 |
=== "Command line (curl)" |
| 180 |
``` |
| 181 |
curl \ |
| 182 |
-H "Click: https://home.nest.com/" \ |
| 183 |
-H "Attach: https://nest.com/view/yAxkasd.jpg" \ |
| 184 |
-H "Actions: http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \ |
| 185 |
-H "Email: [email protected]" \ |
| 186 |
-d "There's someone at the door. 🐶 |
| 187 |
|
| 188 |
Please check if it's a good boy or a hooman. |
| 189 |
Doggies have been known to ring the doorbell." \ |
| 190 |
ntfy.sh/mydoorbell |
| 191 |
``` |
| 192 |
|
| 193 |
=== "ntfy CLI" |
| 194 |
``` |
| 195 |
ntfy publish \ |
| 196 |
--click="https://home.nest.com/" \ |
| 197 |
--attach="https://nest.com/view/yAxkasd.jpg" \ |
| 198 |
--actions="http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \ |
| 199 |
--email="[email protected]" \ |
| 200 |
mydoorbell \ |
| 201 |
"There's someone at the door. 🐶 |
| 202 |
|
| 203 |
Please check if it's a good boy or a hooman. |
| 204 |
Doggies have been known to ring the doorbell." |
| 205 |
``` |
| 206 |
|
| 207 |
=== "HTTP" |
| 208 |
``` http |
| 209 |
POST /mydoorbell HTTP/1.1 |
| 210 |
Host: ntfy.sh |
| 211 |
Click: https://home.nest.com/ |
| 212 |
Attach: https://nest.com/view/yAxkasd.jpg |
| 213 |
Actions: http, Open door, https://api.nest.com/open/yAxkasd, clear=true |
| 214 |
Email: [email protected] |
| 215 |
|
| 216 |
There's someone at the door. 🐶 |
| 217 |
|
| 218 |
Please check if it's a good boy or a hooman. |
| 219 |
Doggies have been known to ring the doorbell. |
| 220 |
``` |
| 221 |
|
| 222 |
=== "JavaScript" |
| 223 |
``` javascript |
| 224 |
fetch('https://ntfy.sh/mydoorbell', { |
| 225 |
method: 'POST', // PUT works too |
| 226 |
headers: { |
| 227 |
'Click': 'https://home.nest.com/', |
| 228 |
'Attach': 'https://nest.com/view/yAxkasd.jpg', |
| 229 |
'Actions': 'http, Open door, https://api.nest.com/open/yAxkasd, clear=true', |
| 230 |
'Email': '[email protected]' |
| 231 |
}, |
| 232 |
body: `There's someone at the door. 🐶 |
| 233 |
|
| 234 |
Please check if it's a good boy or a hooman. |
| 235 |
Doggies have been known to ring the doorbell.`, |
| 236 |
}) |
| 237 |
``` |
| 238 |
|
| 239 |
=== "Go" |
| 240 |
``` go |
| 241 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mydoorbell", |
| 242 |
strings.NewReader(`There's someone at the door. 🐶 |
| 243 |
|
| 244 |
Please check if it's a good boy or a hooman. |
| 245 |
Doggies have been known to ring the doorbell.`)) |
| 246 |
req.Header.Set("Click", "https://home.nest.com/") |
| 247 |
req.Header.Set("Attach", "https://nest.com/view/yAxkasd.jpg") |
| 248 |
req.Header.Set("Actions", "http, Open door, https://api.nest.com/open/yAxkasd, clear=true") |
| 249 |
req.Header.Set("Email", "[email protected]") |
| 250 |
http.DefaultClient.Do(req) |
| 251 |
``` |
| 252 |
|
| 253 |
=== "PowerShell" |
| 254 |
``` powershell |
| 255 |
$Request = @{ |
| 256 |
Method = "POST" |
| 257 |
URI = "https://ntfy.sh/mydoorbell" |
| 258 |
Headers = @{ |
| 259 |
Click = "https://home.nest.com" |
| 260 |
Attach = "https://nest.com/view/yAxksd.jpg" |
| 261 |
Actions = "http, Open door, https://api.nest.com/open/yAxkasd, clear=true" |
| 262 |
Email = "[email protected]" |
| 263 |
} |
| 264 |
Body = "There's someone at the door. 🐶`n |
| 265 |
`n |
| 266 |
Please check if it's a good boy or a hooman.`n |
| 267 |
Doggies have been known to ring the doorbell.`n" |
| 268 |
} |
| 269 |
Invoke-RestMethod @Request |
| 270 |
``` |
| 271 |
|
| 272 |
=== "Python" |
| 273 |
``` python |
| 274 |
requests.post("https://ntfy.sh/mydoorbell", |
| 275 |
data="""There's someone at the door. 🐶 |
| 276 |
|
| 277 |
Please check if it's a good boy or a hooman. |
| 278 |
Doggies have been known to ring the doorbell.""".encode('utf-8'), |
| 279 |
headers={ |
| 280 |
"Click": "https://home.nest.com/", |
| 281 |
"Attach": "https://nest.com/view/yAxkasd.jpg", |
| 282 |
"Actions": "http, Open door, https://api.nest.com/open/yAxkasd, clear=true", |
| 283 |
"Email": "[email protected]" |
| 284 |
}) |
| 285 |
``` |
| 286 |
|
| 287 |
=== "PHP" |
| 288 |
``` php-inline |
| 289 |
file_get_contents('https://ntfy.sh/mydoorbell', false, stream_context_create([ |
| 290 |
'http' => [ |
| 291 |
'method' => 'POST', // PUT also works |
| 292 |
'header' => |
| 293 |
"Content-Type: text/plain\r\n" . |
| 294 |
"Click: https://home.nest.com/\r\n" . |
| 295 |
"Attach: https://nest.com/view/yAxkasd.jpg\r\n" . |
| 296 |
"Actions": "http, Open door, https://api.nest.com/open/yAxkasd, clear=true\r\n" . |
| 297 |
"Email": "[email protected]\r\n", |
| 298 |
'content' => 'There\'s someone at the door. 🐶 |
| 299 |
|
| 300 |
Please check if it\'s a good boy or a hooman. |
| 301 |
Doggies have been known to ring the doorbell.' |
| 302 |
] |
| 303 |
])); |
| 304 |
``` |
| 305 |
|
| 306 |
<figure markdown> |
| 307 |
{ width=500 } |
| 308 |
<figcaption>Notification using a click action, a user action, with an external image attachment and forwarded via email</figcaption> |
| 309 |
</figure> |
| 310 |
|
| 311 |
## Picking a topic |
| 312 |
Since there is no sign-up, **the topic is essentially a password**, so pick something that's not easily guessable. Topic names may |
| 313 |
only contain letters, numbers, underscores and dashes (`[-_A-Za-z0-9]`), and may be up to 64 characters long. |
| 314 |
|
| 315 |
Not sure what to pick? Type a name below and the generator will add a random, hard-to-guess suffix for you. Everything happens locally in your browser: |
| 316 |
|
| 317 |
<div id="tg-widget" class="tg-generator"> |
| 318 |
<div class="tg-header"> |
| 319 |
<span class="tg-title">Topic name generator</span> |
| 320 |
<button type="button" id="tg-reroll" class="tg-reset" title="Generate a new random suffix">Regenerate suffix</button> |
| 321 |
</div> |
| 322 |
<div class="tg-body"> |
| 323 |
<div class="tg-left"> |
| 324 |
<div class="tg-field"> |
| 325 |
<label for="tg-input">Type a topic name</label> |
| 326 |
<input type="text" id="tg-input" placeholder="e.g. backups, alerts, phil-home" autocomplete="off" autocapitalize="off" autocorrect="off" spellcheck="false"> |
| 327 |
</div> |
| 328 |
<div class="tg-note">Spaces and characters other than letters, numbers, <code>-</code> and <code>_</code> are removed automatically as you type. Names are capped at 64 characters.</div> |
| 329 |
</div> |
| 330 |
<div class="tg-right"> |
| 331 |
<div class="tg-output-row"> |
| 332 |
<span class="tg-output-label">Your topic:</span> |
| 333 |
<div class="tg-output-line"> |
| 334 |
<pre class="tg-output" id="tg-output-name"></pre> |
| 335 |
<button type="button" class="tg-btn-copy" data-copy="tg-output-name" title="Copy to clipboard"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></button> |
| 336 |
</div> |
| 337 |
</div> |
| 338 |
<div class="tg-output-row"> |
| 339 |
<span class="tg-output-label">Your topic URL:</span> |
| 340 |
<div class="tg-output-line"> |
| 341 |
<pre class="tg-output" id="tg-output-url">https://ntfy.sh/</pre> |
| 342 |
<button type="button" class="tg-btn-copy" data-copy="tg-output-url" title="Copy to clipboard"><svg xmlns="http://www.w3.org/2000/svg" width="14" height="14" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><rect x="9" y="9" width="13" height="13" rx="2" ry="2"></rect><path d="M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1"></path></svg></button> |
| 343 |
</div> |
| 344 |
</div> |
| 345 |
</div> |
| 346 |
</div> |
| 347 |
</div> |
| 348 |
|
| 349 |
## Message title |
| 350 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 351 |
|
| 352 |
The notification title is typically set to the topic short URL (e.g. `ntfy.sh/mytopic`). To override the title, |
| 353 |
you can set the `X-Title` header (or any of its aliases: `Title`, `ti`, or `t`). |
| 354 |
|
| 355 |
=== "Command line (curl)" |
| 356 |
``` |
| 357 |
curl -H "X-Title: Dogs are better than cats" -d "Oh my ..." ntfy.sh/controversial |
| 358 |
curl -H "Title: Dogs are better than cats" -d "Oh my ..." ntfy.sh/controversial |
| 359 |
curl -H "t: Dogs are better than cats" -d "Oh my ..." ntfy.sh/controversial |
| 360 |
``` |
| 361 |
|
| 362 |
=== "ntfy CLI" |
| 363 |
``` |
| 364 |
ntfy publish \ |
| 365 |
-t "Dogs are better than cats" \ |
| 366 |
controversial "Oh my ..." |
| 367 |
``` |
| 368 |
|
| 369 |
=== "HTTP" |
| 370 |
``` http |
| 371 |
POST /controversial HTTP/1.1 |
| 372 |
Host: ntfy.sh |
| 373 |
Title: Dogs are better than cats |
| 374 |
|
| 375 |
Oh my ... |
| 376 |
``` |
| 377 |
|
| 378 |
=== "JavaScript" |
| 379 |
``` javascript |
| 380 |
fetch('https://ntfy.sh/controversial', { |
| 381 |
method: 'POST', |
| 382 |
body: 'Oh my ...', |
| 383 |
headers: { 'Title': 'Dogs are better than cats' } |
| 384 |
}) |
| 385 |
``` |
| 386 |
|
| 387 |
=== "Go" |
| 388 |
``` go |
| 389 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/controversial", strings.NewReader("Oh my ...")) |
| 390 |
req.Header.Set("Title", "Dogs are better than cats") |
| 391 |
http.DefaultClient.Do(req) |
| 392 |
``` |
| 393 |
|
| 394 |
=== "PowerShell" |
| 395 |
``` powershell |
| 396 |
$Request = @{ |
| 397 |
Method = "POST" |
| 398 |
URI = "https://ntfy.sh/controversial" |
| 399 |
Headers = @{ |
| 400 |
Title = "Dogs are better than cats" |
| 401 |
} |
| 402 |
Body = "Oh my ..." |
| 403 |
} |
| 404 |
Invoke-RestMethod @Request |
| 405 |
``` |
| 406 |
|
| 407 |
=== "Python" |
| 408 |
``` python |
| 409 |
requests.post("https://ntfy.sh/controversial", |
| 410 |
data="Oh my ...", |
| 411 |
headers={ "Title": "Dogs are better than cats" }) |
| 412 |
``` |
| 413 |
|
| 414 |
=== "PHP" |
| 415 |
``` php-inline |
| 416 |
file_get_contents('https://ntfy.sh/controversial', false, stream_context_create([ |
| 417 |
'http' => [ |
| 418 |
'method' => 'POST', |
| 419 |
'header' => |
| 420 |
"Content-Type: text/plain\r\n" . |
| 421 |
"Title: Dogs are better than cats", |
| 422 |
'content' => 'Oh my ...' |
| 423 |
] |
| 424 |
])); |
| 425 |
``` |
| 426 |
|
| 427 |
<figure markdown> |
| 428 |
{ width=500 } |
| 429 |
<figcaption>Detail view of notification with title</figcaption> |
| 430 |
</figure> |
| 431 |
|
| 432 |
!!! info |
| 433 |
ntfy supports UTF-8 in HTTP headers, but [not every library or programming language does](https://www.jmix.io/blog/utf-8-in-http-headers/). |
| 434 |
If non-ASCII characters are causing issues for you in the title (i.e. you're seeing `?` symbols), you may also encode any header (including the title) |
| 435 |
as [RFC 2047](https://datatracker.ietf.org/doc/html/rfc2047#section-2), e.g. `=?UTF-8?B?8J+HqfCfh6o=?=` ([base64](https://en.wikipedia.org/wiki/Base64)), |
| 436 |
or `=?UTF-8?Q?=C3=84pfel?=` ([quoted-printable](https://en.wikipedia.org/wiki/Quoted-printable)). |
| 437 |
|
| 438 |
## Message priority |
| 439 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 440 |
|
| 441 |
All messages have a priority, which defines how urgently your phone notifies you. On Android, you can set custom |
| 442 |
notification sounds and vibration patterns on your phone to map to these priorities (see [Android config](subscribe/phone.md)). |
| 443 |
|
| 444 |
The following priorities exist: |
| 445 |
|
| 446 |
| Priority | Icon | ID | Name | Description | |
| 447 |
|----------------------|--------------------------------------------|-----|----------------|--------------------------------------------------------------------------------------------------------| |
| 448 |
| Max priority |  | `5` | `max`/`urgent` | Really long vibration bursts, default notification sound with a pop-over notification. | |
| 449 |
| High priority |  | `4` | `high` | Long vibration burst, default notification sound with a pop-over notification. | |
| 450 |
| **Default priority** | *(none)* | `3` | `default` | Short default vibration and sound. Default notification behavior. | |
| 451 |
| Low priority |  | `2` | `low` | No vibration or sound. Notification will not visibly show up until notification drawer is pulled down. | |
| 452 |
| Min priority |  | `1` | `min` | No vibration or sound. The notification will be under the fold in "Other notifications". | |
| 453 |
|
| 454 |
You can set the priority with the header `X-Priority` (or any of its aliases: `Priority`, `prio`, or `p`). |
| 455 |
|
| 456 |
=== "Command line (curl)" |
| 457 |
``` |
| 458 |
curl -H "X-Priority: 5" -d "An urgent message" ntfy.sh/phil_alerts |
| 459 |
curl -H "Priority: low" -d "Low priority message" ntfy.sh/phil_alerts |
| 460 |
curl -H p:4 -d "A high priority message" ntfy.sh/phil_alerts |
| 461 |
``` |
| 462 |
|
| 463 |
=== "ntfy CLI" |
| 464 |
``` |
| 465 |
ntfy publish \ |
| 466 |
-p 5 \ |
| 467 |
phil_alerts An urgent message |
| 468 |
``` |
| 469 |
|
| 470 |
=== "HTTP" |
| 471 |
``` http |
| 472 |
POST /phil_alerts HTTP/1.1 |
| 473 |
Host: ntfy.sh |
| 474 |
Priority: 5 |
| 475 |
|
| 476 |
An urgent message |
| 477 |
``` |
| 478 |
|
| 479 |
=== "JavaScript" |
| 480 |
``` javascript |
| 481 |
fetch('https://ntfy.sh/phil_alerts', { |
| 482 |
method: 'POST', |
| 483 |
body: 'An urgent message', |
| 484 |
headers: { 'Priority': '5' } |
| 485 |
}) |
| 486 |
``` |
| 487 |
|
| 488 |
=== "Go" |
| 489 |
``` go |
| 490 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/phil_alerts", strings.NewReader("An urgent message")) |
| 491 |
req.Header.Set("Priority", "5") |
| 492 |
http.DefaultClient.Do(req) |
| 493 |
``` |
| 494 |
|
| 495 |
=== "PowerShell" |
| 496 |
``` powershell |
| 497 |
$Request = @{ |
| 498 |
Method = 'POST' |
| 499 |
URI = "https://ntfy.sh/phil_alerts" |
| 500 |
Headers = @{ |
| 501 |
Priority = "5" |
| 502 |
} |
| 503 |
Body = "An urgent message" |
| 504 |
} |
| 505 |
Invoke-RestMethod @Request |
| 506 |
``` |
| 507 |
|
| 508 |
=== "Python" |
| 509 |
``` python |
| 510 |
requests.post("https://ntfy.sh/phil_alerts", |
| 511 |
data="An urgent message", |
| 512 |
headers={ "Priority": "5" }) |
| 513 |
``` |
| 514 |
|
| 515 |
=== "PHP" |
| 516 |
``` php-inline |
| 517 |
file_get_contents('https://ntfy.sh/phil_alerts', false, stream_context_create([ |
| 518 |
'http' => [ |
| 519 |
'method' => 'POST', |
| 520 |
'header' => |
| 521 |
"Content-Type: text/plain\r\n" . |
| 522 |
"Priority: 5", |
| 523 |
'content' => 'An urgent message' |
| 524 |
] |
| 525 |
])); |
| 526 |
``` |
| 527 |
|
| 528 |
<figure markdown> |
| 529 |
{ width=500 } |
| 530 |
<figcaption>Detail view of priority notifications</figcaption> |
| 531 |
</figure> |
| 532 |
|
| 533 |
## Tags & emojis 🥳 🎉 |
| 534 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 535 |
|
| 536 |
You can tag messages with emojis and other relevant strings: |
| 537 |
|
| 538 |
* **Emojis**: If a tag matches an [emoji short code](emojis.md), it'll be converted to an emoji and prepended |
| 539 |
to title or message. |
| 540 |
* **Other tags:** If a tag doesn't match, it will be listed below the notification. |
| 541 |
|
| 542 |
This feature is useful for things like warnings (⚠️, ️🚨, or 🚩), but also to simply tag messages otherwise (e.g. script |
| 543 |
names, hostnames, etc.). Use [the emoji short code list](emojis.md) to figure out what tags can be converted to emojis. |
| 544 |
Here's an **excerpt of emojis** I've found very useful in alert messages: |
| 545 |
|
| 546 |
<table class="remove-md-box"><tr> |
| 547 |
<td> |
| 548 |
<table><thead><tr><th>Tag</th><th>Emoji</th></tr></thead><tbody> |
| 549 |
<tr><td><code>+1</code></td><td>👍</td></tr> |
| 550 |
<tr><td><code>partying_face</code></td><td>🥳</td></tr> |
| 551 |
<tr><td><code>tada</code></td><td>🎉</td></tr> |
| 552 |
<tr><td><code>heavy_check_mark</code></td><td>✔️</td></tr> |
| 553 |
<tr><td><code>loudspeaker</code></td><td>📢</td></tr> |
| 554 |
<tr><td>...</td><td>...</td></tr> |
| 555 |
</tbody></table> |
| 556 |
</td> |
| 557 |
<td> |
| 558 |
<table><thead><tr><th>Tag</th><th>Emoji</th></tr></thead><tbody> |
| 559 |
<tr><td><code>-1</code></td><td>👎️</td></tr> |
| 560 |
<tr><td><code>warning</code></td><td>⚠️</td></tr> |
| 561 |
<tr><td><code>rotating_light</code></td><td>️🚨</td></tr> |
| 562 |
<tr><td><code>triangular_flag_on_post</code></td><td>🚩</td></tr> |
| 563 |
<tr><td><code>skull</code></td><td>💀</td></tr> |
| 564 |
<tr><td>...</td><td>...</td></tr> |
| 565 |
</tbody></table> |
| 566 |
</td> |
| 567 |
<td> |
| 568 |
<table><thead><tr><th>Tag</th><th>Emoji</th></tr></thead><tbody> |
| 569 |
<tr><td><code>facepalm</code></td><td>🤦</td></tr> |
| 570 |
<tr><td><code>no_entry</code></td><td>⛔</td></tr> |
| 571 |
<tr><td><code>no_entry_sign</code></td><td>🚫</td></tr> |
| 572 |
<tr><td><code>cd</code></td><td>💿</td></tr> |
| 573 |
<tr><td><code>computer</code></td><td>💻</td></tr> |
| 574 |
<tr><td>...</td><td>...</td></tr> |
| 575 |
</tbody></table> |
| 576 |
</td> |
| 577 |
</tr></table> |
| 578 |
|
| 579 |
You can set tags with the `X-Tags` header (or any of its aliases: `Tags`, `tag`, or `ta`). Specify multiple tags by separating |
| 580 |
them with a comma, e.g. `tag1,tag2,tag3`. |
| 581 |
|
| 582 |
=== "Command line (curl)" |
| 583 |
``` |
| 584 |
curl -H "X-Tags: warning,mailsrv13,daily-backup" -d "Backup of mailsrv13 failed" ntfy.sh/backups |
| 585 |
curl -H "Tags: horse,unicorn" -d "Unicorns are just horses with unique horns" ntfy.sh/backups |
| 586 |
curl -H ta:dog -d "Dogs are awesome" ntfy.sh/backups |
| 587 |
``` |
| 588 |
|
| 589 |
=== "ntfy CLI" |
| 590 |
``` |
| 591 |
ntfy publish \ |
| 592 |
--tags=warning,mailsrv13,daily-backup \ |
| 593 |
backups "Backup of mailsrv13 failed" |
| 594 |
``` |
| 595 |
|
| 596 |
=== "HTTP" |
| 597 |
``` http |
| 598 |
POST /backups HTTP/1.1 |
| 599 |
Host: ntfy.sh |
| 600 |
Tags: warning,mailsrv13,daily-backup |
| 601 |
|
| 602 |
Backup of mailsrv13 failed |
| 603 |
``` |
| 604 |
|
| 605 |
=== "JavaScript" |
| 606 |
``` javascript |
| 607 |
fetch('https://ntfy.sh/backups', { |
| 608 |
method: 'POST', |
| 609 |
body: 'Backup of mailsrv13 failed', |
| 610 |
headers: { 'Tags': 'warning,mailsrv13,daily-backup' } |
| 611 |
}) |
| 612 |
``` |
| 613 |
|
| 614 |
=== "Go" |
| 615 |
``` go |
| 616 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/backups", strings.NewReader("Backup of mailsrv13 failed")) |
| 617 |
req.Header.Set("Tags", "warning,mailsrv13,daily-backup") |
| 618 |
http.DefaultClient.Do(req) |
| 619 |
``` |
| 620 |
|
| 621 |
=== "PowerShell" |
| 622 |
``` powershell |
| 623 |
$Request = @{ |
| 624 |
Method = "POST" |
| 625 |
URI = "https://ntfy.sh/backups" |
| 626 |
Headers = @{ |
| 627 |
Tags = "warning,mailsrv13,daily-backup" |
| 628 |
} |
| 629 |
Body = "Backup of mailsrv13 failed" |
| 630 |
} |
| 631 |
Invoke-RestMethod @Request |
| 632 |
``` |
| 633 |
|
| 634 |
=== "Python" |
| 635 |
``` python |
| 636 |
requests.post("https://ntfy.sh/backups", |
| 637 |
data="Backup of mailsrv13 failed", |
| 638 |
headers={ "Tags": "warning,mailsrv13,daily-backup" }) |
| 639 |
``` |
| 640 |
|
| 641 |
=== "PHP" |
| 642 |
``` php-inline |
| 643 |
file_get_contents('https://ntfy.sh/backups', false, stream_context_create([ |
| 644 |
'http' => [ |
| 645 |
'method' => 'POST', |
| 646 |
'header' => |
| 647 |
"Content-Type: text/plain\r\n" . |
| 648 |
"Tags: warning,mailsrv13,daily-backup", |
| 649 |
'content' => 'Backup of mailsrv13 failed' |
| 650 |
] |
| 651 |
])); |
| 652 |
``` |
| 653 |
|
| 654 |
<figure markdown> |
| 655 |
{ width=500 } |
| 656 |
<figcaption>Detail view of notifications with tags</figcaption> |
| 657 |
</figure> |
| 658 |
|
| 659 |
!!! info |
| 660 |
ntfy supports UTF-8 in HTTP headers, but [not every library or programming language does](https://www.jmix.io/blog/utf-8-in-http-headers/). |
| 661 |
If non-ASCII characters are causing issues for you in the title (i.e. you're seeing `?` symbols), you may also encode the tags header or individual tags |
| 662 |
as [RFC 2047](https://datatracker.ietf.org/doc/html/rfc2047#section-2), e.g. `tag1,=?UTF-8?B?8J+HqfCfh6o=?=` ([base64](https://en.wikipedia.org/wiki/Base64)), |
| 663 |
or `=?UTF-8?Q?=C3=84pfel?=,tag2` ([quoted-printable](https://en.wikipedia.org/wiki/Quoted-printable)). |
| 664 |
|
| 665 |
## Markdown formatting |
| 666 |
_Supported on:_ :material-android: :material-firefox: |
| 667 |
|
| 668 |
You can format messages using [Markdown](https://www.markdownguide.org/basic-syntax/) 🤩. That means you can use |
| 669 |
**bold text**, *italicized text*, links, images, and more. Supported Markdown features (web app only for now): |
| 670 |
|
| 671 |
- [Emphasis](https://www.markdownguide.org/basic-syntax/#emphasis) such as **bold** (`**bold**`), *italics* (`*italics*`) |
| 672 |
- [Links](https://www.markdownguide.org/basic-syntax/#links) (`[some tool](https://ntfy.sh)`) |
| 673 |
- [Images](https://www.markdownguide.org/basic-syntax/#images) (``) |
| 674 |
- [Code blocks](https://www.markdownguide.org/basic-syntax/#code-blocks) (` ```code blocks``` `) and [inline code](https://www.markdownguide.org/basic-syntax/#inline-code) (`` `inline code` ``) |
| 675 |
- [Headings](https://www.markdownguide.org/basic-syntax/#headings) (`# headings`, `## headings`, etc.) |
| 676 |
- [Lists](https://www.markdownguide.org/basic-syntax/#lists) (`- lists`, `1. lists`, etc.) |
| 677 |
- [Blockquotes](https://www.markdownguide.org/basic-syntax/#blockquotes) (`> blockquotes`) |
| 678 |
- [Horizontal rules](https://www.markdownguide.org/basic-syntax/#horizontal-rules) (`---`) |
| 679 |
|
| 680 |
By default, messages sent to ntfy are rendered as plain text. To enable Markdown, set the `X-Markdown` header (or any of |
| 681 |
its aliases: `Markdown`, or `md`) to `true` (or `1` or `yes`), or set the `Content-Type` header to `text/markdown`. |
| 682 |
Here's an example of how to enable Markdown formatting: |
| 683 |
|
| 684 |
=== "Command line (curl)" |
| 685 |
``` |
| 686 |
curl \ |
| 687 |
-d "Look ma, **bold text**, *italics*, ..." \ |
| 688 |
-H "Markdown: yes" \ |
| 689 |
ntfy.sh/mytopic |
| 690 |
``` |
| 691 |
|
| 692 |
=== "ntfy CLI" |
| 693 |
``` |
| 694 |
ntfy publish \ |
| 695 |
--markdown \ |
| 696 |
mytopic \ |
| 697 |
"Look ma, **bold text**, *italics*, ..." |
| 698 |
``` |
| 699 |
|
| 700 |
=== "HTTP" |
| 701 |
``` http |
| 702 |
POST /mytopic HTTP/1.1 |
| 703 |
Host: ntfy.sh |
| 704 |
Markdown: yes |
| 705 |
|
| 706 |
Look ma, **bold text**, *italics*, ... |
| 707 |
``` |
| 708 |
|
| 709 |
=== "JavaScript" |
| 710 |
``` javascript |
| 711 |
fetch('https://ntfy.sh/mytopic', { |
| 712 |
method: 'POST', // PUT works too |
| 713 |
body: 'Look ma, **bold text**, *italics*, ...', |
| 714 |
headers: { 'Markdown': 'yes' } |
| 715 |
}) |
| 716 |
``` |
| 717 |
|
| 718 |
=== "Go" |
| 719 |
``` go |
| 720 |
http.Post("https://ntfy.sh/mytopic", "text/markdown", |
| 721 |
strings.NewReader("Look ma, **bold text**, *italics*, ...")) |
| 722 |
|
| 723 |
// or |
| 724 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic", |
| 725 |
strings.NewReader("Look ma, **bold text**, *italics*, ...")) |
| 726 |
req.Header.Set("Markdown", "yes") |
| 727 |
http.DefaultClient.Do(req) |
| 728 |
``` |
| 729 |
|
| 730 |
=== "PowerShell" |
| 731 |
``` powershell |
| 732 |
$Request = @{ |
| 733 |
Method = "POST" |
| 734 |
URI = "https://ntfy.sh/mytopic" |
| 735 |
Body = "Look ma, **bold text**, *italics*, ..." |
| 736 |
Headers = @{ |
| 737 |
Markdown = "yes" |
| 738 |
} |
| 739 |
} |
| 740 |
Invoke-RestMethod @Request |
| 741 |
``` |
| 742 |
|
| 743 |
=== "Python" |
| 744 |
``` python |
| 745 |
requests.post("https://ntfy.sh/mytopic", |
| 746 |
data="Look ma, **bold text**, *italics*, ...", |
| 747 |
headers={ "Markdown": "yes" }) |
| 748 |
``` |
| 749 |
|
| 750 |
=== "PHP" |
| 751 |
``` php-inline |
| 752 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 753 |
'http' => [ |
| 754 |
'method' => 'POST', // PUT also works |
| 755 |
'header' => 'Content-Type: text/markdown', // ! |
| 756 |
'content' => 'Look ma, **bold text**, *italics*, ...' |
| 757 |
] |
| 758 |
])); |
| 759 |
``` |
| 760 |
|
| 761 |
Here's what that looks like in the web app: |
| 762 |
|
| 763 |
<figure markdown> |
| 764 |
{ width=500 } |
| 765 |
<figcaption>Markdown formatting in the web app</figcaption> |
| 766 |
</figure> |
| 767 |
|
| 768 |
## Click action |
| 769 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 770 |
|
| 771 |
You can define which URL to open when a notification is clicked. This may be useful if your notification is related |
| 772 |
to a Zabbix alert or a transaction that you'd like to provide the deep-link for. Tapping the notification will open |
| 773 |
the web browser (or the app) and open the website. |
| 774 |
|
| 775 |
To define a click action for the notification, pass a URL as the value of the `X-Click` header (or its alias `Click`). |
| 776 |
If you pass a website URL (`http://` or `https://`) the web browser will open. If you pass another URI that can be handled |
| 777 |
by another app, the responsible app may open. |
| 778 |
|
| 779 |
Examples: |
| 780 |
|
| 781 |
* `http://` or `https://` will open your browser (or an app if it registered for a URL) |
| 782 |
* `mailto:` links will open your mail app, e.g. `mailto:[email protected]` |
| 783 |
* `geo:` links will open Google Maps, e.g. `geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA` |
| 784 |
* `ntfy://` links will open ntfy (see [ntfy:// links](subscribe/phone.md#ntfy-links)), e.g. `ntfy://ntfy.sh/stats` |
| 785 |
* `twitter://` links will open Twitter, e.g. `twitter://user?screen_name=..` |
| 786 |
* ... |
| 787 |
|
| 788 |
Here's an example that will open Reddit when the notification is clicked: |
| 789 |
|
| 790 |
=== "Command line (curl)" |
| 791 |
``` |
| 792 |
curl \ |
| 793 |
-d "New messages on Reddit" \ |
| 794 |
-H "Click: https://www.reddit.com/message/messages" \ |
| 795 |
ntfy.sh/reddit_alerts |
| 796 |
``` |
| 797 |
|
| 798 |
=== "ntfy CLI" |
| 799 |
``` |
| 800 |
ntfy publish \ |
| 801 |
--click="https://www.reddit.com/message/messages" \ |
| 802 |
reddit_alerts "New messages on Reddit" |
| 803 |
``` |
| 804 |
|
| 805 |
=== "HTTP" |
| 806 |
``` http |
| 807 |
POST /reddit_alerts HTTP/1.1 |
| 808 |
Host: ntfy.sh |
| 809 |
Click: https://www.reddit.com/message/messages |
| 810 |
|
| 811 |
New messages on Reddit |
| 812 |
``` |
| 813 |
|
| 814 |
=== "JavaScript" |
| 815 |
``` javascript |
| 816 |
fetch('https://ntfy.sh/reddit_alerts', { |
| 817 |
method: 'POST', |
| 818 |
body: 'New messages on Reddit', |
| 819 |
headers: { 'Click': 'https://www.reddit.com/message/messages' } |
| 820 |
}) |
| 821 |
``` |
| 822 |
|
| 823 |
=== "Go" |
| 824 |
``` go |
| 825 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/reddit_alerts", strings.NewReader("New messages on Reddit")) |
| 826 |
req.Header.Set("Click", "https://www.reddit.com/message/messages") |
| 827 |
http.DefaultClient.Do(req) |
| 828 |
``` |
| 829 |
|
| 830 |
=== "PowerShell" |
| 831 |
``` powershell |
| 832 |
$Request = @{ |
| 833 |
Method = "POST" |
| 834 |
URI = "https://ntfy.sh/reddit_alerts" |
| 835 |
Headers = @{ Click="https://www.reddit.com/message/messages" } |
| 836 |
Body = "New messages on Reddit" |
| 837 |
} |
| 838 |
Invoke-RestMethod @Request |
| 839 |
``` |
| 840 |
|
| 841 |
=== "Python" |
| 842 |
``` python |
| 843 |
requests.post("https://ntfy.sh/reddit_alerts", |
| 844 |
data="New messages on Reddit", |
| 845 |
headers={ "Click": "https://www.reddit.com/message/messages" }) |
| 846 |
``` |
| 847 |
|
| 848 |
=== "PHP" |
| 849 |
``` php-inline |
| 850 |
file_get_contents('https://ntfy.sh/reddit_alerts', false, stream_context_create([ |
| 851 |
'http' => [ |
| 852 |
'method' => 'POST', |
| 853 |
'header' => |
| 854 |
"Content-Type: text/plain\r\n" . |
| 855 |
"Click: https://www.reddit.com/message/messages", |
| 856 |
'content' => 'New messages on Reddit' |
| 857 |
] |
| 858 |
])); |
| 859 |
``` |
| 860 |
|
| 861 |
## Icons |
| 862 |
_Supported on:_ :material-android: |
| 863 |
|
| 864 |
You can include an icon that will appear next to the text of the notification. Simply pass the `X-Icon` header or query |
| 865 |
parameter (or its alias `Icon`) to specify the URL that the icon is located at. The client will automatically download |
| 866 |
the icon (unless it is already cached locally, and less than 24 hours old), and show it in the notification. Icons are |
| 867 |
cached locally in the client until the notification is deleted. **Only JPEG and PNG images are supported at this time**. |
| 868 |
|
| 869 |
Here's an example showing how to include an icon: |
| 870 |
|
| 871 |
=== "Command line (curl)" |
| 872 |
``` |
| 873 |
curl \ |
| 874 |
-H "Icon: https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png" \ |
| 875 |
-H "Title: Kodi: Resuming Playback" \ |
| 876 |
-H "Tags: arrow_forward" \ |
| 877 |
-d "The Wire, S01E01" \ |
| 878 |
ntfy.sh/tvshows |
| 879 |
``` |
| 880 |
|
| 881 |
=== "ntfy CLI" |
| 882 |
``` |
| 883 |
ntfy publish \ |
| 884 |
--icon="https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png" \ |
| 885 |
--title="Kodi: Resuming Playback" \ |
| 886 |
--tags="arrow_forward" \ |
| 887 |
tvshows \ |
| 888 |
"The Wire, S01E01" |
| 889 |
``` |
| 890 |
|
| 891 |
=== "HTTP" |
| 892 |
``` http |
| 893 |
POST /tvshows HTTP/1.1 |
| 894 |
Host: ntfy.sh |
| 895 |
Icon: https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png |
| 896 |
Tags: arrow_forward |
| 897 |
Title: Kodi: Resuming Playback |
| 898 |
|
| 899 |
The Wire, S01E01 |
| 900 |
``` |
| 901 |
|
| 902 |
=== "JavaScript" |
| 903 |
``` javascript |
| 904 |
fetch('https://ntfy.sh/tvshows', { |
| 905 |
method: 'POST', |
| 906 |
headers: { |
| 907 |
'Icon': 'https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png', |
| 908 |
'Title': 'Kodi: Resuming Playback', |
| 909 |
'Tags': 'arrow_forward' |
| 910 |
}, |
| 911 |
body: "The Wire, S01E01" |
| 912 |
}) |
| 913 |
``` |
| 914 |
|
| 915 |
=== "Go" |
| 916 |
``` go |
| 917 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/tvshows", strings.NewReader("The Wire, S01E01")) |
| 918 |
req.Header.Set("Icon", "https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png") |
| 919 |
req.Header.Set("Tags", "arrow_forward") |
| 920 |
req.Header.Set("Title", "Kodi: Resuming Playback") |
| 921 |
http.DefaultClient.Do(req) |
| 922 |
``` |
| 923 |
|
| 924 |
=== "PowerShell" |
| 925 |
``` powershell |
| 926 |
$Request = @{ |
| 927 |
Method = "POST" |
| 928 |
URI = "https://ntfy.sh/tvshows" |
| 929 |
Headers = @{ |
| 930 |
Title = "Kodi: Resuming Playback" |
| 931 |
Tags = "arrow_forward" |
| 932 |
Icon = "https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png" |
| 933 |
} |
| 934 |
Body = "The Wire, S01E01" |
| 935 |
} |
| 936 |
Invoke-RestMethod @Request |
| 937 |
``` |
| 938 |
|
| 939 |
=== "Python" |
| 940 |
``` python |
| 941 |
requests.post("https://ntfy.sh/tvshows", |
| 942 |
data="The Wire, S01E01", |
| 943 |
headers={ |
| 944 |
"Title": "Kodi: Resuming Playback", |
| 945 |
"Tags": "arrow_forward", |
| 946 |
"Icon": "https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png" |
| 947 |
}) |
| 948 |
``` |
| 949 |
|
| 950 |
=== "PHP" |
| 951 |
``` php-inline |
| 952 |
file_get_contents('https://ntfy.sh/tvshows', false, stream_context_create([ |
| 953 |
'http' => [ |
| 954 |
'method' => 'PUT', |
| 955 |
'header' => |
| 956 |
"Content-Type: text/plain\r\n" . // Does not matter |
| 957 |
"Title: Kodi: Resuming Playback\r\n" . |
| 958 |
"Tags: arrow_forward\r\n" . |
| 959 |
"Icon: https://styles.redditmedia.com/t5_32uhe/styles/communityIcon_xnt6chtnr2j21.png", |
| 960 |
], |
| 961 |
'content' => "The Wire, S01E01" |
| 962 |
])); |
| 963 |
``` |
| 964 |
|
| 965 |
Here's an example of how it will look on Android: |
| 966 |
|
| 967 |
<figure markdown> |
| 968 |
{ width=500 } |
| 969 |
<figcaption>Custom icon from an external URL</figcaption> |
| 970 |
</figure> |
| 971 |
|
| 972 |
## Attachments |
| 973 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 974 |
|
| 975 |
You can **send images and other files to your phone** as attachments to a notification. The attachments are then downloaded |
| 976 |
onto your phone (depending on size and setting automatically), and can be used from the Downloads folder. |
| 977 |
|
| 978 |
There are two different ways to send attachments: |
| 979 |
|
| 980 |
* sending [a local file](#attach-local-file) via PUT, e.g. from `~/Flowers/flower.jpg` or `ringtone.mp3` |
| 981 |
* or by [passing an external URL](#attach-file-from-a-url) as an attachment, e.g. `https://f-droid.org/F-Droid.apk` |
| 982 |
|
| 983 |
### Attach local file |
| 984 |
To **send a file from your computer** as an attachment, you can send it as the PUT request body. If a message is greater |
| 985 |
than the maximum message size (4,096 bytes) or consists of non UTF-8 characters, the ntfy server will automatically |
| 986 |
detect the mime type and size, and send the message as an attachment file. To send smaller text-only messages or files |
| 987 |
as attachments, you must pass a filename by passing the `X-Filename` header or query parameter (or any of its aliases |
| 988 |
`Filename`, `File` or `f`). |
| 989 |
|
| 990 |
By default, and how ntfy.sh is configured, the **max attachment size is 15 MB** (with 100 MB total per visitor). |
| 991 |
Attachments **expire after 3 hours**, which typically is plenty of time for the user to download it, or for the Android app |
| 992 |
to auto-download it. Please also check out the [other limits below](#limitations). |
| 993 |
|
| 994 |
Here's an example showing how to upload an image: |
| 995 |
|
| 996 |
=== "Command line (curl)" |
| 997 |
``` |
| 998 |
curl \ |
| 999 |
-T flower.jpg \ |
| 1000 |
-H "Filename: flower.jpg" \ |
| 1001 |
ntfy.sh/flowers |
| 1002 |
``` |
| 1003 |
|
| 1004 |
=== "ntfy CLI" |
| 1005 |
``` |
| 1006 |
ntfy publish \ |
| 1007 |
--file=flower.jpg \ |
| 1008 |
flowers |
| 1009 |
``` |
| 1010 |
|
| 1011 |
=== "HTTP" |
| 1012 |
``` http |
| 1013 |
PUT /flowers HTTP/1.1 |
| 1014 |
Host: ntfy.sh |
| 1015 |
Filename: flower.jpg |
| 1016 |
Content-Type: 52312 |
| 1017 |
|
| 1018 |
(binary JPEG data) |
| 1019 |
``` |
| 1020 |
|
| 1021 |
=== "JavaScript" |
| 1022 |
``` javascript |
| 1023 |
fetch('https://ntfy.sh/flowers', { |
| 1024 |
method: 'PUT', |
| 1025 |
body: document.getElementById("file").files[0], |
| 1026 |
headers: { 'Filename': 'flower.jpg' } |
| 1027 |
}) |
| 1028 |
``` |
| 1029 |
|
| 1030 |
=== "Go" |
| 1031 |
``` go |
| 1032 |
file, _ := os.Open("flower.jpg") |
| 1033 |
req, _ := http.NewRequest("PUT", "https://ntfy.sh/flowers", file) |
| 1034 |
req.Header.Set("Filename", "flower.jpg") |
| 1035 |
http.DefaultClient.Do(req) |
| 1036 |
``` |
| 1037 |
|
| 1038 |
=== "PowerShell" |
| 1039 |
``` powershell |
| 1040 |
$Request = @{ |
| 1041 |
Method = "POST" |
| 1042 |
Uri = "ntfy.sh/flowers" |
| 1043 |
InFile = "flower.jpg" |
| 1044 |
Headers = @{"Filename" = "flower.jpg"} |
| 1045 |
} |
| 1046 |
Invoke-RestMethod @Request |
| 1047 |
``` |
| 1048 |
|
| 1049 |
=== "Python" |
| 1050 |
``` python |
| 1051 |
requests.put("https://ntfy.sh/flowers", |
| 1052 |
data=open("flower.jpg", 'rb'), |
| 1053 |
headers={ "Filename": "flower.jpg" }) |
| 1054 |
``` |
| 1055 |
|
| 1056 |
=== "PHP" |
| 1057 |
``` php-inline |
| 1058 |
file_get_contents('https://ntfy.sh/flowers', false, stream_context_create([ |
| 1059 |
'http' => [ |
| 1060 |
'method' => 'PUT', |
| 1061 |
'header' => |
| 1062 |
"Content-Type: application/octet-stream\r\n" . // Does not matter |
| 1063 |
"Filename: flower.jpg", |
| 1064 |
'content' => file_get_contents('flower.jpg') // Dangerous for large files |
| 1065 |
] |
| 1066 |
])); |
| 1067 |
``` |
| 1068 |
|
| 1069 |
Here's what that looks like on Android: |
| 1070 |
|
| 1071 |
<figure markdown> |
| 1072 |
{ width=500 } |
| 1073 |
<figcaption>Image attachment sent from a local file</figcaption> |
| 1074 |
</figure> |
| 1075 |
|
| 1076 |
### Attach file from a URL |
| 1077 |
Instead of sending a local file to your phone, you can use **an external URL** to specify where the attachment is hosted. |
| 1078 |
This could be a Dropbox link, a file from social media, or any other publicly available URL. Since the files are |
| 1079 |
externally hosted, the expiration or size limits from above do not apply here. |
| 1080 |
|
| 1081 |
To attach an external file, simple pass the `X-Attach` header or query parameter (or any of its aliases `Attach` or `a`) |
| 1082 |
to specify the attachment URL. It can be any type of file. |
| 1083 |
|
| 1084 |
ntfy will automatically try to derive the file name from the URL (e.g `https://example.com/flower.jpg` will yield a |
| 1085 |
filename `flower.jpg`). To override this filename, you may send the `X-Filename` header or query parameter (or any of its |
| 1086 |
aliases `Filename`, `File` or `f`). |
| 1087 |
|
| 1088 |
Here's an example showing how to attach an APK file: |
| 1089 |
|
| 1090 |
=== "Command line (curl)" |
| 1091 |
``` |
| 1092 |
curl \ |
| 1093 |
-X POST \ |
| 1094 |
-H "Attach: https://f-droid.org/F-Droid.apk" \ |
| 1095 |
ntfy.sh/mydownloads |
| 1096 |
``` |
| 1097 |
|
| 1098 |
=== "ntfy CLI" |
| 1099 |
``` |
| 1100 |
ntfy publish \ |
| 1101 |
--attach="https://f-droid.org/F-Droid.apk" \ |
| 1102 |
mydownloads |
| 1103 |
``` |
| 1104 |
|
| 1105 |
=== "HTTP" |
| 1106 |
``` http |
| 1107 |
POST /mydownloads HTTP/1.1 |
| 1108 |
Host: ntfy.sh |
| 1109 |
Attach: https://f-droid.org/F-Droid.apk |
| 1110 |
``` |
| 1111 |
|
| 1112 |
=== "JavaScript" |
| 1113 |
``` javascript |
| 1114 |
fetch('https://ntfy.sh/mydownloads', { |
| 1115 |
method: 'POST', |
| 1116 |
headers: { 'Attach': 'https://f-droid.org/F-Droid.apk' } |
| 1117 |
}) |
| 1118 |
``` |
| 1119 |
|
| 1120 |
=== "Go" |
| 1121 |
``` go |
| 1122 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mydownloads", file) |
| 1123 |
req.Header.Set("Attach", "https://f-droid.org/F-Droid.apk") |
| 1124 |
http.DefaultClient.Do(req) |
| 1125 |
``` |
| 1126 |
|
| 1127 |
=== "PowerShell" |
| 1128 |
``` powershell |
| 1129 |
$Request = @{ |
| 1130 |
Method = "POST" |
| 1131 |
URI = "https://ntfy.sh/mydownloads" |
| 1132 |
Headers = @{ Attach="https://f-droid.org/F-Droid.apk" } |
| 1133 |
} |
| 1134 |
Invoke-RestMethod @Request |
| 1135 |
``` |
| 1136 |
|
| 1137 |
=== "Python" |
| 1138 |
``` python |
| 1139 |
requests.put("https://ntfy.sh/mydownloads", |
| 1140 |
headers={ "Attach": "https://f-droid.org/F-Droid.apk" }) |
| 1141 |
``` |
| 1142 |
|
| 1143 |
=== "PHP" |
| 1144 |
``` php-inline |
| 1145 |
file_get_contents('https://ntfy.sh/mydownloads', false, stream_context_create([ |
| 1146 |
'http' => [ |
| 1147 |
'method' => 'PUT', |
| 1148 |
'header' => |
| 1149 |
"Content-Type: text/plain\r\n" . // Does not matter |
| 1150 |
"Attach: https://f-droid.org/F-Droid.apk", |
| 1151 |
] |
| 1152 |
])); |
| 1153 |
``` |
| 1154 |
|
| 1155 |
<figure markdown> |
| 1156 |
{ width=500 } |
| 1157 |
<figcaption>File attachment sent from an external URL</figcaption> |
| 1158 |
</figure> |
| 1159 |
|
| 1160 |
## Action buttons |
| 1161 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 1162 |
|
| 1163 |
You can add action buttons to notifications to allow yourself to react to a notification directly. This is incredibly |
| 1164 |
useful and has countless applications. |
| 1165 |
|
| 1166 |
You can control your home appliances (open/close garage door, change temperature on thermostat, ...), react to common |
| 1167 |
monitoring alerts (clear logs when disk is full, ...), and many other things. The sky is the limit. |
| 1168 |
|
| 1169 |
As of today, the following actions are supported: |
| 1170 |
|
| 1171 |
* [`view`](#open-websiteapp): Opens a website or app when the action button is tapped |
| 1172 |
* [`broadcast`](#send-android-broadcast): Sends an [Android broadcast](https://developer.android.com/guide/components/broadcasts) intent |
| 1173 |
when the action button is tapped (only supported on Android) |
| 1174 |
* [`http`](#send-http-request): Sends HTTP POST/GET/PUT request when the action button is tapped |
| 1175 |
* [`copy`](#copy-to-clipboard): Copies a given value to the clipboard when the action button is tapped |
| 1176 |
|
| 1177 |
Here's an example of what a notification with actions can look like: |
| 1178 |
|
| 1179 |
<figure markdown> |
| 1180 |
{ width=500 } |
| 1181 |
<figcaption>Notification with two user actions</figcaption> |
| 1182 |
</figure> |
| 1183 |
|
| 1184 |
### Defining actions |
| 1185 |
You can define **up to three user actions** in your notifications, using either of the following methods: |
| 1186 |
|
| 1187 |
* In the [`X-Actions` header](#using-a-header), using a simple comma-separated format |
| 1188 |
* As a [JSON array](#using-a-json-array) in the `actions` key, when [publishing as JSON](#publish-as-json) |
| 1189 |
|
| 1190 |
#### Using a header |
| 1191 |
To define actions using the `X-Actions` header (or any of its aliases: `Actions`, `Action`), use the following format: |
| 1192 |
|
| 1193 |
=== "Header format (long)" |
| 1194 |
``` |
| 1195 |
action=<action1>, label=<label1>, paramN=... [; action=<action2>, label=<label2>, ...] |
| 1196 |
``` |
| 1197 |
|
| 1198 |
=== "Header format (short)" |
| 1199 |
``` |
| 1200 |
<action1>, <label1>, paramN=... [; <action2>, <label2>, ...] |
| 1201 |
``` |
| 1202 |
|
| 1203 |
Multiple actions are separated by a semicolon (`;`), and key/value pairs are separated by commas (`,`). Values may be |
| 1204 |
quoted with double quotes (`"`) or single quotes (`'`) if the value itself contains commas or semicolons. |
| 1205 |
|
| 1206 |
Each action type has a short format where some key prefixes can be omitted: |
| 1207 |
|
| 1208 |
* [`view`](#open-websiteapp): `view, <label>, <url>[, clear=true]` |
| 1209 |
* [`broadcast`](#send-android-broadcast):`broadcast, <label>[, extras.<param>=<value>][, intent=<intent>][, clear=true]` |
| 1210 |
* [`http`](#send-http-request): `http, <label>, <url>[, method=<method>][, headers.<header>=<value>][, body=<body>][, clear=true]` |
| 1211 |
* [`copy`](#copy-to-clipboard): `copy, <label>, <value>[, clear=true]` |
| 1212 |
|
| 1213 |
As an example, here's how you can create the above notification using this format. Refer to the [`view` action](#open-websiteapp) and |
| 1214 |
[`http` action](#send-http-request) section for details on the specific actions: |
| 1215 |
|
| 1216 |
=== "Command line (curl)" |
| 1217 |
``` |
| 1218 |
body='{"temperature": 65}' |
| 1219 |
curl \ |
| 1220 |
-d "You left the house. Turn down the A/C?" \ |
| 1221 |
-H "Actions: view, Open portal, https://home.nest.com/, clear=true; \ |
| 1222 |
http, Turn down, https://api.nest.com/, body='$body'" \ |
| 1223 |
ntfy.sh/myhome |
| 1224 |
``` |
| 1225 |
|
| 1226 |
=== "ntfy CLI" |
| 1227 |
``` |
| 1228 |
body='{"temperature": 65}' |
| 1229 |
ntfy publish \ |
| 1230 |
--actions="view, Open portal, https://home.nest.com/, clear=true; \ |
| 1231 |
http, Turn down, https://api.nest.com/, body='$body'" \ |
| 1232 |
myhome \ |
| 1233 |
"You left the house. Turn down the A/C?" |
| 1234 |
``` |
| 1235 |
|
| 1236 |
=== "HTTP" |
| 1237 |
``` http |
| 1238 |
POST /myhome HTTP/1.1 |
| 1239 |
Host: ntfy.sh |
| 1240 |
Actions: view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body='{"temperature": 65}' |
| 1241 |
|
| 1242 |
You left the house. Turn down the A/C? |
| 1243 |
``` |
| 1244 |
|
| 1245 |
=== "JavaScript" |
| 1246 |
``` javascript |
| 1247 |
fetch('https://ntfy.sh/myhome', { |
| 1248 |
method: 'POST', |
| 1249 |
body: 'You left the house. Turn down the A/C?', |
| 1250 |
headers: { |
| 1251 |
'Actions': 'view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body=\'{"temperature": 65}\'' |
| 1252 |
} |
| 1253 |
}) |
| 1254 |
``` |
| 1255 |
|
| 1256 |
=== "Go" |
| 1257 |
``` go |
| 1258 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("You left the house. Turn down the A/C?")) |
| 1259 |
req.Header.Set("Actions", "view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body='{\"temperature\": 65}'") |
| 1260 |
http.DefaultClient.Do(req) |
| 1261 |
``` |
| 1262 |
|
| 1263 |
=== "PowerShell" |
| 1264 |
``` powershell |
| 1265 |
$Request = @{ |
| 1266 |
Method = "POST" |
| 1267 |
URI = "https://ntfy.sh/myhome" |
| 1268 |
Headers = @{ |
| 1269 |
Actions="view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body='{\"temperature\": 65}'" |
| 1270 |
} |
| 1271 |
Body = "You left the house. Turn down the A/C?" |
| 1272 |
} |
| 1273 |
Invoke-RestMethod @Request |
| 1274 |
``` |
| 1275 |
|
| 1276 |
=== "Python" |
| 1277 |
``` python |
| 1278 |
requests.post("https://ntfy.sh/myhome", |
| 1279 |
data="You left the house. Turn down the A/C?", |
| 1280 |
headers={ "Actions": "view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body='{\"temperature\": 65}'" }) |
| 1281 |
``` |
| 1282 |
|
| 1283 |
=== "PHP" |
| 1284 |
``` php-inline |
| 1285 |
file_get_contents('https://ntfy.sh/reddit_alerts', false, stream_context_create([ |
| 1286 |
'http' => [ |
| 1287 |
'method' => 'POST', |
| 1288 |
'header' => |
| 1289 |
"Content-Type: text/plain\r\n" . |
| 1290 |
"Actions: view, Open portal, https://home.nest.com/, clear=true; http, Turn down, https://api.nest.com/, body='{\"temperature\": 65}'", |
| 1291 |
'content' => 'You left the house. Turn down the A/C?' |
| 1292 |
] |
| 1293 |
])); |
| 1294 |
``` |
| 1295 |
|
| 1296 |
!!! info |
| 1297 |
ntfy supports UTF-8 in HTTP headers, but [not every library or programming language does](https://www.jmix.io/blog/utf-8-in-http-headers/). |
| 1298 |
If non-ASCII characters are causing issues for you in the title (i.e. you're seeing `?` symbols), you may also encode any header (including actions) |
| 1299 |
as [RFC 2047](https://datatracker.ietf.org/doc/html/rfc2047#section-2), e.g. `=?UTF-8?B?8J+HqfCfh6o=?=` ([base64](https://en.wikipedia.org/wiki/Base64)), |
| 1300 |
or `=?UTF-8?Q?=C3=84pfel?=` ([quoted-printable](https://en.wikipedia.org/wiki/Quoted-printable)). |
| 1301 |
|
| 1302 |
#### Using a JSON array |
| 1303 |
Alternatively, the same actions can be defined as **JSON array**, if the notification is defined as part of the JSON body |
| 1304 |
(see [publish as JSON](#publish-as-json)): |
| 1305 |
|
| 1306 |
=== "Command line (curl)" |
| 1307 |
``` |
| 1308 |
curl ntfy.sh \ |
| 1309 |
-d '{ |
| 1310 |
"topic": "myhome", |
| 1311 |
"message": "You left the house. Turn down the A/C?", |
| 1312 |
"actions": [ |
| 1313 |
{ |
| 1314 |
"action": "view", |
| 1315 |
"label": "Open portal", |
| 1316 |
"url": "https://home.nest.com/", |
| 1317 |
"clear": true |
| 1318 |
}, |
| 1319 |
{ |
| 1320 |
"action": "http", |
| 1321 |
"label": "Turn down", |
| 1322 |
"url": "https://api.nest.com/", |
| 1323 |
"body": "{\"temperature\": 65}" |
| 1324 |
} |
| 1325 |
] |
| 1326 |
}' |
| 1327 |
``` |
| 1328 |
|
| 1329 |
=== "ntfy CLI" |
| 1330 |
``` |
| 1331 |
ntfy publish \ |
| 1332 |
--actions '[ |
| 1333 |
{ |
| 1334 |
"action": "view", |
| 1335 |
"label": "Open portal", |
| 1336 |
"url": "https://home.nest.com/", |
| 1337 |
"clear": true |
| 1338 |
}, |
| 1339 |
{ |
| 1340 |
"action": "http", |
| 1341 |
"label": "Turn down", |
| 1342 |
"url": "https://api.nest.com/", |
| 1343 |
"body": "{\"temperature\": 65}" |
| 1344 |
} |
| 1345 |
]' \ |
| 1346 |
myhome \ |
| 1347 |
"You left the house. Turn down the A/C?" |
| 1348 |
``` |
| 1349 |
|
| 1350 |
=== "HTTP" |
| 1351 |
``` http |
| 1352 |
POST / HTTP/1.1 |
| 1353 |
Host: ntfy.sh |
| 1354 |
|
| 1355 |
{ |
| 1356 |
"topic": "myhome", |
| 1357 |
"message": "You left the house. Turn down the A/C?", |
| 1358 |
"actions": [ |
| 1359 |
{ |
| 1360 |
"action": "view", |
| 1361 |
"label": "Open portal", |
| 1362 |
"url": "https://home.nest.com/", |
| 1363 |
"clear": true |
| 1364 |
}, |
| 1365 |
{ |
| 1366 |
"action": "http", |
| 1367 |
"label": "Turn down", |
| 1368 |
"url": "https://api.nest.com/", |
| 1369 |
"body": "{\"temperature\": 65}" |
| 1370 |
} |
| 1371 |
] |
| 1372 |
} |
| 1373 |
``` |
| 1374 |
|
| 1375 |
=== "JavaScript" |
| 1376 |
``` javascript |
| 1377 |
fetch('https://ntfy.sh', { |
| 1378 |
method: 'POST', |
| 1379 |
body: JSON.stringify({ |
| 1380 |
topic: "myhome", |
| 1381 |
message: "You left the house. Turn down the A/C?", |
| 1382 |
actions: [ |
| 1383 |
{ |
| 1384 |
action: "view", |
| 1385 |
label: "Open portal", |
| 1386 |
url: "https://home.nest.com/", |
| 1387 |
clear: true |
| 1388 |
}, |
| 1389 |
{ |
| 1390 |
action: "http", |
| 1391 |
label: "Turn down", |
| 1392 |
url: "https://api.nest.com/", |
| 1393 |
body: "{\"temperature\": 65}" |
| 1394 |
} |
| 1395 |
] |
| 1396 |
}) |
| 1397 |
}) |
| 1398 |
``` |
| 1399 |
|
| 1400 |
=== "Go" |
| 1401 |
``` go |
| 1402 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 1403 |
// but for the sake of the example, this is easier. |
| 1404 |
|
| 1405 |
body := `{ |
| 1406 |
"topic": "myhome", |
| 1407 |
"message": "You left the house. Turn down the A/C?", |
| 1408 |
"actions": [ |
| 1409 |
{ |
| 1410 |
"action": "view", |
| 1411 |
"label": "Open portal", |
| 1412 |
"url": "https://home.nest.com/", |
| 1413 |
"clear": true |
| 1414 |
}, |
| 1415 |
{ |
| 1416 |
"action": "http", |
| 1417 |
"label": "Turn down", |
| 1418 |
"url": "https://api.nest.com/", |
| 1419 |
"body": "{\"temperature\": 65}" |
| 1420 |
} |
| 1421 |
] |
| 1422 |
}` |
| 1423 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 1424 |
http.DefaultClient.Do(req) |
| 1425 |
``` |
| 1426 |
|
| 1427 |
=== "PowerShell" |
| 1428 |
``` powershell |
| 1429 |
$Request = @{ |
| 1430 |
Method = "POST" |
| 1431 |
URI = "https://ntfy.sh" |
| 1432 |
Body = ConvertTo-JSON @{ |
| 1433 |
Topic = "myhome" |
| 1434 |
Message = "You left the house. Turn down the A/C?" |
| 1435 |
Actions = @( |
| 1436 |
@{ |
| 1437 |
Action = "view" |
| 1438 |
Label = "Open portal" |
| 1439 |
URL = "https://home.nest.com/" |
| 1440 |
Clear = $true |
| 1441 |
}, |
| 1442 |
@{ |
| 1443 |
Action = "http" |
| 1444 |
Label = "Turn down" |
| 1445 |
URL = "https://api.nest.com/" |
| 1446 |
Body = '{"temperature": 65}' |
| 1447 |
} |
| 1448 |
) |
| 1449 |
} |
| 1450 |
ContentType = "application/json" |
| 1451 |
} |
| 1452 |
Invoke-RestMethod @Request |
| 1453 |
``` |
| 1454 |
|
| 1455 |
=== "Python" |
| 1456 |
``` python |
| 1457 |
requests.post("https://ntfy.sh/", |
| 1458 |
data=json.dumps({ |
| 1459 |
"topic": "myhome", |
| 1460 |
"message": "You left the house. Turn down the A/C?", |
| 1461 |
"actions": [ |
| 1462 |
{ |
| 1463 |
"action": "view", |
| 1464 |
"label": "Open portal", |
| 1465 |
"url": "https://home.nest.com/", |
| 1466 |
"clear": true |
| 1467 |
}, |
| 1468 |
{ |
| 1469 |
"action": "http", |
| 1470 |
"label": "Turn down", |
| 1471 |
"url": "https://api.nest.com/", |
| 1472 |
"body": "{\"temperature\": 65}" |
| 1473 |
} |
| 1474 |
] |
| 1475 |
}) |
| 1476 |
) |
| 1477 |
``` |
| 1478 |
|
| 1479 |
=== "PHP" |
| 1480 |
``` php-inline |
| 1481 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 1482 |
'http' => [ |
| 1483 |
'method' => 'POST', |
| 1484 |
'header' => "Content-Type: application/json", |
| 1485 |
'content' => json_encode([ |
| 1486 |
"topic": "myhome", |
| 1487 |
"message": "You left the house. Turn down the A/C?", |
| 1488 |
"actions": [ |
| 1489 |
[ |
| 1490 |
"action": "view", |
| 1491 |
"label": "Open portal", |
| 1492 |
"url": "https://home.nest.com/", |
| 1493 |
"clear": true |
| 1494 |
], |
| 1495 |
[ |
| 1496 |
"action": "http", |
| 1497 |
"label": "Turn down", |
| 1498 |
"url": "https://api.nest.com/", |
| 1499 |
"headers": [ |
| 1500 |
"Authorization": "Bearer ..." |
| 1501 |
], |
| 1502 |
"body": "{\"temperature\": 65}" |
| 1503 |
] |
| 1504 |
] |
| 1505 |
]) |
| 1506 |
] |
| 1507 |
])); |
| 1508 |
``` |
| 1509 |
|
| 1510 |
The required/optional fields for each action depend on the type of the action itself. Please refer to |
| 1511 |
[`view` action](#open-websiteapp), [`broadcast` action](#send-android-broadcast), [`http` action](#send-http-request), |
| 1512 |
and [`copy` action](#copy-to-clipboard) for details. |
| 1513 |
|
| 1514 |
### Open website/app |
| 1515 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 1516 |
|
| 1517 |
The `view` action **opens a website or app when the action button is tapped**, e.g. a browser, a Google Maps location, or |
| 1518 |
even a deep link into Twitter or a show ntfy topic. How exactly the action is handled depends on how Android and your |
| 1519 |
desktop browser treat the links. Normally it'll just open a link in the browser. |
| 1520 |
|
| 1521 |
Examples: |
| 1522 |
|
| 1523 |
* `http://` or `https://` will open your browser (or an app if it registered for a URL) |
| 1524 |
* `mailto:` links will open your mail app, e.g. `mailto:[email protected]` |
| 1525 |
* `geo:` links will open Google Maps, e.g. `geo:0,0?q=1600+Amphitheatre+Parkway,+Mountain+View,+CA` |
| 1526 |
* `ntfy://` links will open ntfy (see [ntfy:// links](subscribe/phone.md#ntfy-links)), e.g. `ntfy://ntfy.sh/stats` |
| 1527 |
* `twitter://` links will open Twitter, e.g. `twitter://user?screen_name=..` |
| 1528 |
* ... |
| 1529 |
|
| 1530 |
Here's an example using the [`X-Actions` header](#using-a-header): |
| 1531 |
|
| 1532 |
=== "Command line (curl)" |
| 1533 |
``` |
| 1534 |
curl \ |
| 1535 |
-d "Somebody retweeted your tweet." \ |
| 1536 |
-H "Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \ |
| 1537 |
ntfy.sh/myhome |
| 1538 |
``` |
| 1539 |
|
| 1540 |
=== "ntfy CLI" |
| 1541 |
``` |
| 1542 |
ntfy publish \ |
| 1543 |
--actions="view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" \ |
| 1544 |
myhome \ |
| 1545 |
"Somebody retweeted your tweet." |
| 1546 |
``` |
| 1547 |
|
| 1548 |
=== "HTTP" |
| 1549 |
``` http |
| 1550 |
POST /myhome HTTP/1.1 |
| 1551 |
Host: ntfy.sh |
| 1552 |
Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392 |
| 1553 |
|
| 1554 |
Somebody retweeted your tweet. |
| 1555 |
``` |
| 1556 |
|
| 1557 |
=== "JavaScript" |
| 1558 |
``` javascript |
| 1559 |
fetch('https://ntfy.sh/myhome', { |
| 1560 |
method: 'POST', |
| 1561 |
body: 'Somebody retweeted your tweet.', |
| 1562 |
headers: { |
| 1563 |
'Actions': 'view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392' |
| 1564 |
} |
| 1565 |
}) |
| 1566 |
``` |
| 1567 |
|
| 1568 |
=== "Go" |
| 1569 |
``` go |
| 1570 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("Somebody retweeted your tweet.")) |
| 1571 |
req.Header.Set("Actions", "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392") |
| 1572 |
http.DefaultClient.Do(req) |
| 1573 |
``` |
| 1574 |
|
| 1575 |
=== "PowerShell" |
| 1576 |
``` powershell |
| 1577 |
$Request = @{ |
| 1578 |
Method = "POST" |
| 1579 |
URI = "https://ntfy.sh/myhome" |
| 1580 |
Headers = @{ |
| 1581 |
Actions = "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1582 |
} |
| 1583 |
Body = "Somebody retweeted your tweet." |
| 1584 |
} |
| 1585 |
Invoke-RestMethod @Request |
| 1586 |
``` |
| 1587 |
|
| 1588 |
=== "Python" |
| 1589 |
``` python |
| 1590 |
requests.post("https://ntfy.sh/myhome", |
| 1591 |
data="Somebody retweeted your tweet.", |
| 1592 |
headers={ "Actions": "view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392" }) |
| 1593 |
``` |
| 1594 |
|
| 1595 |
=== "PHP" |
| 1596 |
``` php-inline |
| 1597 |
file_get_contents('https://ntfy.sh/reddit_alerts', false, stream_context_create([ |
| 1598 |
'http' => [ |
| 1599 |
'method' => 'POST', |
| 1600 |
'header' => |
| 1601 |
"Content-Type: text/plain\r\n" . |
| 1602 |
"Actions: view, Open Twitter, https://twitter.com/binwiederhier/status/1467633927951163392", |
| 1603 |
'content' => 'Somebody retweeted your tweet.' |
| 1604 |
] |
| 1605 |
])); |
| 1606 |
``` |
| 1607 |
|
| 1608 |
And the same example using [JSON publishing](#publish-as-json): |
| 1609 |
|
| 1610 |
=== "Command line (curl)" |
| 1611 |
``` |
| 1612 |
curl ntfy.sh \ |
| 1613 |
-d '{ |
| 1614 |
"topic": "myhome", |
| 1615 |
"message": "Somebody retweeted your tweet.", |
| 1616 |
"actions": [ |
| 1617 |
{ |
| 1618 |
"action": "view", |
| 1619 |
"label": "Open Twitter", |
| 1620 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1621 |
} |
| 1622 |
] |
| 1623 |
}' |
| 1624 |
``` |
| 1625 |
|
| 1626 |
=== "ntfy CLI" |
| 1627 |
``` |
| 1628 |
ntfy publish \ |
| 1629 |
--actions '[ |
| 1630 |
{ |
| 1631 |
"action": "view", |
| 1632 |
"label": "Open Twitter", |
| 1633 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1634 |
} |
| 1635 |
]' \ |
| 1636 |
myhome \ |
| 1637 |
"Somebody retweeted your tweet." |
| 1638 |
``` |
| 1639 |
|
| 1640 |
=== "HTTP" |
| 1641 |
``` http |
| 1642 |
POST / HTTP/1.1 |
| 1643 |
Host: ntfy.sh |
| 1644 |
|
| 1645 |
{ |
| 1646 |
"topic": "myhome", |
| 1647 |
"message": "Somebody retweeted your tweet.", |
| 1648 |
"actions": [ |
| 1649 |
{ |
| 1650 |
"action": "view", |
| 1651 |
"label": "Open Twitter", |
| 1652 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1653 |
} |
| 1654 |
] |
| 1655 |
} |
| 1656 |
``` |
| 1657 |
|
| 1658 |
=== "JavaScript" |
| 1659 |
``` javascript |
| 1660 |
fetch('https://ntfy.sh', { |
| 1661 |
method: 'POST', |
| 1662 |
body: JSON.stringify({ |
| 1663 |
topic: "myhome", |
| 1664 |
message: "Somebody retweeted your tweet.", |
| 1665 |
actions: [ |
| 1666 |
{ |
| 1667 |
action: "view", |
| 1668 |
label: "Open Twitter", |
| 1669 |
url: "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1670 |
} |
| 1671 |
] |
| 1672 |
}) |
| 1673 |
}) |
| 1674 |
``` |
| 1675 |
|
| 1676 |
=== "Go" |
| 1677 |
``` go |
| 1678 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 1679 |
// but for the sake of the example, this is easier. |
| 1680 |
|
| 1681 |
body := `{ |
| 1682 |
"topic": "myhome", |
| 1683 |
"message": "Somebody retweeted your tweet.", |
| 1684 |
"actions": [ |
| 1685 |
{ |
| 1686 |
"action": "view", |
| 1687 |
"label": "Open Twitter", |
| 1688 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1689 |
} |
| 1690 |
] |
| 1691 |
}` |
| 1692 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 1693 |
http.DefaultClient.Do(req) |
| 1694 |
``` |
| 1695 |
|
| 1696 |
=== "PowerShell" |
| 1697 |
``` powershell |
| 1698 |
$Request = @{ |
| 1699 |
Method = "POST" |
| 1700 |
URI = "https://ntfy.sh" |
| 1701 |
Body = ConvertTo-JSON @{ |
| 1702 |
Topic = "myhome" |
| 1703 |
Message = "Somebody retweeted your tweet." |
| 1704 |
Actions = @( |
| 1705 |
@{ |
| 1706 |
Action = "view" |
| 1707 |
Label = "Open Twitter" |
| 1708 |
URL = "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1709 |
} |
| 1710 |
) |
| 1711 |
} |
| 1712 |
ContentType = "application/json" |
| 1713 |
} |
| 1714 |
Invoke-RestMethod @Request |
| 1715 |
``` |
| 1716 |
|
| 1717 |
=== "Python" |
| 1718 |
``` python |
| 1719 |
requests.post("https://ntfy.sh/", |
| 1720 |
data=json.dumps({ |
| 1721 |
"topic": "myhome", |
| 1722 |
"message": "Somebody retweeted your tweet.", |
| 1723 |
"actions": [ |
| 1724 |
{ |
| 1725 |
"action": "view", |
| 1726 |
"label": "Open Twitter", |
| 1727 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1728 |
} |
| 1729 |
] |
| 1730 |
}) |
| 1731 |
) |
| 1732 |
``` |
| 1733 |
|
| 1734 |
=== "PHP" |
| 1735 |
``` php-inline |
| 1736 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 1737 |
'http' => [ |
| 1738 |
'method' => 'POST', |
| 1739 |
'header' => "Content-Type: application/json", |
| 1740 |
'content' => json_encode([ |
| 1741 |
"topic": "myhome", |
| 1742 |
"message": "Somebody retweeted your tweet.", |
| 1743 |
"actions": [ |
| 1744 |
[ |
| 1745 |
"action": "view", |
| 1746 |
"label": "Open Twitter", |
| 1747 |
"url": "https://twitter.com/binwiederhier/status/1467633927951163392" |
| 1748 |
] |
| 1749 |
] |
| 1750 |
]) |
| 1751 |
] |
| 1752 |
])); |
| 1753 |
``` |
| 1754 |
|
| 1755 |
The short format for the `view` action is `view, <label>, <url>` (e.g. `view, Open Google, https://google.com`), |
| 1756 |
but you can always just use the `<key>=<value>` notation as well (e.g. `action=view, url=https://google.com, label=Open Google`). |
| 1757 |
|
| 1758 |
The `view` action supports the following fields: |
| 1759 |
|
| 1760 |
| Field | Required | Type | Default | Example | Description | |
| 1761 |
|----------|----------|-----------|---------|-----------------------|--------------------------------------------------| |
| 1762 |
| `action` | ✔️ | *string* | - | `view` | Action type (**must be `view`**) | |
| 1763 |
| `label` | ✔️ | *string* | - | `Turn on light` | Label of the action button in the notification | |
| 1764 |
| `url` | ✔️ | *URL* | - | `https://example.com` | URL to open when action is tapped | |
| 1765 |
| `clear` | -️ | *boolean* | `false` | `true` | Clear notification after action button is tapped | |
| 1766 |
|
| 1767 |
### Send Android broadcast |
| 1768 |
_Supported on:_ :material-android: |
| 1769 |
|
| 1770 |
The `broadcast` action **sends an [Android broadcast](https://developer.android.com/guide/components/broadcasts) intent |
| 1771 |
when the action button is tapped**. This allows integration into automation apps such as [MacroDroid](https://play.google.com/store/apps/details?id=com.arlosoft.macrodroid) |
| 1772 |
or [Tasker](https://play.google.com/store/apps/details?id=net.dinglisch.android.taskerm), which basically means |
| 1773 |
you can do everything your phone is capable of. Examples include taking pictures, launching/killing apps, change device |
| 1774 |
settings, write/read files, etc. |
| 1775 |
|
| 1776 |
By default, the intent action **`io.heckel.ntfy.USER_ACTION`** is broadcast, though this can be changed with the `intent` parameter (see below). |
| 1777 |
To send extras, use the `extras` parameter. Currently, **only string extras are supported**. |
| 1778 |
|
| 1779 |
!!! info |
| 1780 |
If you have no idea what this is, check out the [automation apps](subscribe/phone.md#automation-apps) section, which shows |
| 1781 |
how to integrate Tasker and MacroDroid **with screenshots**. The action button integration is identical, except that |
| 1782 |
you have to use **the intent action `io.heckel.ntfy.USER_ACTION`** instead. |
| 1783 |
|
| 1784 |
Here's an example using the [`X-Actions` header](#using-a-header): |
| 1785 |
|
| 1786 |
=== "Command line (curl)" |
| 1787 |
``` |
| 1788 |
curl \ |
| 1789 |
-d "Your wife requested you send a picture of yourself." \ |
| 1790 |
-H "Actions: broadcast, Take picture, extras.cmd=pic, extras.camera=front" \ |
| 1791 |
ntfy.sh/wifey |
| 1792 |
``` |
| 1793 |
|
| 1794 |
=== "ntfy CLI" |
| 1795 |
``` |
| 1796 |
ntfy publish \ |
| 1797 |
--actions="broadcast, Take picture, extras.cmd=pic, extras.camera=front" \ |
| 1798 |
wifey \ |
| 1799 |
"Your wife requested you send a picture of yourself." |
| 1800 |
``` |
| 1801 |
|
| 1802 |
=== "HTTP" |
| 1803 |
``` http |
| 1804 |
POST /wifey HTTP/1.1 |
| 1805 |
Host: ntfy.sh |
| 1806 |
Actions: broadcast, Take picture, extras.cmd=pic, extras.camera=front |
| 1807 |
|
| 1808 |
Your wife requested you send a picture of yourself. |
| 1809 |
``` |
| 1810 |
|
| 1811 |
=== "JavaScript" |
| 1812 |
``` javascript |
| 1813 |
fetch('https://ntfy.sh/wifey', { |
| 1814 |
method: 'POST', |
| 1815 |
body: 'Your wife requested you send a picture of yourself.', |
| 1816 |
headers: { |
| 1817 |
'Actions': 'broadcast, Take picture, extras.cmd=pic, extras.camera=front' |
| 1818 |
} |
| 1819 |
}) |
| 1820 |
``` |
| 1821 |
|
| 1822 |
=== "Go" |
| 1823 |
``` go |
| 1824 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/wifey", strings.NewReader("Your wife requested you send a picture of yourself.")) |
| 1825 |
req.Header.Set("Actions", "broadcast, Take picture, extras.cmd=pic, extras.camera=front") |
| 1826 |
http.DefaultClient.Do(req) |
| 1827 |
``` |
| 1828 |
|
| 1829 |
=== "PowerShell" |
| 1830 |
``` powershell |
| 1831 |
$Request = @{ |
| 1832 |
Method = "POST" |
| 1833 |
URI = "https://ntfy.sh/wifey" |
| 1834 |
Headers = @{ |
| 1835 |
Actions = "broadcast, Take picture, extras.cmd=pic, extras.camera=front" |
| 1836 |
} |
| 1837 |
Body = "Your wife requested you send a picture of yourself." |
| 1838 |
} |
| 1839 |
Invoke-RestMethod @Request |
| 1840 |
``` |
| 1841 |
|
| 1842 |
=== "Python" |
| 1843 |
``` python |
| 1844 |
requests.post("https://ntfy.sh/wifey", |
| 1845 |
data="Your wife requested you send a picture of yourself.", |
| 1846 |
headers={ "Actions": "broadcast, Take picture, extras.cmd=pic, extras.camera=front" }) |
| 1847 |
``` |
| 1848 |
|
| 1849 |
=== "PHP" |
| 1850 |
``` php-inline |
| 1851 |
file_get_contents('https://ntfy.sh/wifey', false, stream_context_create([ |
| 1852 |
'http' => [ |
| 1853 |
'method' => 'POST', |
| 1854 |
'header' => |
| 1855 |
"Content-Type: text/plain\r\n" . |
| 1856 |
"Actions: broadcast, Take picture, extras.cmd=pic, extras.camera=front", |
| 1857 |
'content' => 'Your wife requested you send a picture of yourself.' |
| 1858 |
] |
| 1859 |
])); |
| 1860 |
``` |
| 1861 |
|
| 1862 |
And the same example using [JSON publishing](#publish-as-json): |
| 1863 |
|
| 1864 |
=== "Command line (curl)" |
| 1865 |
``` |
| 1866 |
curl ntfy.sh \ |
| 1867 |
-d '{ |
| 1868 |
"topic": "wifey", |
| 1869 |
"message": "Your wife requested you send a picture of yourself.", |
| 1870 |
"actions": [ |
| 1871 |
{ |
| 1872 |
"action": "broadcast", |
| 1873 |
"label": "Take picture", |
| 1874 |
"extras": { |
| 1875 |
"cmd": "pic", |
| 1876 |
"camera": "front" |
| 1877 |
} |
| 1878 |
} |
| 1879 |
] |
| 1880 |
}' |
| 1881 |
``` |
| 1882 |
|
| 1883 |
=== "ntfy CLI" |
| 1884 |
``` |
| 1885 |
ntfy publish \ |
| 1886 |
--actions '[ |
| 1887 |
{ |
| 1888 |
"action": "broadcast", |
| 1889 |
"label": "Take picture", |
| 1890 |
"extras": { |
| 1891 |
"cmd": "pic", |
| 1892 |
"camera": "front" |
| 1893 |
} |
| 1894 |
} |
| 1895 |
]' \ |
| 1896 |
wifey \ |
| 1897 |
"Your wife requested you send a picture of yourself." |
| 1898 |
``` |
| 1899 |
|
| 1900 |
=== "HTTP" |
| 1901 |
``` http |
| 1902 |
POST / HTTP/1.1 |
| 1903 |
Host: ntfy.sh |
| 1904 |
|
| 1905 |
{ |
| 1906 |
"topic": "wifey", |
| 1907 |
"message": "Your wife requested you send a picture of yourself.", |
| 1908 |
"actions": [ |
| 1909 |
{ |
| 1910 |
"action": "broadcast", |
| 1911 |
"label": "Take picture", |
| 1912 |
"extras": { |
| 1913 |
"cmd": "pic", |
| 1914 |
"camera": "front" |
| 1915 |
} |
| 1916 |
} |
| 1917 |
] |
| 1918 |
} |
| 1919 |
``` |
| 1920 |
|
| 1921 |
=== "JavaScript" |
| 1922 |
``` javascript |
| 1923 |
fetch('https://ntfy.sh', { |
| 1924 |
method: 'POST', |
| 1925 |
body: JSON.stringify({ |
| 1926 |
topic: "wifey", |
| 1927 |
message: "Your wife requested you send a picture of yourself.", |
| 1928 |
actions: [ |
| 1929 |
{ |
| 1930 |
"action": "broadcast", |
| 1931 |
"label": "Take picture", |
| 1932 |
"extras": { |
| 1933 |
"cmd": "pic", |
| 1934 |
"camera": "front" |
| 1935 |
} |
| 1936 |
} |
| 1937 |
] |
| 1938 |
}) |
| 1939 |
}) |
| 1940 |
``` |
| 1941 |
|
| 1942 |
=== "Go" |
| 1943 |
``` go |
| 1944 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 1945 |
// but for the sake of the example, this is easier. |
| 1946 |
|
| 1947 |
body := `{ |
| 1948 |
"topic": "wifey", |
| 1949 |
"message": "Your wife requested you send a picture of yourself.", |
| 1950 |
"actions": [ |
| 1951 |
{ |
| 1952 |
"action": "broadcast", |
| 1953 |
"label": "Take picture", |
| 1954 |
"extras": { |
| 1955 |
"cmd": "pic", |
| 1956 |
"camera": "front" |
| 1957 |
} |
| 1958 |
} |
| 1959 |
] |
| 1960 |
}` |
| 1961 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 1962 |
http.DefaultClient.Do(req) |
| 1963 |
``` |
| 1964 |
|
| 1965 |
=== "PowerShell" |
| 1966 |
``` powershell |
| 1967 |
# Powershell requires the 'Depth' argument to equal 3 here to expand 'Extras', |
| 1968 |
# otherwise it will read System.Collections.Hashtable in the returned JSON |
| 1969 |
$Request = @{ |
| 1970 |
Method = "POST" |
| 1971 |
URI = "https://ntfy.sh" |
| 1972 |
Body = ConvertTo-Json -Depth 3 @{ |
| 1973 |
Topic = "wifey" |
| 1974 |
Message = "Your wife requested you send a picture of yourself." |
| 1975 |
Actions = @( |
| 1976 |
@{ |
| 1977 |
Action = "broadcast" |
| 1978 |
Label = "Take picture" |
| 1979 |
Extras = @{ |
| 1980 |
CMD ="pic" |
| 1981 |
Camera = "front" |
| 1982 |
} |
| 1983 |
} |
| 1984 |
) |
| 1985 |
} |
| 1986 |
ContentType = "application/json" |
| 1987 |
} |
| 1988 |
Invoke-RestMethod @Request |
| 1989 |
``` |
| 1990 |
|
| 1991 |
=== "Python" |
| 1992 |
``` python |
| 1993 |
requests.post("https://ntfy.sh/", |
| 1994 |
data=json.dumps({ |
| 1995 |
"topic": "wifey", |
| 1996 |
"message": "Your wife requested you send a picture of yourself.", |
| 1997 |
"actions": [ |
| 1998 |
{ |
| 1999 |
"action": "broadcast", |
| 2000 |
"label": "Take picture", |
| 2001 |
"extras": { |
| 2002 |
"cmd": "pic", |
| 2003 |
"camera": "front" |
| 2004 |
} |
| 2005 |
} |
| 2006 |
] |
| 2007 |
}) |
| 2008 |
) |
| 2009 |
``` |
| 2010 |
|
| 2011 |
=== "PHP" |
| 2012 |
``` php-inline |
| 2013 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 2014 |
'http' => [ |
| 2015 |
'method' => 'POST', |
| 2016 |
'header' => "Content-Type: application/json", |
| 2017 |
'content' => json_encode([ |
| 2018 |
"topic": "wifey", |
| 2019 |
"message": "Your wife requested you send a picture of yourself.", |
| 2020 |
"actions": [ |
| 2021 |
[ |
| 2022 |
"action": "broadcast", |
| 2023 |
"label": "Take picture", |
| 2024 |
"extras": [ |
| 2025 |
"cmd": "pic", |
| 2026 |
"camera": "front" |
| 2027 |
] |
| 2028 |
] |
| 2029 |
]) |
| 2030 |
] |
| 2031 |
])); |
| 2032 |
``` |
| 2033 |
|
| 2034 |
The short format for the `broadcast` action is `broadcast, <label>, <url>` (e.g. `broadcast, Take picture, extras.cmd=pic`), |
| 2035 |
but you can always just use the `<key>=<value>` notation as well (e.g. `action=broadcast, label=Take picture, extras.cmd=pic`). |
| 2036 |
|
| 2037 |
The `broadcast` action supports the following fields: |
| 2038 |
|
| 2039 |
| Field | Required | Type | Default | Example | Description | |
| 2040 |
|----------|----------|------------------|------------------------------|-------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 2041 |
| `action` | ✔️ | *string* | - | `broadcast` | Action type (**must be `broadcast`**) | |
| 2042 |
| `label` | ✔️ | *string* | - | `Turn on light` | Label of the action button in the notification | |
| 2043 |
| `intent` | -️ | *string* | `io.heckel.ntfy.USER_ACTION` | `com.example.AN_INTENT` | Android intent name, **default is `io.heckel.ntfy.USER_ACTION`** | |
| 2044 |
| `extras` | -️ | *map of strings* | - | *see above* | Android intent extras. Currently, only string extras are supported. When publishing as JSON, extras are passed as a map. When the simple format is used, use `extras.<param>=<value>`. | |
| 2045 |
| `clear` | -️ | *boolean* | `false` | `true` | Clear notification after action button is tapped | |
| 2046 |
|
| 2047 |
### Send HTTP request |
| 2048 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 2049 |
|
| 2050 |
The `http` action **sends a HTTP request when the action button is tapped**. You can use this to trigger REST APIs |
| 2051 |
for whatever systems you have, e.g. opening the garage door, or turning on/off lights. |
| 2052 |
|
| 2053 |
By default, this action sends a **POST request** (not GET!), though this can be changed with the `method` parameter. |
| 2054 |
The only required parameter is `url`. Headers can be passed along using the `headers` parameter. |
| 2055 |
|
| 2056 |
Here's an example using the [`X-Actions` header](#using-a-header): |
| 2057 |
|
| 2058 |
=== "Command line (curl)" |
| 2059 |
``` |
| 2060 |
curl \ |
| 2061 |
-d "Garage door has been open for 15 minutes. Close it?" \ |
| 2062 |
-H "Actions: http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}" \ |
| 2063 |
ntfy.sh/myhome |
| 2064 |
``` |
| 2065 |
|
| 2066 |
=== "ntfy CLI" |
| 2067 |
``` |
| 2068 |
ntfy publish \ |
| 2069 |
--actions="http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}" \ |
| 2070 |
myhome \ |
| 2071 |
"Garage door has been open for 15 minutes. Close it?" |
| 2072 |
``` |
| 2073 |
|
| 2074 |
=== "HTTP" |
| 2075 |
``` http |
| 2076 |
POST /myhome HTTP/1.1 |
| 2077 |
Host: ntfy.sh |
| 2078 |
Actions: http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={"action": "close"} |
| 2079 |
|
| 2080 |
Garage door has been open for 15 minutes. Close it? |
| 2081 |
``` |
| 2082 |
|
| 2083 |
=== "JavaScript" |
| 2084 |
``` javascript |
| 2085 |
fetch('https://ntfy.sh/myhome', { |
| 2086 |
method: 'POST', |
| 2087 |
body: 'Garage door has been open for 15 minutes. Close it?', |
| 2088 |
headers: { |
| 2089 |
'Actions': 'http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}' |
| 2090 |
} |
| 2091 |
}) |
| 2092 |
``` |
| 2093 |
|
| 2094 |
=== "Go" |
| 2095 |
``` go |
| 2096 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("Garage door has been open for 15 minutes. Close it?")) |
| 2097 |
req.Header.Set("Actions", "http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}") |
| 2098 |
http.DefaultClient.Do(req) |
| 2099 |
``` |
| 2100 |
|
| 2101 |
=== "PowerShell" |
| 2102 |
``` powershell |
| 2103 |
$Request = @{ |
| 2104 |
Method = "POST" |
| 2105 |
URI = "https://ntfy.sh/myhome" |
| 2106 |
Headers = @{ |
| 2107 |
Actions="http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}" |
| 2108 |
} |
| 2109 |
Body = "Garage door has been open for 15 minutes. Close it?" |
| 2110 |
} |
| 2111 |
Invoke-RestMethod @Request |
| 2112 |
``` |
| 2113 |
|
| 2114 |
=== "Python" |
| 2115 |
``` python |
| 2116 |
requests.post("https://ntfy.sh/myhome", |
| 2117 |
data="Garage door has been open for 15 minutes. Close it?", |
| 2118 |
headers={ "Actions": "http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}" }) |
| 2119 |
``` |
| 2120 |
|
| 2121 |
=== "PHP" |
| 2122 |
``` php-inline |
| 2123 |
file_get_contents('https://ntfy.sh/reddit_alerts', false, stream_context_create([ |
| 2124 |
'http' => [ |
| 2125 |
'method' => 'POST', |
| 2126 |
'header' => |
| 2127 |
"Content-Type: text/plain\r\n" . |
| 2128 |
'Actions: http, Close door, https://api.mygarage.lan/, method=PUT, headers.Authorization=Bearer zAzsx1sk.., body={\"action\": \"close\"}', |
| 2129 |
'content' => 'Garage door has been open for 15 minutes. Close it?' |
| 2130 |
] |
| 2131 |
])); |
| 2132 |
``` |
| 2133 |
|
| 2134 |
And the same example using [JSON publishing](#publish-as-json): |
| 2135 |
|
| 2136 |
=== "Command line (curl)" |
| 2137 |
``` |
| 2138 |
curl ntfy.sh \ |
| 2139 |
-d '{ |
| 2140 |
"topic": "myhome", |
| 2141 |
"message": "Garage door has been open for 15 minutes. Close it?", |
| 2142 |
"actions": [ |
| 2143 |
{ |
| 2144 |
"action": "http", |
| 2145 |
"label": "Close door", |
| 2146 |
"url": "https://api.mygarage.lan/", |
| 2147 |
"method": "PUT", |
| 2148 |
"headers": { |
| 2149 |
"Authorization": "Bearer zAzsx1sk.." |
| 2150 |
}, |
| 2151 |
"body": "{\"action\": \"close\"}" |
| 2152 |
} |
| 2153 |
] |
| 2154 |
}' |
| 2155 |
``` |
| 2156 |
|
| 2157 |
=== "ntfy CLI" |
| 2158 |
``` |
| 2159 |
ntfy publish \ |
| 2160 |
--actions '[ |
| 2161 |
{ |
| 2162 |
"action": "http", |
| 2163 |
"label": "Close door", |
| 2164 |
"url": "https://api.mygarage.lan/", |
| 2165 |
"method": "PUT", |
| 2166 |
"headers": { |
| 2167 |
"Authorization": "Bearer zAzsx1sk.." |
| 2168 |
}, |
| 2169 |
"body": "{\"action\": \"close\"}" |
| 2170 |
} |
| 2171 |
]' \ |
| 2172 |
myhome \ |
| 2173 |
"Garage door has been open for 15 minutes. Close it?" |
| 2174 |
``` |
| 2175 |
|
| 2176 |
=== "HTTP" |
| 2177 |
``` http |
| 2178 |
POST / HTTP/1.1 |
| 2179 |
Host: ntfy.sh |
| 2180 |
|
| 2181 |
{ |
| 2182 |
"topic": "myhome", |
| 2183 |
"message": "Garage door has been open for 15 minutes. Close it?", |
| 2184 |
"actions": [ |
| 2185 |
{ |
| 2186 |
"action": "http", |
| 2187 |
"label": "Close door", |
| 2188 |
"url": "https://api.mygarage.lan/", |
| 2189 |
"method": "PUT", |
| 2190 |
"headers": { |
| 2191 |
"Authorization": "Bearer zAzsx1sk.." |
| 2192 |
}, |
| 2193 |
"body": "{\"action\": \"close\"}" |
| 2194 |
} |
| 2195 |
] |
| 2196 |
} |
| 2197 |
``` |
| 2198 |
|
| 2199 |
=== "JavaScript" |
| 2200 |
``` javascript |
| 2201 |
fetch('https://ntfy.sh', { |
| 2202 |
method: 'POST', |
| 2203 |
body: JSON.stringify({ |
| 2204 |
topic: "myhome", |
| 2205 |
message: "Garage door has been open for 15 minutes. Close it?", |
| 2206 |
actions: [ |
| 2207 |
{ |
| 2208 |
"action": "http", |
| 2209 |
"label": "Close door", |
| 2210 |
"url": "https://api.mygarage.lan/", |
| 2211 |
"method": "PUT", |
| 2212 |
"headers": { |
| 2213 |
"Authorization": "Bearer zAzsx1sk.." |
| 2214 |
}, |
| 2215 |
"body": "{\"action\": \"close\"}" |
| 2216 |
} |
| 2217 |
] |
| 2218 |
}) |
| 2219 |
}) |
| 2220 |
``` |
| 2221 |
|
| 2222 |
=== "Go" |
| 2223 |
``` go |
| 2224 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 2225 |
// but for the sake of the example, this is easier. |
| 2226 |
|
| 2227 |
body := `{ |
| 2228 |
"topic": "myhome", |
| 2229 |
"message": "Garage door has been open for 15 minutes. Close it?", |
| 2230 |
"actions": [ |
| 2231 |
{ |
| 2232 |
"action": "http", |
| 2233 |
"label": "Close door", |
| 2234 |
"method": "PUT", |
| 2235 |
"url": "https://api.mygarage.lan/", |
| 2236 |
"headers": { |
| 2237 |
"Authorization": "Bearer zAzsx1sk.." |
| 2238 |
}, |
| 2239 |
"body": "{\"action\": \"close\"}" |
| 2240 |
} |
| 2241 |
] |
| 2242 |
}` |
| 2243 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 2244 |
http.DefaultClient.Do(req) |
| 2245 |
``` |
| 2246 |
|
| 2247 |
=== "PowerShell" |
| 2248 |
``` powershell |
| 2249 |
# Powershell requires the 'Depth' argument to equal 3 here to expand 'headers', |
| 2250 |
# otherwise it will read System.Collections.Hashtable in the returned JSON |
| 2251 |
|
| 2252 |
$Request = @{ |
| 2253 |
Method = "POST" |
| 2254 |
URI = "https://ntfy.sh" |
| 2255 |
Body = ConvertTo-Json -Depth 3 @{ |
| 2256 |
Topic = "myhome" |
| 2257 |
Message = "Garage door has been open for 15 minutes. Close it?" |
| 2258 |
Actions = @( |
| 2259 |
@{ |
| 2260 |
Action = "http" |
| 2261 |
Label = "Close door" |
| 2262 |
URL = "https://api.mygarage.lan/" |
| 2263 |
Method = "PUT" |
| 2264 |
Headers = @{ |
| 2265 |
Authorization = "Bearer zAzsx1sk.." |
| 2266 |
} |
| 2267 |
Body = ConvertTo-JSON @{Action = "close"} |
| 2268 |
} |
| 2269 |
) |
| 2270 |
} |
| 2271 |
ContentType = "application/json" |
| 2272 |
} |
| 2273 |
Invoke-RestMethod @Request |
| 2274 |
``` |
| 2275 |
|
| 2276 |
=== "Python" |
| 2277 |
``` python |
| 2278 |
requests.post("https://ntfy.sh/", |
| 2279 |
data=json.dumps({ |
| 2280 |
"topic": "myhome", |
| 2281 |
"message": "Garage door has been open for 15 minutes. Close it?", |
| 2282 |
"actions": [ |
| 2283 |
{ |
| 2284 |
"action": "http", |
| 2285 |
"label": "Close door", |
| 2286 |
"url": "https://api.mygarage.lan/", |
| 2287 |
"method": "PUT", |
| 2288 |
"headers": { |
| 2289 |
"Authorization": "Bearer zAzsx1sk.." |
| 2290 |
}, |
| 2291 |
"body": "{\"action\": \"close\"}" |
| 2292 |
} |
| 2293 |
] |
| 2294 |
}) |
| 2295 |
) |
| 2296 |
``` |
| 2297 |
|
| 2298 |
=== "PHP" |
| 2299 |
``` php-inline |
| 2300 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 2301 |
'http' => [ |
| 2302 |
'method' => 'POST', |
| 2303 |
'header' => "Content-Type: application/json", |
| 2304 |
'content' => json_encode([ |
| 2305 |
"topic": "myhome", |
| 2306 |
"message": "Garage door has been open for 15 minutes. Close it?", |
| 2307 |
"actions": [ |
| 2308 |
[ |
| 2309 |
"action": "http", |
| 2310 |
"label": "Close door", |
| 2311 |
"url": "https://api.mygarage.lan/", |
| 2312 |
"method": "PUT", |
| 2313 |
"headers": [ |
| 2314 |
"Authorization": "Bearer zAzsx1sk.." |
| 2315 |
], |
| 2316 |
"body": "{\"action\": \"close\"}" |
| 2317 |
] |
| 2318 |
] |
| 2319 |
]) |
| 2320 |
] |
| 2321 |
])); |
| 2322 |
``` |
| 2323 |
|
| 2324 |
The short format for the `http` action is `http, <label>, <url>` (e.g. `http, Close door, https://api.mygarage.lan/close`), |
| 2325 |
but you can always just use the `<key>=<value>` notation as well (e.g. `action=http, label=Close door, url=https://api.mygarage.lan/close`). |
| 2326 |
|
| 2327 |
The `http` action supports the following fields: |
| 2328 |
|
| 2329 |
| Field | Required | Type | Default | Example | Description | |
| 2330 |
|-----------|----------|--------------------|-----------|---------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 2331 |
| `action` | ✔️ | *string* | - | `http` | Action type (**must be `http`**) | |
| 2332 |
| `label` | ✔️ | *string* | - | `Open garage door` | Label of the action button in the notification | |
| 2333 |
| `url` | ✔️ | *string* | - | `https://ntfy.sh/mytopic` | URL to which the HTTP request will be sent | |
| 2334 |
| `method` | -️ | *GET/POST/PUT/...* | `POST` ⚠️ | `GET` | HTTP method to use for request, **default is POST** ⚠️ | |
| 2335 |
| `headers` | -️ | *map of strings* | - | *see above* | HTTP headers to pass in request. When publishing as JSON, headers are passed as a map. When the simple format is used, use `headers.<header1>=<value>`. | |
| 2336 |
| `body` | -️ | *string* | *empty* | `some body, somebody?` | HTTP body | |
| 2337 |
| `clear` | -️ | *boolean* | `false` | `true` | Clear notification after HTTP request succeeds. If the request fails, the notification is not cleared. | |
| 2338 |
|
| 2339 |
### Copy to clipboard |
| 2340 |
_Supported on:_ :material-android: :material-firefox: |
| 2341 |
|
| 2342 |
The `copy` action **copies a given value to the clipboard when the action button is tapped**. This is useful for |
| 2343 |
one-time passcodes, tokens, or any other value you want to quickly copy without opening the full notification. |
| 2344 |
|
| 2345 |
!!! info |
| 2346 |
The copy action button is only shown in the web app and Android app notification list, **not** in browser desktop |
| 2347 |
notifications. This is because browsers do not allow clipboard access from notification actions without direct |
| 2348 |
user interaction with the page. |
| 2349 |
|
| 2350 |
Here's an example using the [`X-Actions` header](#using-a-header): |
| 2351 |
|
| 2352 |
=== "Command line (curl)" |
| 2353 |
``` |
| 2354 |
curl \ |
| 2355 |
-d "Your one-time passcode is 123456" \ |
| 2356 |
-H "Actions: copy, Copy code, 123456" \ |
| 2357 |
ntfy.sh/myhome |
| 2358 |
``` |
| 2359 |
|
| 2360 |
=== "ntfy CLI" |
| 2361 |
``` |
| 2362 |
ntfy publish \ |
| 2363 |
--actions="copy, Copy code, 123456" \ |
| 2364 |
myhome \ |
| 2365 |
"Your one-time passcode is 123456" |
| 2366 |
``` |
| 2367 |
|
| 2368 |
=== "HTTP" |
| 2369 |
``` http |
| 2370 |
POST /myhome HTTP/1.1 |
| 2371 |
Host: ntfy.sh |
| 2372 |
Actions: copy, Copy code, 123456 |
| 2373 |
|
| 2374 |
Your one-time passcode is 123456 |
| 2375 |
``` |
| 2376 |
|
| 2377 |
=== "JavaScript" |
| 2378 |
``` javascript |
| 2379 |
fetch('https://ntfy.sh/myhome', { |
| 2380 |
method: 'POST', |
| 2381 |
body: 'Your one-time passcode is 123456', |
| 2382 |
headers: { |
| 2383 |
'Actions': 'copy, Copy code, 123456' |
| 2384 |
} |
| 2385 |
}) |
| 2386 |
``` |
| 2387 |
|
| 2388 |
=== "Go" |
| 2389 |
``` go |
| 2390 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/myhome", strings.NewReader("Your one-time passcode is 123456")) |
| 2391 |
req.Header.Set("Actions", "copy, Copy code, 123456") |
| 2392 |
http.DefaultClient.Do(req) |
| 2393 |
``` |
| 2394 |
|
| 2395 |
=== "PowerShell" |
| 2396 |
``` powershell |
| 2397 |
$Request = @{ |
| 2398 |
Method = "POST" |
| 2399 |
URI = "https://ntfy.sh/myhome" |
| 2400 |
Headers = @{ |
| 2401 |
Actions = "copy, Copy code, 123456" |
| 2402 |
} |
| 2403 |
Body = "Your one-time passcode is 123456" |
| 2404 |
} |
| 2405 |
Invoke-RestMethod @Request |
| 2406 |
``` |
| 2407 |
|
| 2408 |
=== "Python" |
| 2409 |
``` python |
| 2410 |
requests.post("https://ntfy.sh/myhome", |
| 2411 |
data="Your one-time passcode is 123456", |
| 2412 |
headers={ "Actions": "copy, Copy code, 123456" }) |
| 2413 |
``` |
| 2414 |
|
| 2415 |
=== "PHP" |
| 2416 |
``` php-inline |
| 2417 |
file_get_contents('https://ntfy.sh/myhome', false, stream_context_create([ |
| 2418 |
'http' => [ |
| 2419 |
'method' => 'POST', |
| 2420 |
'header' => |
| 2421 |
"Content-Type: text/plain\r\n" . |
| 2422 |
"Actions: copy, Copy code, 123456", |
| 2423 |
'content' => 'Your one-time passcode is 123456' |
| 2424 |
] |
| 2425 |
])); |
| 2426 |
``` |
| 2427 |
|
| 2428 |
And the same example using [JSON publishing](#publish-as-json): |
| 2429 |
|
| 2430 |
=== "Command line (curl)" |
| 2431 |
``` |
| 2432 |
curl ntfy.sh \ |
| 2433 |
-d '{ |
| 2434 |
"topic": "myhome", |
| 2435 |
"message": "Your one-time passcode is 123456", |
| 2436 |
"actions": [ |
| 2437 |
{ |
| 2438 |
"action": "copy", |
| 2439 |
"label": "Copy code", |
| 2440 |
"value": "123456" |
| 2441 |
} |
| 2442 |
] |
| 2443 |
}' |
| 2444 |
``` |
| 2445 |
|
| 2446 |
=== "ntfy CLI" |
| 2447 |
``` |
| 2448 |
ntfy publish \ |
| 2449 |
--actions '[ |
| 2450 |
{ |
| 2451 |
"action": "copy", |
| 2452 |
"label": "Copy code", |
| 2453 |
"value": "123456" |
| 2454 |
} |
| 2455 |
]' \ |
| 2456 |
myhome \ |
| 2457 |
"Your one-time passcode is 123456" |
| 2458 |
``` |
| 2459 |
|
| 2460 |
=== "HTTP" |
| 2461 |
``` http |
| 2462 |
POST / HTTP/1.1 |
| 2463 |
Host: ntfy.sh |
| 2464 |
|
| 2465 |
{ |
| 2466 |
"topic": "myhome", |
| 2467 |
"message": "Your one-time passcode is 123456", |
| 2468 |
"actions": [ |
| 2469 |
{ |
| 2470 |
"action": "copy", |
| 2471 |
"label": "Copy code", |
| 2472 |
"value": "123456" |
| 2473 |
} |
| 2474 |
] |
| 2475 |
} |
| 2476 |
``` |
| 2477 |
|
| 2478 |
=== "JavaScript" |
| 2479 |
``` javascript |
| 2480 |
fetch('https://ntfy.sh', { |
| 2481 |
method: 'POST', |
| 2482 |
body: JSON.stringify({ |
| 2483 |
topic: "myhome", |
| 2484 |
message: "Your one-time passcode is 123456", |
| 2485 |
actions: [ |
| 2486 |
{ |
| 2487 |
action: "copy", |
| 2488 |
label: "Copy code", |
| 2489 |
value: "123456" |
| 2490 |
} |
| 2491 |
] |
| 2492 |
}) |
| 2493 |
}) |
| 2494 |
``` |
| 2495 |
|
| 2496 |
=== "Go" |
| 2497 |
``` go |
| 2498 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 2499 |
// but for the sake of the example, this is easier. |
| 2500 |
|
| 2501 |
body := `{ |
| 2502 |
"topic": "myhome", |
| 2503 |
"message": "Your one-time passcode is 123456", |
| 2504 |
"actions": [ |
| 2505 |
{ |
| 2506 |
"action": "copy", |
| 2507 |
"label": "Copy code", |
| 2508 |
"value": "123456" |
| 2509 |
} |
| 2510 |
] |
| 2511 |
}` |
| 2512 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 2513 |
http.DefaultClient.Do(req) |
| 2514 |
``` |
| 2515 |
|
| 2516 |
=== "PowerShell" |
| 2517 |
``` powershell |
| 2518 |
$Request = @{ |
| 2519 |
Method = "POST" |
| 2520 |
URI = "https://ntfy.sh" |
| 2521 |
Body = ConvertTo-JSON @{ |
| 2522 |
Topic = "myhome" |
| 2523 |
Message = "Your one-time passcode is 123456" |
| 2524 |
Actions = @( |
| 2525 |
@{ |
| 2526 |
Action = "copy" |
| 2527 |
Label = "Copy code" |
| 2528 |
Value = "123456" |
| 2529 |
} |
| 2530 |
) |
| 2531 |
} |
| 2532 |
ContentType = "application/json" |
| 2533 |
} |
| 2534 |
Invoke-RestMethod @Request |
| 2535 |
``` |
| 2536 |
|
| 2537 |
=== "Python" |
| 2538 |
``` python |
| 2539 |
requests.post("https://ntfy.sh/", |
| 2540 |
data=json.dumps({ |
| 2541 |
"topic": "myhome", |
| 2542 |
"message": "Your one-time passcode is 123456", |
| 2543 |
"actions": [ |
| 2544 |
{ |
| 2545 |
"action": "copy", |
| 2546 |
"label": "Copy code", |
| 2547 |
"value": "123456" |
| 2548 |
} |
| 2549 |
] |
| 2550 |
}) |
| 2551 |
) |
| 2552 |
``` |
| 2553 |
|
| 2554 |
=== "PHP" |
| 2555 |
``` php-inline |
| 2556 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 2557 |
'http' => [ |
| 2558 |
'method' => 'POST', |
| 2559 |
'header' => "Content-Type: application/json", |
| 2560 |
'content' => json_encode([ |
| 2561 |
"topic": "myhome", |
| 2562 |
"message": "Your one-time passcode is 123456", |
| 2563 |
"actions": [ |
| 2564 |
[ |
| 2565 |
"action": "copy", |
| 2566 |
"label": "Copy code", |
| 2567 |
"value": "123456" |
| 2568 |
] |
| 2569 |
] |
| 2570 |
]) |
| 2571 |
] |
| 2572 |
])); |
| 2573 |
``` |
| 2574 |
|
| 2575 |
The short format for the `copy` action is `copy, <label>, <value>` (e.g. `copy, Copy code, 123456`), |
| 2576 |
but you can always just use the `<key>=<value>` notation as well (e.g. `action=copy, label=Copy code, value=123456`). |
| 2577 |
|
| 2578 |
The `copy` action supports the following fields: |
| 2579 |
|
| 2580 |
| Field | Required | Type | Default | Example | Description | |
| 2581 |
|----------|----------|-----------|---------|-----------------|--------------------------------------------------| |
| 2582 |
| `action` | ✔️ | *string* | - | `copy` | Action type (**must be `copy`**) | |
| 2583 |
| `label` | ✔️ | *string* | - | `Copy code` | Label of the action button in the notification | |
| 2584 |
| `value` | ✔️ | *string* | - | `123456` | Value to copy to the clipboard | |
| 2585 |
| `clear` | -️ | *boolean* | `false` | `true` | Clear notification after action button is tapped | |
| 2586 |
|
| 2587 |
## Scheduled delivery |
| 2588 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 2589 |
|
| 2590 |
You can delay the delivery of messages and let ntfy send them at a later date. This can be used to send yourself |
| 2591 |
reminders or even to execute commands at a later date (if your subscriber acts on messages). |
| 2592 |
|
| 2593 |
Usage is pretty straight forward. You can set the delivery time using the `X-Delay` header (or any of its aliases: `Delay`, |
| 2594 |
`X-At`, `At`, `X-In` or `In`), either by specifying a Unix timestamp (e.g. `1639194738`), a duration (e.g. `30m`, |
| 2595 |
`3h`, `2 days`), or a natural language time string (e.g. `10am`, `8:30pm`, `tomorrow, 3pm`, `Tuesday, 7am`, |
| 2596 |
[and more](https://github.com/olebedev/when)). |
| 2597 |
|
| 2598 |
As of today, the minimum delay you can set is **10 seconds** and the maximum delay is **3 days**. This can be configured |
| 2599 |
with the `message-delay-limit` option. |
| 2600 |
|
| 2601 |
For the purposes of [message caching](config.md#message-cache), scheduled messages are kept in the cache until 12 hours |
| 2602 |
after they were delivered (or whatever the server-side cache duration is set to). For instance, if a message is scheduled |
| 2603 |
to be delivered in 3 days, it'll remain in the cache for 3 days and 12 hours. Also note that naturally, |
| 2604 |
[turning off server-side caching](#message-caching) is not possible in combination with this feature. |
| 2605 |
|
| 2606 |
=== "Command line (curl)" |
| 2607 |
``` |
| 2608 |
curl -H "At: tomorrow, 10am" -d "Good morning" ntfy.sh/hello |
| 2609 |
curl -H "In: 30min" -d "It's 30 minutes later now" ntfy.sh/reminder |
| 2610 |
curl -H "Delay: 1639194738" -d "Unix timestamps are awesome" ntfy.sh/itsaunixsystem |
| 2611 |
``` |
| 2612 |
|
| 2613 |
=== "ntfy CLI" |
| 2614 |
``` |
| 2615 |
ntfy publish \ |
| 2616 |
--at="tomorrow, 10am" \ |
| 2617 |
hello "Good morning" |
| 2618 |
``` |
| 2619 |
|
| 2620 |
=== "HTTP" |
| 2621 |
``` http |
| 2622 |
POST /hello HTTP/1.1 |
| 2623 |
Host: ntfy.sh |
| 2624 |
At: tomorrow, 10am |
| 2625 |
|
| 2626 |
Good morning |
| 2627 |
``` |
| 2628 |
|
| 2629 |
=== "JavaScript" |
| 2630 |
``` javascript |
| 2631 |
fetch('https://ntfy.sh/hello', { |
| 2632 |
method: 'POST', |
| 2633 |
body: 'Good morning', |
| 2634 |
headers: { 'At': 'tomorrow, 10am' } |
| 2635 |
}) |
| 2636 |
``` |
| 2637 |
|
| 2638 |
=== "Go" |
| 2639 |
``` go |
| 2640 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/hello", strings.NewReader("Good morning")) |
| 2641 |
req.Header.Set("At", "tomorrow, 10am") |
| 2642 |
http.DefaultClient.Do(req) |
| 2643 |
``` |
| 2644 |
|
| 2645 |
=== "PowerShell" |
| 2646 |
``` powershell |
| 2647 |
$Request = @{ |
| 2648 |
Method = "POST" |
| 2649 |
URI = "https://ntfy.sh/hello" |
| 2650 |
Headers = @{ |
| 2651 |
At = "tomorrow, 10am" |
| 2652 |
} |
| 2653 |
Body = "Good morning" |
| 2654 |
} |
| 2655 |
Invoke-RestMethod @Request |
| 2656 |
``` |
| 2657 |
|
| 2658 |
=== "Python" |
| 2659 |
``` python |
| 2660 |
requests.post("https://ntfy.sh/hello", |
| 2661 |
data="Good morning", |
| 2662 |
headers={ "At": "tomorrow, 10am" }) |
| 2663 |
``` |
| 2664 |
|
| 2665 |
=== "PHP" |
| 2666 |
``` php-inline |
| 2667 |
file_get_contents('https://ntfy.sh/backups', false, stream_context_create([ |
| 2668 |
'http' => [ |
| 2669 |
'method' => 'POST', |
| 2670 |
'header' => |
| 2671 |
"Content-Type: text/plain\r\n" . |
| 2672 |
"At: tomorrow, 10am", |
| 2673 |
'content' => 'Good morning' |
| 2674 |
] |
| 2675 |
])); |
| 2676 |
``` |
| 2677 |
|
| 2678 |
Here are a few examples (assuming today's date is **12/10/2021, 9am, Eastern Time Zone**): |
| 2679 |
|
| 2680 |
<table class="remove-md-box"><tr> |
| 2681 |
<td> |
| 2682 |
<table><thead><tr><th><code>Delay/At/In</code> header</th><th>Message will be delivered at</th><th>Explanation</th></tr></thead><tbody> |
| 2683 |
<tr><td><code>30m</code></td><td>12/10/2021, 9:<b>30</b>am</td><td>30 minutes from now</td></tr> |
| 2684 |
<tr><td><code>2 hours</code></td><td>12/10/2021, <b>11:30</b>am</td><td>2 hours from now</td></tr> |
| 2685 |
<tr><td><code>1 day</code></td><td>12/<b>11</b>/2021, 9am</td><td>24 hours from now</td></tr> |
| 2686 |
<tr><td><code>10am</code></td><td>12/10/2021, <b>10am</b></td><td>Today at 10am (same day, because it's only 9am)</td></tr> |
| 2687 |
<tr><td><code>8am</code></td><td>12/<b>11</b>/2021, <b>8am</b></td><td>Tomorrow at 8am (because it's 9am already)</td></tr> |
| 2688 |
<tr><td><code>1639152000</code></td><td>12/10/2021, 11am (EST)</td><td> Today at 11am (EST)</td></tr> |
| 2689 |
</tbody></table> |
| 2690 |
</td> |
| 2691 |
</tr></table> |
| 2692 |
|
| 2693 |
### Updating scheduled notifications |
| 2694 |
|
| 2695 |
You can update or replace a scheduled message before it is delivered by publishing a new message with the same |
| 2696 |
[sequence ID](#updating-deleting-notifications). When you do this, the **original scheduled message is deleted** |
| 2697 |
from the server and replaced with the new one. This is different from [updating notifications](#updating-notifications) |
| 2698 |
after delivery, where both messages are kept in the cache. |
| 2699 |
|
| 2700 |
This is particularly useful for implementing a **watchdog that triggers when your script stops sending heartbeat messages**. |
| 2701 |
This mechanism is also called a [dead man's switch](https://en.wikipedia.org/wiki/Dead_man%27s_switch). |
| 2702 |
|
| 2703 |
For example, you could schedule a message to be delivered in 5 minutes, but continuously update it every minute to push |
| 2704 |
the delivery time further into the future. If your script or system stops running, the message will eventually be delivered as an alert. |
| 2705 |
|
| 2706 |
Here's an example of a dead man's switch that sends an alert if the script stops running for more than 5 minutes: |
| 2707 |
|
| 2708 |
=== "Command line (curl)" |
| 2709 |
```bash |
| 2710 |
# Dead man's switch: keeps pushing a scheduled message into the future |
| 2711 |
# If this script stops, the alert will be delivered after 5 minutes |
| 2712 |
while true; do |
| 2713 |
curl -H "In: 5m" -d "Warning: Server heartbeat stopped!" \ |
| 2714 |
ntfy.sh/mytopic/heartbeat-check |
| 2715 |
sleep 60 # Update every minute |
| 2716 |
done |
| 2717 |
``` |
| 2718 |
|
| 2719 |
=== "ntfy CLI" |
| 2720 |
```bash |
| 2721 |
# Dead man's switch: keeps pushing a scheduled message into the future |
| 2722 |
# If this script stops, the alert will be delivered after 5 minutes |
| 2723 |
while true; do |
| 2724 |
ntfy publish \ |
| 2725 |
--in="5m" \ |
| 2726 |
--sequence-id="heartbeat-check" \ |
| 2727 |
mytopic "Warning: Server heartbeat stopped!" |
| 2728 |
sleep 60 # Update every minute |
| 2729 |
done |
| 2730 |
``` |
| 2731 |
|
| 2732 |
=== "HTTP" |
| 2733 |
``` http |
| 2734 |
POST /mytopic/heartbeat-check HTTP/1.1 |
| 2735 |
Host: ntfy.sh |
| 2736 |
In: 5m |
| 2737 |
|
| 2738 |
Warning: Server heartbeat stopped! |
| 2739 |
``` |
| 2740 |
|
| 2741 |
=== "JavaScript" |
| 2742 |
``` javascript |
| 2743 |
// Dead man's switch: keeps pushing a scheduled message into the future |
| 2744 |
// If this script stops, the alert will be delivered after 5 minutes |
| 2745 |
setInterval(() => { |
| 2746 |
fetch('https://ntfy.sh/mytopic/heartbeat-check', { |
| 2747 |
method: 'POST', |
| 2748 |
body: 'Warning: Server heartbeat stopped!', |
| 2749 |
headers: { 'In': '5m' } |
| 2750 |
}) |
| 2751 |
}, 60000) // Update every minute |
| 2752 |
``` |
| 2753 |
|
| 2754 |
=== "Go" |
| 2755 |
``` go |
| 2756 |
// Dead man's switch: keeps pushing a scheduled message into the future |
| 2757 |
// If this script stops, the alert will be delivered after 5 minutes |
| 2758 |
for { |
| 2759 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic/heartbeat-check", |
| 2760 |
strings.NewReader("Warning: Server heartbeat stopped!")) |
| 2761 |
req.Header.Set("In", "5m") |
| 2762 |
http.DefaultClient.Do(req) |
| 2763 |
time.Sleep(60 * time.Second) // Update every minute |
| 2764 |
} |
| 2765 |
``` |
| 2766 |
|
| 2767 |
=== "PowerShell" |
| 2768 |
``` powershell |
| 2769 |
# Dead man's switch: keeps pushing a scheduled message into the future |
| 2770 |
# If this script stops, the alert will be delivered after 5 minutes |
| 2771 |
while ($true) { |
| 2772 |
$Request = @{ |
| 2773 |
Method = "POST" |
| 2774 |
URI = "https://ntfy.sh/mytopic/heartbeat-check" |
| 2775 |
Headers = @{ In = "5m" } |
| 2776 |
Body = "Warning: Server heartbeat stopped!" |
| 2777 |
} |
| 2778 |
Invoke-RestMethod @Request |
| 2779 |
Start-Sleep -Seconds 60 # Update every minute |
| 2780 |
} |
| 2781 |
``` |
| 2782 |
|
| 2783 |
=== "Python" |
| 2784 |
``` python |
| 2785 |
import requests |
| 2786 |
import time |
| 2787 |
|
| 2788 |
# Dead man's switch: keeps pushing a scheduled message into the future |
| 2789 |
# If this script stops, the alert will be delivered after 5 minutes |
| 2790 |
while True: |
| 2791 |
requests.post( |
| 2792 |
"https://ntfy.sh/mytopic/heartbeat-check", |
| 2793 |
data="Warning: Server heartbeat stopped!", |
| 2794 |
headers={"In": "5m"} |
| 2795 |
) |
| 2796 |
time.sleep(60) # Update every minute |
| 2797 |
``` |
| 2798 |
|
| 2799 |
=== "PHP" |
| 2800 |
``` php-inline |
| 2801 |
// Dead man's switch: keeps pushing a scheduled message into the future |
| 2802 |
// If this script stops, the alert will be delivered after 5 minutes |
| 2803 |
while (true) { |
| 2804 |
file_get_contents('https://ntfy.sh/mytopic/heartbeat-check', false, stream_context_create([ |
| 2805 |
'http' => [ |
| 2806 |
'method' => 'POST', |
| 2807 |
'header' => "Content-Type: text/plain\r\nIn: 5m", |
| 2808 |
'content' => 'Warning: Server heartbeat stopped!' |
| 2809 |
] |
| 2810 |
])); |
| 2811 |
sleep(60); // Update every minute |
| 2812 |
} |
| 2813 |
``` |
| 2814 |
|
| 2815 |
### Canceling scheduled notifications |
| 2816 |
|
| 2817 |
You can cancel a scheduled message before it is delivered by sending a DELETE request to the |
| 2818 |
`/<topic>/<sequence_id>` endpoint, just like [deleting notifications](#deleting-notifications). Alternatively, you can send a `GET` |
| 2819 |
request to `/<topic>/<sequence_id>/delete`. This will remove the scheduled message from the server so it will never be delivered, |
| 2820 |
and emit a `message_delete` event to any subscribers. |
| 2821 |
|
| 2822 |
=== "Command line (curl)" |
| 2823 |
```bash |
| 2824 |
# Schedule a reminder for 2 hours from now |
| 2825 |
curl -H "In: 2h" -d "Take a break!" ntfy.sh/mytopic/break-reminder |
| 2826 |
|
| 2827 |
# Changed your mind? Cancel the scheduled message via DELETE |
| 2828 |
curl -X DELETE ntfy.sh/mytopic/break-reminder |
| 2829 |
|
| 2830 |
# Or cancel it via GET |
| 2831 |
curl ntfy.sh/mytopic/break-reminder/delete |
| 2832 |
``` |
| 2833 |
|
| 2834 |
=== "ntfy CLI" |
| 2835 |
```bash |
| 2836 |
# Schedule a reminder for 2 hours from now |
| 2837 |
ntfy publish --in="2h" mytopic/break-reminder "Take a break!" |
| 2838 |
|
| 2839 |
# Changed your mind? Cancel the scheduled message |
| 2840 |
# (ntfy CLI does not support DELETE, use curl instead) |
| 2841 |
curl -X DELETE ntfy.sh/mytopic/break-reminder |
| 2842 |
``` |
| 2843 |
|
| 2844 |
=== "HTTP" |
| 2845 |
``` http |
| 2846 |
DELETE /mytopic/break-reminder HTTP/1.1 |
| 2847 |
Host: ntfy.sh |
| 2848 |
``` |
| 2849 |
|
| 2850 |
=== "JavaScript" |
| 2851 |
``` javascript |
| 2852 |
// Schedule a reminder for 2 hours from now |
| 2853 |
await fetch('https://ntfy.sh/mytopic/break-reminder', { |
| 2854 |
method: 'POST', |
| 2855 |
body: 'Take a break!', |
| 2856 |
headers: { 'In': '2h' } |
| 2857 |
}); |
| 2858 |
|
| 2859 |
// Changed your mind? Cancel the scheduled message |
| 2860 |
await fetch('https://ntfy.sh/mytopic/break-reminder', { |
| 2861 |
method: 'DELETE' |
| 2862 |
}); |
| 2863 |
``` |
| 2864 |
|
| 2865 |
=== "Go" |
| 2866 |
``` go |
| 2867 |
// Schedule a reminder for 2 hours from now |
| 2868 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic/break-reminder", |
| 2869 |
strings.NewReader("Take a break!")) |
| 2870 |
req.Header.Set("In", "2h") |
| 2871 |
http.DefaultClient.Do(req) |
| 2872 |
|
| 2873 |
// Changed your mind? Cancel the scheduled message |
| 2874 |
req, _ = http.NewRequest("DELETE", "https://ntfy.sh/mytopic/break-reminder", nil) |
| 2875 |
http.DefaultClient.Do(req) |
| 2876 |
``` |
| 2877 |
|
| 2878 |
=== "PowerShell" |
| 2879 |
``` powershell |
| 2880 |
# Schedule a reminder for 2 hours from now |
| 2881 |
$Request = @{ |
| 2882 |
Method = "POST" |
| 2883 |
URI = "https://ntfy.sh/mytopic/break-reminder" |
| 2884 |
Headers = @{ In = "2h" } |
| 2885 |
Body = "Take a break!" |
| 2886 |
} |
| 2887 |
Invoke-RestMethod @Request |
| 2888 |
|
| 2889 |
# Changed your mind? Cancel the scheduled message |
| 2890 |
Invoke-RestMethod -Method DELETE -Uri "https://ntfy.sh/mytopic/break-reminder" |
| 2891 |
``` |
| 2892 |
|
| 2893 |
=== "Python" |
| 2894 |
``` python |
| 2895 |
import requests |
| 2896 |
|
| 2897 |
# Schedule a reminder for 2 hours from now |
| 2898 |
requests.post( |
| 2899 |
"https://ntfy.sh/mytopic/break-reminder", |
| 2900 |
data="Take a break!", |
| 2901 |
headers={"In": "2h"} |
| 2902 |
) |
| 2903 |
|
| 2904 |
# Changed your mind? Cancel the scheduled message |
| 2905 |
requests.delete("https://ntfy.sh/mytopic/break-reminder") |
| 2906 |
``` |
| 2907 |
|
| 2908 |
=== "PHP" |
| 2909 |
``` php-inline |
| 2910 |
// Schedule a reminder for 2 hours from now |
| 2911 |
file_get_contents('https://ntfy.sh/mytopic/break-reminder', false, stream_context_create([ |
| 2912 |
'http' => [ |
| 2913 |
'method' => 'POST', |
| 2914 |
'header' => "Content-Type: text/plain\r\nIn: 2h", |
| 2915 |
'content' => 'Take a break!' |
| 2916 |
] |
| 2917 |
])); |
| 2918 |
|
| 2919 |
// Changed your mind? Cancel the scheduled message |
| 2920 |
file_get_contents('https://ntfy.sh/mytopic/break-reminder', false, stream_context_create([ |
| 2921 |
'http' => ['method' => 'DELETE'] |
| 2922 |
])); |
| 2923 |
``` |
| 2924 |
|
| 2925 |
## Message templating |
| 2926 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 2927 |
|
| 2928 |
Templating lets you **format a JSON message body into human-friendly message and title text** using |
| 2929 |
[Go templates](https://pkg.go.dev/text/template) (see tutorials [here](https://blog.gopheracademy.com/advent-2017/using-go-templates/), |
| 2930 |
[here](https://www.digitalocean.com/community/tutorials/how-to-use-templates-in-go), and |
| 2931 |
[here](https://developer.hashicorp.com/nomad/tutorials/templates/go-template-syntax)). This is specifically useful when |
| 2932 |
**combined with webhooks** from services such as [GitHub](https://docs.github.com/en/webhooks/about-webhooks), |
| 2933 |
[Grafana](https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier/), |
| 2934 |
[Alertmanager](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config), or other services that emit JSON webhooks. |
| 2935 |
|
| 2936 |
Instead of using a separate bridge program to parse the webhook body into the format ntfy expects, you can include a templated |
| 2937 |
message and/or a templated title which will be populated based on the fields of the webhook body (so long as the webhook body |
| 2938 |
is valid JSON). |
| 2939 |
|
| 2940 |
You can enable templating by setting the `X-Template` header (or its aliases `Template` or `tpl`, or the query parameter `?template=...`): |
| 2941 |
|
| 2942 |
* **Pre-defined template files**: Setting the `X-Template` header or query parameter to a pre-defined template name (one of `github`, |
| 2943 |
`grafana`, or `alertmanager`, such as `?template=github`) will use the built-in template with that name. |
| 2944 |
See [pre-defined templates](#pre-defined-templates) for more details. |
| 2945 |
* **Custom template files**: Setting the `X-Template` header or query parameter to a custom template name (e.g. `?template=myapp`) |
| 2946 |
will use a custom template file from the template directory (defaults to `/etc/ntfy/templates`, can be overridden with `template-dir`). |
| 2947 |
See [custom templates](#custom-templates) for more details. |
| 2948 |
* **Inline templating**: Setting the `X-Template` header or query parameter to `yes` or `1` (e.g. `?template=yes`) |
| 2949 |
will enable inline templating, which means that the `message`, `title`, and/or `priority` will be parsed as a Go template. |
| 2950 |
See [inline templating](#inline-templating) for more details. |
| 2951 |
|
| 2952 |
To learn the basics of Go's templating language, please see [template syntax](#template-syntax). |
| 2953 |
|
| 2954 |
### Pre-defined templates |
| 2955 |
|
| 2956 |
When `X-Template: <name>` (aliases: `Template: <name>`, `Tpl: <name>`) or `?template=<name>` is set, ntfy will transform the |
| 2957 |
message and/or title based on one of the built-in pre-defined templates. |
| 2958 |
|
| 2959 |
The following **pre-defined templates** are available: |
| 2960 |
|
| 2961 |
* `github`: Formats a subset of [GitHub webhook](https://docs.github.com/en/webhooks/about-webhooks) payloads (PRs, issues, new star, new watcher, new comment). See [github.yml](https://github.com/binwiederhier/ntfy/blob/main/server/templates/github.yml). |
| 2962 |
* `grafana`: Formats [Grafana webhook](https://grafana.com/docs/grafana/latest/alerting/configure-notifications/manage-contact-points/integrations/webhook-notifier/) payloads (firing/resolved alerts). See [grafana.yml](https://github.com/binwiederhier/ntfy/blob/main/server/templates/grafana.yml). |
| 2963 |
* `alertmanager`: Formats [Alertmanager webhook](https://prometheus.io/docs/alerting/latest/configuration/#webhook_config) payloads (firing/resolved alerts). See [alertmanager.yml](https://github.com/binwiederhier/ntfy/blob/main/server/templates/alertmanager.yml). |
| 2964 |
|
| 2965 |
To override the pre-defined templates, you can place a file with the same name in the template directory (defaults to `/etc/ntfy/templates`, |
| 2966 |
can be overridden with `template-dir`). See [custom templates](#custom-templates) for more details. |
| 2967 |
|
| 2968 |
Here's an example of how to use the **pre-defined `github` template**: |
| 2969 |
|
| 2970 |
First, configure the webhook in GitHub to send a webhook to your ntfy topic, e.g. `https://ntfy.sh/mytopic?template=github`. |
| 2971 |
<figure markdown> |
| 2972 |
{ width=600 } |
| 2973 |
<figcaption>GitHub webhook configuration</figcaption> |
| 2974 |
</figure> |
| 2975 |
|
| 2976 |
After that, when GitHub publishes a JSON webhook to the topic, ntfy will transform it according to the template rules |
| 2977 |
and you'll receive notifications in the ntfy app. Here's an example for when somebody stars your repository: |
| 2978 |
|
| 2979 |
<figure markdown> |
| 2980 |
{ width=500 } |
| 2981 |
<figcaption>Receiving a webhook, formatted using the pre-defined "github" template</figcaption> |
| 2982 |
</figure> |
| 2983 |
|
| 2984 |
### Custom templates |
| 2985 |
|
| 2986 |
To define **your own custom templates**, place a template file in the template directory (defaults to `/etc/ntfy/templates`, can be overridden with `template-dir`) |
| 2987 |
and set the `X-Template` header or query parameter to the name of the template file (without the `.yml` extension). |
| 2988 |
|
| 2989 |
For example, if you have a template file `/etc/ntfy/templates/myapp.yml`, you can set the header `X-Template: myapp` or |
| 2990 |
the query parameter `?template=myapp` to use it. |
| 2991 |
|
| 2992 |
Template files must have the `.yml` (not: `.yaml`!) extension and must be formatted as YAML. They may contain `title`, `message`, and `priority` keys, |
| 2993 |
which are interpreted as Go templates. |
| 2994 |
|
| 2995 |
Here's an **example custom template**: |
| 2996 |
|
| 2997 |
=== "Custom template (/etc/ntfy/templates/myapp.yml)" |
| 2998 |
```yaml |
| 2999 |
title: | |
| 3000 |
{{- if eq .status "firing" }} |
| 3001 |
{{- if gt .percent 90.0 }}🚨 Critical alert |
| 3002 |
{{- else }}⚠️ Alert{{- end }} |
| 3003 |
{{- else if eq .status "resolved" }} |
| 3004 |
✅ Alert resolved |
| 3005 |
{{- end }} |
| 3006 |
message: | |
| 3007 |
Status: {{ .status }} |
| 3008 |
Type: {{ .type | upper }} ({{ .percent }}%) |
| 3009 |
Server: {{ .server }} |
| 3010 |
priority: | |
| 3011 |
{{ if gt .percent 90.0 }}5 |
| 3012 |
{{ else if gt .percent 75.0 }}4 |
| 3013 |
{{ else }}3 |
| 3014 |
{{ end }} |
| 3015 |
``` |
| 3016 |
|
| 3017 |
Once you have the template file in place, you can send the payload to your topic using the `X-Template` |
| 3018 |
header or query parameter: |
| 3019 |
|
| 3020 |
=== "Command line (curl)" |
| 3021 |
``` |
| 3022 |
echo '{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}' | \ |
| 3023 |
curl -sT- "https://ntfy.example.com/mytopic?template=myapp" |
| 3024 |
``` |
| 3025 |
|
| 3026 |
=== "ntfy CLI" |
| 3027 |
``` |
| 3028 |
echo '{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}' | \ |
| 3029 |
ntfy publish --template=myapp https://ntfy.example.com/mytopic |
| 3030 |
``` |
| 3031 |
|
| 3032 |
=== "HTTP" |
| 3033 |
``` http |
| 3034 |
POST /mytopic?template=myapp HTTP/1.1 |
| 3035 |
Host: ntfy.example.com |
| 3036 |
|
| 3037 |
{ |
| 3038 |
"status": "firing", |
| 3039 |
"type": "cpu", |
| 3040 |
"server": "ntfy.sh", |
| 3041 |
"percent": 99 |
| 3042 |
} |
| 3043 |
``` |
| 3044 |
|
| 3045 |
=== "JavaScript" |
| 3046 |
``` javascript |
| 3047 |
fetch('https://ntfy.example.com/mytopic?template=myapp', { |
| 3048 |
method: 'POST', |
| 3049 |
body: '{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}' |
| 3050 |
}) |
| 3051 |
``` |
| 3052 |
|
| 3053 |
=== "Go" |
| 3054 |
``` go |
| 3055 |
payload := `{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}` |
| 3056 |
req, _ := http.NewRequest("POST", "https://ntfy.example.com/mytopic?template=myapp", strings.NewReader(payload)) |
| 3057 |
http.DefaultClient.Do(req) |
| 3058 |
``` |
| 3059 |
|
| 3060 |
=== "PowerShell" |
| 3061 |
``` powershell |
| 3062 |
$Request = @{ |
| 3063 |
Method = "POST" |
| 3064 |
Uri = "https://ntfy.example.com/mytopic?template=myapp" |
| 3065 |
Body = '{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}' |
| 3066 |
} |
| 3067 |
Invoke-RestMethod @Request |
| 3068 |
``` |
| 3069 |
|
| 3070 |
=== "Python" |
| 3071 |
``` python |
| 3072 |
requests.post("https://ntfy.example.com/mytopic?template=myapp", |
| 3073 |
json={"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}) |
| 3074 |
``` |
| 3075 |
|
| 3076 |
=== "PHP" |
| 3077 |
``` php-inline |
| 3078 |
file_get_contents('https://ntfy.example.com/mytopic?template=myapp', false, stream_context_create([ |
| 3079 |
'http' => [ |
| 3080 |
'method' => 'POST', |
| 3081 |
'header' => "Content-Type: application/json", |
| 3082 |
'content' => '{"status":"firing","type":"cpu","server":"ntfy.sh","percent":99}' |
| 3083 |
] |
| 3084 |
])); |
| 3085 |
``` |
| 3086 |
|
| 3087 |
Which will result in a notification that looks like this: |
| 3088 |
|
| 3089 |
<figure markdown> |
| 3090 |
{ width=500 } |
| 3091 |
<figcaption>JSON webhook, transformed using a custom template</figcaption> |
| 3092 |
</figure> |
| 3093 |
|
| 3094 |
### Inline templating |
| 3095 |
|
| 3096 |
When `X-Template: yes` (aliases: `Template: yes`, `Tpl: yes`) or `?template=yes` is set, you can use Go templates in the `message`, `title`, and `priority` fields of your |
| 3097 |
webhook payload. |
| 3098 |
|
| 3099 |
Inline templates are most useful for templated one-off messages, or if you do not control the ntfy server (e.g., if you're using ntfy.sh). |
| 3100 |
Consider using [pre-defined templates](#pre-defined-templates) or [custom templates](#custom-templates) instead, |
| 3101 |
if you control the ntfy server, as templates are much easier to maintain. |
| 3102 |
|
| 3103 |
Here's an **example for a Grafana alert**: |
| 3104 |
|
| 3105 |
<figure markdown> |
| 3106 |
{ width=500 } |
| 3107 |
<figcaption>Grafana webhook, formatted using templates</figcaption> |
| 3108 |
</figure> |
| 3109 |
|
| 3110 |
This was sent using the following templates and payloads |
| 3111 |
|
| 3112 |
=== "Message template" |
| 3113 |
``` |
| 3114 |
{{range .alerts}} |
| 3115 |
{{.annotations.summary}} |
| 3116 |
|
| 3117 |
Values: |
| 3118 |
{{range $k,$v := .values}} |
| 3119 |
- {{$k}}={{$v}} |
| 3120 |
{{end}} |
| 3121 |
{{end}} |
| 3122 |
``` |
| 3123 |
|
| 3124 |
=== "Title template" |
| 3125 |
``` |
| 3126 |
{{.title}} |
| 3127 |
``` |
| 3128 |
|
| 3129 |
=== "Encoded webhook URL" |
| 3130 |
``` |
| 3131 |
# Additional URL encoding (see https://www.urlencoder.org/) is necessary for Grafana, |
| 3132 |
# and may be required for other tools too |
| 3133 |
|
| 3134 |
https://ntfy.sh/mytopic?tpl=1&t=%7B%7B.title%7D%7D&m=%7B%7Brange%20.alerts%7D%7D%7B%7B.annotations.summary%7D%7D%5Cn%5CnValues%3A%5Cn%7B%7Brange%20%24k%2C%24v%20%3A%3D%20.values%7D%7D-%20%7B%7B%24k%7D%7D%3D%7B%7B%24v%7D%7D%5Cn%7B%7Bend%7D%7D%7B%7Bend%7D%7D |
| 3135 |
``` |
| 3136 |
|
| 3137 |
=== "Grafana-sent payload" |
| 3138 |
``` |
| 3139 |
{"receiver":"ntfy\\.example\\.com/alerts","status":"resolved","alerts":[{"status":"resolved","labels":{"alertname":"Load avg 15m too high","grafana_folder":"Node alerts","instance":"10.108.0.2:9100","job":"node-exporter"},"annotations":{"summary":"15m load average too high"},"startsAt":"2024-03-15T02:28:00Z","endsAt":"2024-03-15T02:42:00Z","generatorURL":"localhost:3000/alerting/grafana/NW9oDw-4z/view","fingerprint":"becbfb94bd81ef48","silenceURL":"localhost:3000/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DLoad+avg+15m+too+high&matcher=grafana_folder%3DNode+alerts&matcher=instance%3D10.108.0.2%3A9100&matcher=job%3Dnode-exporter","dashboardURL":"","panelURL":"","values":{"B":18.98211314475876,"C":0},"valueString":"[ var='B' labels={__name__=node_load15, instance=10.108.0.2:9100, job=node-exporter} value=18.98211314475876 ], [ var='C' labels={__name__=node_load15, instance=10.108.0.2:9100, job=node-exporter} value=0 ]"}],"groupLabels":{"alertname":"Load avg 15m too high","grafana_folder":"Node alerts"},"commonLabels":{"alertname":"Load avg 15m too high","grafana_folder":"Node alerts","instance":"10.108.0.2:9100","job":"node-exporter"},"commonAnnotations":{"summary":"15m load average too high"},"externalURL":"localhost:3000/","version":"1","groupKey":"{}:{alertname=\"Load avg 15m too high\", grafana_folder=\"Node alerts\"}","truncatedAlerts":0,"orgId":1,"title":"[RESOLVED] Load avg 15m too high Node alerts (10.108.0.2:9100 node-exporter)","state":"ok","message":"**Resolved**\n\nValue: B=18.98211314475876, C=0\nLabels:\n - alertname = Load avg 15m too high\n - grafana_folder = Node alerts\n - instance = 10.108.0.2:9100\n - job = node-exporter\nAnnotations:\n - summary = 15m load average too high\nSource: localhost:3000/alerting/grafana/NW9oDw-4z/view\nSilence: localhost:3000/alerting/silence/new?alertmanager=grafana&matcher=alertname%3DLoad+avg+15m+too+high&matcher=grafana_folder%3DNode+alerts&matcher=instance%3D10.108.0.2%3A9100&matcher=job%3Dnode-exporter\n"} |
| 3140 |
``` |
| 3141 |
|
| 3142 |
Here's an **easier example with a shorter JSON payload**: |
| 3143 |
|
| 3144 |
=== "Command line (curl)" |
| 3145 |
``` |
| 3146 |
# To use { and } in the URL without encoding, we need to turn off |
| 3147 |
# curl's globbing using --globoff |
| 3148 |
|
| 3149 |
curl \ |
| 3150 |
--globoff \ |
| 3151 |
-d '{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}' \ |
| 3152 |
'ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}}' |
| 3153 |
``` |
| 3154 |
|
| 3155 |
=== "HTTP" |
| 3156 |
``` http |
| 3157 |
POST /mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}} HTTP/1.1 |
| 3158 |
Host: ntfy.sh |
| 3159 |
|
| 3160 |
{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}} |
| 3161 |
``` |
| 3162 |
|
| 3163 |
=== "JavaScript" |
| 3164 |
``` javascript |
| 3165 |
fetch('https://ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}}', { |
| 3166 |
method: 'POST', |
| 3167 |
body: '{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}' |
| 3168 |
}) |
| 3169 |
``` |
| 3170 |
|
| 3171 |
=== "Go" |
| 3172 |
``` go |
| 3173 |
body := `{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}` |
| 3174 |
uri := `https://ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if eq .error.level "severe"}}5{{else}}3{{end}}` |
| 3175 |
req, _ := http.NewRequest("POST", uri, strings.NewReader(body)) |
| 3176 |
http.DefaultClient.Do(req) |
| 3177 |
``` |
| 3178 |
|
| 3179 |
|
| 3180 |
=== "PowerShell" |
| 3181 |
``` powershell |
| 3182 |
$Request = @{ |
| 3183 |
Method = "POST" |
| 3184 |
URI = 'https://ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}}' |
| 3185 |
Body = '{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}' |
| 3186 |
ContentType = "application/json" |
| 3187 |
} |
| 3188 |
Invoke-RestMethod @Request |
| 3189 |
``` |
| 3190 |
|
| 3191 |
=== "Python" |
| 3192 |
``` python |
| 3193 |
requests.post( |
| 3194 |
'https://ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}}', |
| 3195 |
data='{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}' |
| 3196 |
) |
| 3197 |
``` |
| 3198 |
|
| 3199 |
=== "PHP" |
| 3200 |
``` php-inline |
| 3201 |
file_get_contents('https://ntfy.sh/mytopic?tpl=yes&t={{.hostname}}:+A+{{.error.level}}+error+has+occurred&m=Error+message:+{{.error.desc}}&p={{if+eq+.error.level+"severe"}}5{{else}}3{{end}}', false, stream_context_create([ |
| 3202 |
'http' => [ |
| 3203 |
'method' => 'POST', |
| 3204 |
'header' => "Content-Type: application/json", |
| 3205 |
'content' => '{"hostname": "phil-pc", "error": {"level": "severe", "desc": "Disk has run out of space"}}' |
| 3206 |
] |
| 3207 |
])); |
| 3208 |
``` |
| 3209 |
|
| 3210 |
This example uses the `message`/`m`, `title`/`t`, and `priority`/`p` query parameters, but obviously this also works with the |
| 3211 |
corresponding headers. It will send a notification with a title `phil-pc: A severe error has occurred`, a message |
| 3212 |
`Error message: Disk has run out of space`, and priority `5` (max) if the level is "severe", or `3` (default) otherwise. |
| 3213 |
|
| 3214 |
### Template syntax |
| 3215 |
ntfy uses [Go templates](https://pkg.go.dev/text/template) for its templates, which is arguably one of the most powerful, |
| 3216 |
yet also one of the worst templating languages out there. |
| 3217 |
|
| 3218 |
You can use the following features in your templates: |
| 3219 |
|
| 3220 |
* Variables, e.g. `{{.alert.title}}` or `An error occurred: {{.error.desc}}` |
| 3221 |
* Conditionals (if/else, e.g. `{{if eq .action "opened"}}..{{else}}..{{end}}`, see [example](https://repeatit.io/#/share/eyJ0ZW1wbGF0ZSI6Ilt7ey5wdWxsX3JlcXVlc3QuaGVhZC5yZXBvLmZ1bGxfbmFtZX19XSBQdWxsIHJlcXVlc3Qge3tpZiBlcSAuYWN0aW9uIFwib3BlbmVkXCJ9fU9QRU5FRHt7ZWxzZX19Q0xPU0VEe3tlbmR9fToge3sucHVsbF9yZXF1ZXN0LnRpdGxlfX0iLCJpbnB1dCI6IntcbiAgXCJhY3Rpb25cIjogXCJvcGVuZWRcIixcbiAgXCJudW1iZXJcIjogMSxcbiAgXCJwdWxsX3Jlc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0NzAyMTIwMDMsXG4gICAgICAgIFwibm9kZV9pZFwiOiBcIlJfa2dET0hBYmRvd1wiLFxuICAgICAgICBcIm5hbWVcIjogXCJkYWJibGVcIixcbiAgICAgICAgXCJmdWxsX25hbWVcIjogXCJiaW53aWVkZXJoaWVyL2RhYmJsZVwiLFxuICAgICAgICBcInByaXZhdGVcIjogZmFsc2UsXG4gICAgICAgIFwib3duZXJcIjoge1xuICAgICAgICAgIFwibG9naW5cIjogXCJiaW53aWVkZXJoaWVyXCIsXG4gICAgICAgICAgXCJpZFwiOiA2NjQ1OTcsXG4gICAgICAgICAgXCJub2RlX2lkXCI6IFwiTURRNlZYTmxjalkyTkRVNU53PT1cIixcbiAgICAgICAgICBcImF2YXRhcl91cmxcIjogXCJodHRwczovL2F2YXRhcnMuZ2l0aHVidXNlcmNvbnRlbnQuY29tL3UvNjY0NTk3P3Y9NFwiLFxuICAgICAgICAgIFwiZ3JhdmF0YXJfaWRcIjogXCJcIixcbiAgICAgICAgICBcInVybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vdXNlcnMvYmlud2llZGVyaGllclwiLFxuICAgICAgICAgIFwiaHRtbF91cmxcIjogXCJodHRwczovL2dpdGh1Yi5jb20vYmlud2llZGVyaGllclwiLFxuICAgICAgICAgIFwiZm9sbG93ZXJzX3VybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vdXNlcnMvYmlud2llZGVyaGllci9mb2xsb3dlcnNcIixcbiAgICAgICAgICBcImZvbGxvd2luZ191cmxcIjogXCJodHRwczovL2FwaS5naXRodWIuY29tL3VzZXJzL2JpbndpZWRlcmhpZXIvZm9sbG93aW5ney9vdGhlcl91c2VyfVwiLFxuICAgICAgICAgIFwiZ2lzdHNfdXJsXCI6IFwiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS91c2Vycy9iaW53aWVkZXJoaWVyL2dpc3Rzey9naXN0X2lkfVwiLFxuICAgICAgICAgIFwic3RhcnJlZF91cmxcI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b20vcmVwb3MvYmlud2llZGVyaGllci9kYWJibGUvc3RhcmdhemVyc1wiLFxuICAgICAgICBcImNvbnRyaWJ1dG9yc191cmxcIjogXCJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL2JpbndpZWRlcmhpZXIvZGFiYmxlL2NvbnRyaWJ1dG9yc1wiLFxuICAgICAgICBcInN1YnNjcmliZXJzX3VybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvYmlud2llZGVyaGllci9kYWJibGUvc3Vic2NyaWJlcnNcIixcbiAgICAgICAgXCJzdWJzY3JpcHRpb25fdXJsXCI6IFwiaHR0cHM6Ly9hcGkuZ2l0aHViLmNvbS9yZXBvcy9iaW53aWVkZXJoaWVyL2RhYmJsZS9zdWJzY3JpcHRpb25cIixcbiAgICAgICAgXCJjb21taXRzX3VybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvYmlud2llZGVyaGllci9kYWJibGUvY29tbWl0c3svc2hhfVwiLFxuICAgICAgICBcImdpdF9jb21taXRzX3VybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvYmlud2llZGVyaGllci9kYWJibGUvZ2l0L2NvbW1pdHN7L3NoYX1cIixcbiAgICAgICAgXCJjb21tZW50c191cmxcIjogXCJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL2JpbndpZWRlcmhpZXIvZGFiYmxlL2NvbW1lbnRzey9udW1iZXJ9XCIsXG4gICAgICAgIFwiaXNzdWVfY29tbWVudF91cmxcIjogXCJodHRwczovL2FwaS5naXRodWIuY29tL3JlcG9zL2JpbndpZWRlcmhpZXIvZGFiYmxlL2lzc3Vlcy9jb21tZW50c3svbnVtYmVyfVwiLFxuICAgICAgICBcImNvbnRlbnRzX3VybFwiOiBcImh0dHBzOi8vYXBpLmdpdGh1Yi5jb20vcmVwb3MvYmlud2llZGVyaGllci9kYWJibGUvY29udGVudHMveytwYXRofVwiLFxuICA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ImNvbmZpZyI6eyJ0ZW1wbGF0ZSI6InRleHQiLCJmdWxsU2NyZWVuSFRNTCI6ZmFsc2UsImZ1bmN0aW9ucyI6WyJzcHJpZyJdLCJvcHRpb25zIjpbImxpdmUiXSwiaW5wdXRUeXBlIjoieWFtbCJ9fQ==)) |
| 3222 |
* Loops (e.g. `{{range .errors}}..{{end}}`, see [example](https://repeatit.io/#/share/eyJ0ZW1wbGF0ZSI6IlNldmVyZSBVUkxzOlxue3tyYW5nZSAuZXJyb3JzfX17e2lmIGVxIC5sZXZlbCBcInNldmVyZVwifX0tIHt7LnVybH19XG57e2VuZH19e3tlbmR9fSIsImlucHV0Ijoie1wiZm9vXCI6IFwiYmFyXCIsIFwiZXJyb3JzXCI6IFt7XCJsZXZlbFwiOiBcInNldmVyZVwiLCBcInVybFwiOiBcImh0dHBzOi8vc2V2ZXJlMS5jb21cIn0se1wibGV2ZWxcIjogXCJ3YXJuaW5nXCIsIFwidXJsXCI6IFwiaHR0cHM6Ly93YXJuaW5nLmNvbVwifSx7XCJsZXZlbFwiOiBcInNldmVyZVwiLCBcInVybFwiOiBcImh0dHBzOi8vc2V2ZXJlMi5jb21cIn1dfSIsImNvbmZpZyI6eyJ0ZW1wbGF0ZSI6InRleHQiLCJmdWxsU2NyZWVuSFRNTCI6ZmFsc2UsImZ1bmN0aW9ucyI6WyJzcHJpZyJdLCJvcHRpb25zIjpbImxpdmUiXSwiaW5wdXRUeXBlIjoieWFtbCJ9fQ==)) |
| 3223 |
|
| 3224 |
A good way to experiment with Go templates is the **[Go Template Playground](https://repeatit.io)**. It is _highly recommended_ to test |
| 3225 |
your templates there first ([example for Grafana alert](https://repeatit.io/#/share/eyJ0ZW1wbGF0ZSI6InRpdGxlPUdyYWZhbmErYWxlcnQ6K3t7LnRpdGxlfX0mbWVzc2FnZT17ey5tZXNzYWdlfX0iLCJpbnB1dCI6IntcbiAgXCJyZWNlaXZlclwiOiBcIm50ZnlcXFxcLmV4YW1wbGVcXFxcLmNvbS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5vZGUrYWxlcnRzJm1hdGNoZXI9aW5zdGFuY2UlM0QxMC4xMDguMC4yJTNBOTEwMCZtYXRjaGVyPWpvYiUzRG5vZGUtZXhwb3J0ZXJcXG5cIlxufVxuIiwiY29uZmlnIjp7InRlbXBsYXRlIjoidGV4dCIsImZ1bGxTY3JlZW5IVE1MIjpmYWxzZSwiZnVuY3Rpb25zIjpbInNwcmlnIl0sIm9wdGlvbnMiOlsibGl2ZSJdLCJpbnB1dFR5cGUiOiJ5YW1sIn19)). |
| 3226 |
|
| 3227 |
!!! info |
| 3228 |
A few Go template features are disabled for user-supplied templates: `{{define}}`, `{{template}}`, |
| 3229 |
`{{block}}`, and `{{call}}` are not allowed. Templates also run with a short execution time limit -- |
| 3230 |
a template that loops too long is stopped and rejected with an HTTP 400 error. Templates are |
| 3231 |
limited to 32 KB in size, `printf` widths and precisions must be below 1000 (`%999d` is |
| 3232 |
allowed, `%1000d` is not), including the `%*d` form that takes the width from an argument, and |
| 3233 |
`indent`/`nindent` are limited to 100 spaces. |
| 3234 |
|
| 3235 |
### Template functions |
| 3236 |
ntfy supports a subset of the **[Sprig template functions](publish/template-functions.md)** (originally copied from [Sprig](https://github.com/Masterminds/sprig), |
| 3237 |
thank you to the Sprig developers 🙏). This is useful for advanced message templating and for transforming the data provided through the JSON payload. |
| 3238 |
|
| 3239 |
Below are the functions that are available to use inside your message, title, and priority templates. |
| 3240 |
|
| 3241 |
* [String Functions](publish/template-functions.md#string-functions): `trim`, `trunc`, `substr`, `plural`, etc. |
| 3242 |
* [String List Functions](publish/template-functions.md#string-list-functions): `splitList`, `sortAlpha`, etc. |
| 3243 |
* [Integer Math Functions](publish/template-functions.md#integer-math-functions): `add`, `max`, `mul`, etc. |
| 3244 |
* [Integer List Functions](publish/template-functions.md#integer-list-functions): `until`, `untilStep` |
| 3245 |
* [Float Math Functions](publish/template-functions.md#float-math-functions): `maxf`, `minf` |
| 3246 |
* [Date Functions](publish/template-functions.md#date-functions): `now`, `date`, etc. |
| 3247 |
* [Defaults Functions](publish/template-functions.md#default-functions): `default`, `empty`, `coalesce`, `fromJSON`, `toJSON`, `toPrettyJSON`, `toRawJSON`, `ternary` |
| 3248 |
* [Encoding Functions](publish/template-functions.md#encoding-functions): `b64enc`, `b64dec`, etc. |
| 3249 |
* [Lists and List Functions](publish/template-functions.md#lists-and-list-functions): `list`, `first`, `uniq`, etc. |
| 3250 |
* [Dictionaries and Dict Functions](publish/template-functions.md#dictionaries-and-dict-functions): `get`, `set`, `dict`, `hasKey`, `pluck`, `dig`, etc. |
| 3251 |
* [Type Conversion Functions](publish/template-functions.md#type-conversion-functions): `atoi`, `int64`, `toString`, etc. |
| 3252 |
* [Path and Filepath Functions](publish/template-functions.md#path-and-filepath-functions): `base`, `dir`, `ext`, `clean`, `isAbs`, `osBase`, `osDir`, `osExt`, `osClean`, `osIsAbs` |
| 3253 |
* [Flow Control Functions](publish/template-functions.md#flow-control-functions): `fail` |
| 3254 |
* Advanced Functions |
| 3255 |
* [Reflection](publish/template-functions.md#reflection-functions): `typeOf`, `kindIs`, `typeIsLike`, etc. |
| 3256 |
* [Cryptographic and Security Functions](publish/template-functions.md#cryptographic-and-security-functions): `sha256sum`, etc. |
| 3257 |
* [URL](publish/template-functions.md#url-functions): `urlParse`, `urlJoin` |
| 3258 |
|
| 3259 |
## E-mail notifications |
| 3260 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 3261 |
|
| 3262 |
You can forward messages to e-mail by specifying an address in the header. This can be useful for messages that |
| 3263 |
you'd like to persist longer, or to blast-notify yourself on all possible channels. |
| 3264 |
|
| 3265 |
Usage is easy: Simply pass the `X-Email` header (or any of its aliases: `X-E-mail`, `Email`, `E-mail`, `Mail`, or `e`). |
| 3266 |
Only one e-mail address is supported. |
| 3267 |
|
| 3268 |
If you are logged in and have a verified email address on your account, you can pass `yes`, `true`, or `1` instead of an |
| 3269 |
address to send to your **primary email address** (the one marked primary in the web app's |
| 3270 |
[Account section](https://ntfy.sh/account)); if you haven't designated a primary, it falls back to your first verified |
| 3271 |
address. This works regardless of the [`smtp-sender-verify`](config.md#e-mail-notifications) setting -- that setting only |
| 3272 |
controls whether *literal* addresses must already be verified on your account. |
| 3273 |
|
| 3274 |
ntfy allows anonymous email sending (if enabled), so the rate limiting is pretty strict (see [limitations](#limitations)). In the |
| 3275 |
default configuration, you get **16 e-mails per visitor** (IP address) and then after that one per hour. On top of |
| 3276 |
that, your IP address appears in the e-mail body. This is to prevent abuse. |
| 3277 |
|
| 3278 |
!!! info |
| 3279 |
On ntfy.sh, anonymous email sending was disabled due to abuse. To use the email notification feature, |
| 3280 |
you must verify your email in the web app's [Account section](https://ntfy.sh/account). The daily limit for |
| 3281 |
free users is **5 emails per visitor per day**. |
| 3282 |
|
| 3283 |
=== "Command line (curl)" |
| 3284 |
``` |
| 3285 |
curl \ |
| 3286 |
-H "Email: [email protected]" \ |
| 3287 |
-H "Tags: warning,skull,backup-host,ssh-login" \ |
| 3288 |
-H "Priority: high" \ |
| 3289 |
-d "Unknown login from 5.31.23.83 to backups.example.com" \ |
| 3290 |
ntfy.sh/alerts |
| 3291 |
curl -H "Email: [email protected]" -d "You've Got Mail" |
| 3292 |
curl -d "You've Got Mail" "ntfy.sh/[email protected]" |
| 3293 |
``` |
| 3294 |
|
| 3295 |
=== "ntfy CLI" |
| 3296 |
``` |
| 3297 |
ntfy publish \ |
| 3298 |
[email protected] \ |
| 3299 |
--tags=warning,skull,backup-host,ssh-login \ |
| 3300 |
--priority=high \ |
| 3301 |
alerts "Unknown login from 5.31.23.83 to backups.example.com" |
| 3302 |
``` |
| 3303 |
|
| 3304 |
=== "HTTP" |
| 3305 |
``` http |
| 3306 |
POST /alerts HTTP/1.1 |
| 3307 |
Host: ntfy.sh |
| 3308 |
Email: [email protected] |
| 3309 |
Tags: warning,skull,backup-host,ssh-login |
| 3310 |
Priority: high |
| 3311 |
|
| 3312 |
Unknown login from 5.31.23.83 to backups.example.com |
| 3313 |
``` |
| 3314 |
|
| 3315 |
=== "JavaScript" |
| 3316 |
``` javascript |
| 3317 |
fetch('https://ntfy.sh/alerts', { |
| 3318 |
method: 'POST', |
| 3319 |
body: "Unknown login from 5.31.23.83 to backups.example.com", |
| 3320 |
headers: { |
| 3321 |
'Email': '[email protected]', |
| 3322 |
'Tags': 'warning,skull,backup-host,ssh-login', |
| 3323 |
'Priority': 'high' |
| 3324 |
} |
| 3325 |
}) |
| 3326 |
``` |
| 3327 |
|
| 3328 |
=== "Go" |
| 3329 |
``` go |
| 3330 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/alerts", |
| 3331 |
strings.NewReader("Unknown login from 5.31.23.83 to backups.example.com")) |
| 3332 |
req.Header.Set("Email", "[email protected]") |
| 3333 |
req.Header.Set("Tags", "warning,skull,backup-host,ssh-login") |
| 3334 |
req.Header.Set("Priority", "high") |
| 3335 |
http.DefaultClient.Do(req) |
| 3336 |
``` |
| 3337 |
|
| 3338 |
=== "PowerShell" |
| 3339 |
``` powershell |
| 3340 |
$Request = @{ |
| 3341 |
Method = "POST" |
| 3342 |
URI = "https://ntfy.sh/alerts" |
| 3343 |
Headers = @{ |
| 3344 |
Title = "Low disk space alert" |
| 3345 |
Priority = "high" |
| 3346 |
Tags = "warning,skull,backup-host,ssh-login") |
| 3347 |
Email = "[email protected]" |
| 3348 |
} |
| 3349 |
Body = "Unknown login from 5.31.23.83 to backups.example.com" |
| 3350 |
} |
| 3351 |
Invoke-RestMethod @Request |
| 3352 |
``` |
| 3353 |
|
| 3354 |
=== "Python" |
| 3355 |
``` python |
| 3356 |
requests.post("https://ntfy.sh/alerts", |
| 3357 |
data="Unknown login from 5.31.23.83 to backups.example.com", |
| 3358 |
headers={ |
| 3359 |
"Email": "[email protected]", |
| 3360 |
"Tags": "warning,skull,backup-host,ssh-login", |
| 3361 |
"Priority": "high" |
| 3362 |
}) |
| 3363 |
``` |
| 3364 |
|
| 3365 |
=== "PHP" |
| 3366 |
``` php-inline |
| 3367 |
file_get_contents('https://ntfy.sh/alerts', false, stream_context_create([ |
| 3368 |
'http' => [ |
| 3369 |
'method' => 'POST', |
| 3370 |
'header' => |
| 3371 |
"Content-Type: text/plain\r\n" . |
| 3372 |
"Email: [email protected]\r\n" . |
| 3373 |
"Tags: warning,skull,backup-host,ssh-login\r\n" . |
| 3374 |
"Priority: high", |
| 3375 |
'content' => 'Unknown login from 5.31.23.83 to backups.example.com' |
| 3376 |
] |
| 3377 |
])); |
| 3378 |
``` |
| 3379 |
|
| 3380 |
Here's what that looks like in Google Mail: |
| 3381 |
|
| 3382 |
<figure markdown> |
| 3383 |
{ width=600 } |
| 3384 |
<figcaption>E-mail notification</figcaption> |
| 3385 |
</figure> |
| 3386 |
|
| 3387 |
## E-mail publishing |
| 3388 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 3389 |
|
| 3390 |
You can publish messages to a topic via e-mail, i.e. by sending an email to a specific address. For instance, you can |
| 3391 |
publish a message to the topic `sometopic` by sending an e-mail to `[email protected]`. This is useful for e-mail |
| 3392 |
based integrations such as for statuspage.io (though these days most services also support webhooks and HTTP calls). |
| 3393 |
|
| 3394 |
Depending on the [server configuration](config.md#e-mail-publishing), the e-mail address format can have a prefix to |
| 3395 |
prevent spam on topics. For ntfy.sh, the prefix is configured to `ntfy-`, meaning that the general e-mail address |
| 3396 |
format is: |
| 3397 |
|
| 3398 |
``` |
| 3399 |
[email protected] |
| 3400 |
``` |
| 3401 |
|
| 3402 |
If [access control](config.md#access-control) is enabled, and the target topic does not support anonymous writes, e-mail publishing won't work |
| 3403 |
without providing an authorized access token or using SMTP AUTH PLAIN. |
| 3404 |
|
| 3405 |
If you use [access tokens](#access-tokens), that will change the format of the e-mail's recipient address to |
| 3406 |
``` |
| 3407 |
[email protected] |
| 3408 |
``` |
| 3409 |
|
| 3410 |
To use [username/password](https://docs.ntfy.sh/publish/#username-password), you can use SMTP PLAIN auth when authenticating |
| 3411 |
to the ntfy server. |
| 3412 |
|
| 3413 |
As of today, e-mail publishing only supports adding a [message title](#message-title) (the e-mail subject). Tags, priority, |
| 3414 |
delay and other features are not supported (yet). Here's an example that will publish a message with the |
| 3415 |
title `You've Got Mail` to topic `sometopic` (see [ntfy.sh/sometopic](https://ntfy.sh/sometopic)): |
| 3416 |
|
| 3417 |
<figure markdown> |
| 3418 |
{ width=500 } |
| 3419 |
<figcaption>Publishing a message via e-mail</figcaption> |
| 3420 |
</figure> |
| 3421 |
|
| 3422 |
## Phone calls |
| 3423 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 3424 |
|
| 3425 |
You can use ntfy to call a phone and **read the message out loud using text-to-speech**. |
| 3426 |
Similar to email notifications, this can be useful to blast-notify yourself on all possible channels, or to notify people that do not have |
| 3427 |
the ntfy app installed on their phone. |
| 3428 |
|
| 3429 |
**Phone numbers have to be previously verified** (via the [web app](https://ntfy.sh/account)), so this feature is |
| 3430 |
**only available to authenticated users** (no anonymous phone calls). To forward a message as a voice call, pass a phone |
| 3431 |
number in the `X-Call` header (or its alias: `Call`), prefixed with a plus sign and the country code, e.g. `+12223334444`. |
| 3432 |
You may also simply pass `yes` as a value to pick the first of your verified phone numbers. |
| 3433 |
On ntfy.sh, this feature is only supported to [ntfy Pro](https://ntfy.sh/app) plans. |
| 3434 |
|
| 3435 |
<figure markdown> |
| 3436 |
 |
| 3437 |
<figcaption>Phone number verification in the <a href="https://ntfy.sh/account">web app</a></figcaption> |
| 3438 |
</figure> |
| 3439 |
|
| 3440 |
As of today, the text-to-speed voice used will only support English. If there is demand for other languages, we'll |
| 3441 |
be happy to add support for that. Please [open an issue on GitHub](https://github.com/binwiederhier/ntfy/issues). |
| 3442 |
|
| 3443 |
!!! info |
| 3444 |
You are responsible for the message content, and **you must abide by the [Twilio Acceptable Use Policy](https://www.twilio.com/en-us/legal/aup)**. |
| 3445 |
This particularly means that you must not use this feature to send unsolicited messages, or messages that are illegal or |
| 3446 |
violate the rights of others. Please read the policy for details. Failure to do so may result in your account being suspended or terminated. |
| 3447 |
|
| 3448 |
Here's how you use it: |
| 3449 |
|
| 3450 |
=== "Command line (curl)" |
| 3451 |
``` |
| 3452 |
curl \ |
| 3453 |
-u :tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 \ |
| 3454 |
-H "Call: +12223334444" \ |
| 3455 |
-d "Your garage seems to be on fire. You should probably check that out." \ |
| 3456 |
ntfy.sh/alerts |
| 3457 |
``` |
| 3458 |
|
| 3459 |
=== "ntfy CLI" |
| 3460 |
``` |
| 3461 |
ntfy publish \ |
| 3462 |
--token=tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 \ |
| 3463 |
--call=+12223334444 \ |
| 3464 |
alerts "Your garage seems to be on fire. You should probably check that out." |
| 3465 |
``` |
| 3466 |
|
| 3467 |
=== "HTTP" |
| 3468 |
``` http |
| 3469 |
POST /alerts HTTP/1.1 |
| 3470 |
Host: ntfy.sh |
| 3471 |
Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 |
| 3472 |
Call: +12223334444 |
| 3473 |
|
| 3474 |
Your garage seems to be on fire. You should probably check that out. |
| 3475 |
``` |
| 3476 |
|
| 3477 |
=== "JavaScript" |
| 3478 |
``` javascript |
| 3479 |
fetch('https://ntfy.sh/alerts', { |
| 3480 |
method: 'POST', |
| 3481 |
body: "Your garage seems to be on fire. You should probably check that out.", |
| 3482 |
headers: { |
| 3483 |
'Authorization': 'Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2', |
| 3484 |
'Call': '+12223334444' |
| 3485 |
} |
| 3486 |
}) |
| 3487 |
``` |
| 3488 |
|
| 3489 |
=== "Go" |
| 3490 |
``` go |
| 3491 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/alerts", |
| 3492 |
strings.NewReader("Your garage seems to be on fire. You should probably check that out.")) |
| 3493 |
req.Header.Set("Call", "+12223334444") |
| 3494 |
req.Header.Set("Authorization", "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2") |
| 3495 |
http.DefaultClient.Do(req) |
| 3496 |
``` |
| 3497 |
|
| 3498 |
=== "PowerShell" |
| 3499 |
``` powershell |
| 3500 |
$Request = @{ |
| 3501 |
Method = "POST" |
| 3502 |
URI = "https://ntfy.sh/alerts" |
| 3503 |
Headers = @{ |
| 3504 |
Authorization = "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" |
| 3505 |
Call = "+12223334444" |
| 3506 |
} |
| 3507 |
Body = "Your garage seems to be on fire. You should probably check that out." |
| 3508 |
} |
| 3509 |
Invoke-RestMethod @Request |
| 3510 |
``` |
| 3511 |
|
| 3512 |
=== "Python" |
| 3513 |
``` python |
| 3514 |
requests.post("https://ntfy.sh/alerts", |
| 3515 |
data="Your garage seems to be on fire. You should probably check that out.", |
| 3516 |
headers={ |
| 3517 |
"Authorization": "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2", |
| 3518 |
"Call": "+12223334444" |
| 3519 |
}) |
| 3520 |
``` |
| 3521 |
|
| 3522 |
=== "PHP" |
| 3523 |
``` php-inline |
| 3524 |
file_get_contents('https://ntfy.sh/alerts', false, stream_context_create([ |
| 3525 |
'http' => [ |
| 3526 |
'method' => 'POST', |
| 3527 |
'header' => |
| 3528 |
"Content-Type: text/plain\r\n" . |
| 3529 |
"Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2\r\n" . |
| 3530 |
"Call: +12223334444", |
| 3531 |
'content' => 'Your garage seems to be on fire. You should probably check that out.' |
| 3532 |
] |
| 3533 |
])); |
| 3534 |
``` |
| 3535 |
|
| 3536 |
Here's what a phone call from ntfy sounds like: |
| 3537 |
|
| 3538 |
<audio controls> |
| 3539 |
<source src="../static/audio/ntfy-phone-call.mp3" type="audio/mpeg"> |
| 3540 |
<source src="../static/audio/ntfy-phone-call.ogg" type="audio/ogg"> |
| 3541 |
</audio> |
| 3542 |
|
| 3543 |
Audio transcript: |
| 3544 |
|
| 3545 |
> You have a notification from ntfy on topic alerts. |
| 3546 |
> Message: Your garage seems to be on fire. You should probably check that out. End message. |
| 3547 |
> This message was sent by user phil. It will be repeated up to three times. |
| 3548 |
|
| 3549 |
## Publish as JSON |
| 3550 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 3551 |
|
| 3552 |
For some integrations with other tools (e.g. [Jellyfin](https://jellyfin.org/), [overseerr](https://overseerr.dev/)), |
| 3553 |
adding custom headers to HTTP requests may be tricky or impossible, so ntfy also allows publishing the entire message |
| 3554 |
as JSON in the request body. |
| 3555 |
|
| 3556 |
To publish as JSON, simple PUT/POST the JSON object directly to the ntfy root URL. The message format is described below |
| 3557 |
the example. |
| 3558 |
|
| 3559 |
!!! info |
| 3560 |
To publish as JSON, you must **PUT/POST to the ntfy root URL**, not to the topic URL. Be sure to check that you're |
| 3561 |
POST-ing to `https://ntfy.sh/` (correct), and not to `https://ntfy.sh/mytopic` (incorrect). |
| 3562 |
|
| 3563 |
Here's an example using most supported parameters. Check the table below for a complete list. The `topic` parameter |
| 3564 |
is the only required one: |
| 3565 |
|
| 3566 |
=== "Command line (curl)" |
| 3567 |
``` |
| 3568 |
curl ntfy.sh \ |
| 3569 |
-d '{ |
| 3570 |
"topic": "mytopic", |
| 3571 |
"message": "Disk space is low at 5.1 GB", |
| 3572 |
"title": "Low disk space alert", |
| 3573 |
"tags": ["warning","cd"], |
| 3574 |
"priority": 4, |
| 3575 |
"attach": "https://filesrv.lan/space.jpg", |
| 3576 |
"filename": "diskspace.jpg", |
| 3577 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3578 |
"actions": [{ "action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" }] |
| 3579 |
}' |
| 3580 |
``` |
| 3581 |
|
| 3582 |
=== "HTTP" |
| 3583 |
``` http |
| 3584 |
POST / HTTP/1.1 |
| 3585 |
Host: ntfy.sh |
| 3586 |
|
| 3587 |
{ |
| 3588 |
"topic": "mytopic", |
| 3589 |
"message": "Disk space is low at 5.1 GB", |
| 3590 |
"title": "Low disk space alert", |
| 3591 |
"tags": ["warning","cd"], |
| 3592 |
"priority": 4, |
| 3593 |
"attach": "https://filesrv.lan/space.jpg", |
| 3594 |
"filename": "diskspace.jpg", |
| 3595 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3596 |
"actions": [{ "action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" }] |
| 3597 |
} |
| 3598 |
``` |
| 3599 |
|
| 3600 |
=== "JavaScript" |
| 3601 |
``` javascript |
| 3602 |
fetch('https://ntfy.sh', { |
| 3603 |
method: 'POST', |
| 3604 |
body: JSON.stringify({ |
| 3605 |
"topic": "mytopic", |
| 3606 |
"message": "Disk space is low at 5.1 GB", |
| 3607 |
"title": "Low disk space alert", |
| 3608 |
"tags": ["warning","cd"], |
| 3609 |
"priority": 4, |
| 3610 |
"attach": "https://filesrv.lan/space.jpg", |
| 3611 |
"filename": "diskspace.jpg", |
| 3612 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3613 |
"actions": [{ "action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" }] |
| 3614 |
}) |
| 3615 |
}) |
| 3616 |
``` |
| 3617 |
|
| 3618 |
=== "Go" |
| 3619 |
``` go |
| 3620 |
// You should probably use json.Marshal() instead and make a proper struct, |
| 3621 |
// or even just use req.Header.Set() like in the other examples, but for the |
| 3622 |
// sake of the example, this is easier. |
| 3623 |
|
| 3624 |
body := `{ |
| 3625 |
"topic": "mytopic", |
| 3626 |
"message": "Disk space is low at 5.1 GB", |
| 3627 |
"title": "Low disk space alert", |
| 3628 |
"tags": ["warning","cd"], |
| 3629 |
"priority": 4, |
| 3630 |
"attach": "https://filesrv.lan/space.jpg", |
| 3631 |
"filename": "diskspace.jpg", |
| 3632 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3633 |
"actions": [{ "action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" }] |
| 3634 |
}` |
| 3635 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/", strings.NewReader(body)) |
| 3636 |
http.DefaultClient.Do(req) |
| 3637 |
``` |
| 3638 |
|
| 3639 |
=== "PowerShell" |
| 3640 |
``` powershell |
| 3641 |
$Request = @{ |
| 3642 |
Method = "POST" |
| 3643 |
URI = "https://ntfy.sh" |
| 3644 |
Body = ConvertTo-JSON @{ |
| 3645 |
Topic = "mytopic" |
| 3646 |
Title = "Low disk space alert" |
| 3647 |
Message = "Disk space is low at 5.1 GB" |
| 3648 |
Priority = 4 |
| 3649 |
Attach = "https://filesrv.lan/space.jpg" |
| 3650 |
FileName = "diskspace.jpg" |
| 3651 |
Tags = @("warning", "cd") |
| 3652 |
Click = "https://homecamera.lan/xasds1h2xsSsa/" |
| 3653 |
Actions = @( |
| 3654 |
@{ |
| 3655 |
Action = "view" |
| 3656 |
Label = "Admin panel" |
| 3657 |
URL = "https://filesrv.lan/admin" |
| 3658 |
} |
| 3659 |
) |
| 3660 |
} |
| 3661 |
ContentType = "application/json" |
| 3662 |
} |
| 3663 |
Invoke-RestMethod @Request |
| 3664 |
``` |
| 3665 |
|
| 3666 |
=== "Python" |
| 3667 |
``` python |
| 3668 |
requests.post("https://ntfy.sh/", |
| 3669 |
data=json.dumps({ |
| 3670 |
"topic": "mytopic", |
| 3671 |
"message": "Disk space is low at 5.1 GB", |
| 3672 |
"title": "Low disk space alert", |
| 3673 |
"tags": ["warning","cd"], |
| 3674 |
"priority": 4, |
| 3675 |
"attach": "https://filesrv.lan/space.jpg", |
| 3676 |
"filename": "diskspace.jpg", |
| 3677 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3678 |
"actions": [{ "action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" }] |
| 3679 |
}) |
| 3680 |
) |
| 3681 |
``` |
| 3682 |
|
| 3683 |
=== "PHP" |
| 3684 |
``` php-inline |
| 3685 |
file_get_contents('https://ntfy.sh/', false, stream_context_create([ |
| 3686 |
'http' => [ |
| 3687 |
'method' => 'POST', |
| 3688 |
'header' => "Content-Type: application/json", |
| 3689 |
'content' => json_encode([ |
| 3690 |
"topic": "mytopic", |
| 3691 |
"message": "Disk space is low at 5.1 GB", |
| 3692 |
"title": "Low disk space alert", |
| 3693 |
"tags": ["warning","cd"], |
| 3694 |
"priority": 4, |
| 3695 |
"attach": "https://filesrv.lan/space.jpg", |
| 3696 |
"filename": "diskspace.jpg", |
| 3697 |
"click": "https://homecamera.lan/xasds1h2xsSsa/", |
| 3698 |
"actions": [["action": "view", "label": "Admin panel", "url": "https://filesrv.lan/admin" ]] |
| 3699 |
]) |
| 3700 |
] |
| 3701 |
])); |
| 3702 |
``` |
| 3703 |
|
| 3704 |
The JSON message format closely mirrors the format of the message you can consume when you [subscribe via the API](subscribe/api.md) |
| 3705 |
(see [JSON message format](subscribe/api.md#json-message-format) for details), but is not exactly identical. Here's an overview of |
| 3706 |
all the supported fields: |
| 3707 |
|
| 3708 |
| Field | Required | Type | Example | Description | |
| 3709 |
|---------------|----------|----------------------------------|-------------------------------------------|-------------------------------------------------------------------------------------------| |
| 3710 |
| `topic` | ✔️ | *string* | `topic1` | Target topic name | |
| 3711 |
| `message` | - | *string* | `Some message` | Message body; set to `triggered` if empty or not passed | |
| 3712 |
| `title` | - | *string* | `Some title` | Message [title](#message-title) | |
| 3713 |
| `tags` | - | *string array* | `["tag1","tag2"]` | List of [tags](#tags-emojis) that may or not map to emojis | |
| 3714 |
| `priority` | - | *int (one of: 1, 2, 3, 4, or 5)* | `4` | Message [priority](#message-priority) with 1=min, 3=default and 5=max | |
| 3715 |
| `actions` | - | *JSON array* | *(see [action buttons](#action-buttons))* | Custom [user action buttons](#action-buttons) for notifications | |
| 3716 |
| `click` | - | *URL* | `https://example.com` | Website opened when notification is [clicked](#click-action) | |
| 3717 |
| `attach` | - | *URL* | `https://example.com/file.jpg` | URL of an attachment, see [attach via URL](#attach-file-from-a-url) | |
| 3718 |
| `markdown` | - | *bool* | `true` | Set to true if the `message` is Markdown-formatted | |
| 3719 |
| `icon` | - | *string* | `https://example.com/icon.png` | URL to use as notification [icon](#icons) | |
| 3720 |
| `filename` | - | *string* | `file.jpg` | File name of the attachment | |
| 3721 |
| `delay` | - | *string* | `30min`, `9am` | Timestamp or duration for delayed delivery | |
| 3722 |
| `email` | - | *e-mail address or 'yes'* | `[email protected]` or `yes` | E-mail address for e-mail notifications, or `yes` to use your primary verified address | |
| 3723 |
| `call` | - | *phone number or 'yes'* | `+1222334444` or `yes` | Phone number to use for [voice call](#phone-calls) | |
| 3724 |
| `sequence_id` | - | *string* | `my-sequence-123` | Sequence ID for [updating/deleting notifications](#updating-deleting-notifications) | |
| 3725 |
|
| 3726 |
## Webhooks (publish via GET) |
| 3727 |
_Supported on:_ :material-android: :material-apple: :material-firefox: |
| 3728 |
|
| 3729 |
In addition to using PUT/POST, you can also send to topics via simple HTTP GET requests. This makes it easy to use |
| 3730 |
a ntfy topic as a [webhook](https://en.wikipedia.org/wiki/Webhook), or if your client has limited HTTP support. |
| 3731 |
|
| 3732 |
To send messages via HTTP GET, simply call the `/publish` endpoint (or its aliases `/send` and `/trigger`). Without |
| 3733 |
any arguments, this will send the message `triggered` to the topic. However, you can provide all arguments that are |
| 3734 |
also supported as HTTP headers as URL-encoded arguments. Be sure to check the list of all |
| 3735 |
[supported parameters and headers](#list-of-all-parameters) for details. |
| 3736 |
|
| 3737 |
For instance, assuming your topic is `mywebhook`, you can simply call `/mywebhook/trigger` to send a message |
| 3738 |
(aka trigger the webhook): |
| 3739 |
|
| 3740 |
=== "Command line (curl)" |
| 3741 |
``` |
| 3742 |
curl ntfy.sh/mywebhook/trigger |
| 3743 |
``` |
| 3744 |
|
| 3745 |
=== "ntfy CLI" |
| 3746 |
``` |
| 3747 |
ntfy trigger mywebhook |
| 3748 |
``` |
| 3749 |
|
| 3750 |
=== "HTTP" |
| 3751 |
``` http |
| 3752 |
GET /mywebhook/trigger HTTP/1.1 |
| 3753 |
Host: ntfy.sh |
| 3754 |
``` |
| 3755 |
|
| 3756 |
=== "JavaScript" |
| 3757 |
``` javascript |
| 3758 |
fetch('https://ntfy.sh/mywebhook/trigger') |
| 3759 |
``` |
| 3760 |
|
| 3761 |
=== "Go" |
| 3762 |
``` go |
| 3763 |
http.Get("https://ntfy.sh/mywebhook/trigger") |
| 3764 |
``` |
| 3765 |
|
| 3766 |
=== "PowerShell" |
| 3767 |
``` powershell |
| 3768 |
Invoke-RestMethod "ntfy.sh/mywebhook/trigger" |
| 3769 |
``` |
| 3770 |
|
| 3771 |
=== "Python" |
| 3772 |
``` python |
| 3773 |
requests.get("https://ntfy.sh/mywebhook/trigger") |
| 3774 |
``` |
| 3775 |
|
| 3776 |
=== "PHP" |
| 3777 |
``` php-inline |
| 3778 |
file_get_contents('https://ntfy.sh/mywebhook/trigger'); |
| 3779 |
``` |
| 3780 |
|
| 3781 |
To add a custom message, simply append the `message=` URL parameter. And of course you can set the |
| 3782 |
[message priority](#message-priority), the [message title](#message-title), and [tags](#tags-emojis) as well. |
| 3783 |
For a full list of possible parameters, check the list of [supported parameters and headers](#list-of-all-parameters). |
| 3784 |
|
| 3785 |
Here's an example with a custom message, tags and a priority: |
| 3786 |
|
| 3787 |
=== "Command line (curl)" |
| 3788 |
``` |
| 3789 |
curl "ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull" |
| 3790 |
``` |
| 3791 |
|
| 3792 |
=== "ntfy CLI" |
| 3793 |
``` |
| 3794 |
ntfy publish \ |
| 3795 |
-p 5 --tags=warning,skull \ |
| 3796 |
mywebhook "Webhook triggered" |
| 3797 |
``` |
| 3798 |
|
| 3799 |
=== "HTTP" |
| 3800 |
``` http |
| 3801 |
GET /mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull HTTP/1.1 |
| 3802 |
Host: ntfy.sh |
| 3803 |
``` |
| 3804 |
|
| 3805 |
=== "JavaScript" |
| 3806 |
``` javascript |
| 3807 |
fetch('https://ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull') |
| 3808 |
``` |
| 3809 |
|
| 3810 |
=== "Go" |
| 3811 |
``` go |
| 3812 |
http.Get("https://ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull") |
| 3813 |
``` |
| 3814 |
|
| 3815 |
=== "PowerShell" |
| 3816 |
``` powershell |
| 3817 |
Invoke-RestMethod "ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull" |
| 3818 |
``` |
| 3819 |
|
| 3820 |
=== "Python" |
| 3821 |
``` python |
| 3822 |
requests.get("https://ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull") |
| 3823 |
``` |
| 3824 |
|
| 3825 |
=== "PHP" |
| 3826 |
``` php-inline |
| 3827 |
file_get_contents('https://ntfy.sh/mywebhook/publish?message=Webhook+triggered&priority=high&tags=warning,skull'); |
| 3828 |
``` |
| 3829 |
|
| 3830 |
## Updating + deleting notifications |
| 3831 |
_Supported on:_ :material-android: :material-firefox: |
| 3832 |
|
| 3833 |
You can **update, clear (mark as read and dismiss), or delete notifications** that have already been delivered. This is useful for scenarios |
| 3834 |
like download progress updates, replacing outdated information, or dismissing notifications that are no longer relevant. |
| 3835 |
|
| 3836 |
* [Updating notifications](#updating-notifications) will alter the content of an existing notification. |
| 3837 |
* [Clearing notifications](#clearing-notifications) will mark them as read and dismiss them from the notification drawer. |
| 3838 |
* [Deleting notifications](#deleting-notifications) will remove them from the notification drawer and remove them in the clients as well (if supported). |
| 3839 |
|
| 3840 |
Here's an example of a download progress notification being updated over time on Android: |
| 3841 |
|
| 3842 |
<div id="updating-notifications-screenshots" class="screenshots"> |
| 3843 |
<a href="../../static/img/android-screenshot-notification-update-1.png"><img src="../../static/img/android-screenshot-notification-update-1.png"/></a> |
| 3844 |
<a href="../../static/img/android-screenshot-notification-update-2.png"><img src="../../static/img/android-screenshot-notification-update-2.png"/></a> |
| 3845 |
</div> |
| 3846 |
|
| 3847 |
To facilitate updating notifications and altering existing notifications, ntfy messages are linked together in a sequence, |
| 3848 |
using a **sequence ID**. When a notification is meant to be updated, cleared, or deleted, you publish a new message with the |
| 3849 |
same sequence ID and the clients will perform the appropriate action on the existing notification. |
| 3850 |
|
| 3851 |
Existing ntfy messages will not be updated on the server or in the message cache. Instead, a new message is created that indicates |
| 3852 |
the update, clear, or delete action. This append-only behavior ensures that message history remains intact. |
| 3853 |
|
| 3854 |
### Updating notifications |
| 3855 |
To update an existing notification, publish a new message with the same sequence ID. Clients will replace the previous |
| 3856 |
notification with the new one. You can either: |
| 3857 |
|
| 3858 |
1. **Use the message ID**: First publish like normal to `POST /<topic>` without a sequence ID, then use the returned message `id` as the sequence ID for updates |
| 3859 |
2. **Use a custom sequence ID**: Publish directly to `POST /<topic>/<sequence_id>` with your own identifier, or use `POST /<topic>` with the |
| 3860 |
`X-Sequence-ID` header (or any of its aliases: `Sequence-ID` or`SID`) |
| 3861 |
|
| 3862 |
If you don't know the sequence ID ahead of time, you can publish a message first and then use the returned |
| 3863 |
message `id` to update it. Here's an example: |
| 3864 |
|
| 3865 |
=== "Command line (curl)" |
| 3866 |
```bash |
| 3867 |
# First, publish a message and capture the message ID |
| 3868 |
curl -d "Downloading file..." ntfy.sh/mytopic |
| 3869 |
# Returns: {"id":"xE73Iyuabi","time":1673542291,...} |
| 3870 |
|
| 3871 |
# Then use the message ID to update it (via URL path) |
| 3872 |
curl -d "Download 50% ..." ntfy.sh/mytopic/xE73Iyuabi |
| 3873 |
|
| 3874 |
# Or update using the X-Sequence-ID header |
| 3875 |
curl -H "X-Sequence-ID: xE73Iyuabi" -d "Download complete" ntfy.sh/mytopic |
| 3876 |
``` |
| 3877 |
|
| 3878 |
=== "ntfy CLI" |
| 3879 |
```bash |
| 3880 |
# First, publish a message and capture the message ID |
| 3881 |
ntfy pub mytopic "Downloading file..." |
| 3882 |
# Returns: {"id":"xE73Iyuabi","time":1673542291,...} |
| 3883 |
|
| 3884 |
# Then use the message ID to update it |
| 3885 |
ntfy pub --sequence-id=xE73Iyuabi mytopic "Download 50% ..." |
| 3886 |
|
| 3887 |
# Update again with the same sequence ID |
| 3888 |
ntfy pub -S xE73Iyuabi mytopic "Download complete" |
| 3889 |
``` |
| 3890 |
|
| 3891 |
=== "HTTP" |
| 3892 |
``` http |
| 3893 |
# First, publish a message and capture the message ID |
| 3894 |
POST /mytopic HTTP/1.1 |
| 3895 |
Host: ntfy.sh |
| 3896 |
|
| 3897 |
Downloading file... |
| 3898 |
|
| 3899 |
# Returns: {"id":"xE73Iyuabi","time":1673542291,...} |
| 3900 |
|
| 3901 |
# Then use the message ID to update it |
| 3902 |
POST /mytopic/xE73Iyuabi HTTP/1.1 |
| 3903 |
Host: ntfy.sh |
| 3904 |
|
| 3905 |
Download 50% ... |
| 3906 |
|
| 3907 |
# Update again with the same sequence ID, this time using the header |
| 3908 |
POST /mytopic HTTP/1.1 |
| 3909 |
Host: ntfy.sh |
| 3910 |
X-Sequence-ID: xE73Iyuabi |
| 3911 |
|
| 3912 |
Download complete |
| 3913 |
``` |
| 3914 |
|
| 3915 |
=== "JavaScript" |
| 3916 |
``` javascript |
| 3917 |
// First, publish and get the message ID |
| 3918 |
const response = await fetch('https://ntfy.sh/mytopic', { |
| 3919 |
method: 'POST', |
| 3920 |
body: 'Downloading file...' |
| 3921 |
}); |
| 3922 |
const { id } = await response.json(); |
| 3923 |
|
| 3924 |
// Update via URL path |
| 3925 |
await fetch(`https://ntfy.sh/mytopic/${id}`, { |
| 3926 |
method: 'POST', |
| 3927 |
body: 'Download 50% ...' |
| 3928 |
}); |
| 3929 |
|
| 3930 |
// Or update using the X-Sequence-ID header |
| 3931 |
await fetch('https://ntfy.sh/mytopic', { |
| 3932 |
method: 'POST', |
| 3933 |
headers: { 'X-Sequence-ID': id }, |
| 3934 |
body: 'Download complete' |
| 3935 |
}); |
| 3936 |
``` |
| 3937 |
|
| 3938 |
=== "Go" |
| 3939 |
``` go |
| 3940 |
// Publish and parse the response to get the message ID |
| 3941 |
resp, _ := http.Post("https://ntfy.sh/mytopic", "text/plain", |
| 3942 |
strings.NewReader("Downloading file...")) |
| 3943 |
var msg struct { ID string `json:"id"` } |
| 3944 |
json.NewDecoder(resp.Body).Decode(&msg) |
| 3945 |
|
| 3946 |
// Update via URL path |
| 3947 |
http.Post("https://ntfy.sh/mytopic/"+msg.ID, "text/plain", |
| 3948 |
strings.NewReader("Download 50% ...")) |
| 3949 |
|
| 3950 |
// Or update using the X-Sequence-ID header |
| 3951 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic", |
| 3952 |
strings.NewReader("Download complete")) |
| 3953 |
req.Header.Set("X-Sequence-ID", msg.ID) |
| 3954 |
http.DefaultClient.Do(req) |
| 3955 |
``` |
| 3956 |
|
| 3957 |
=== "PowerShell" |
| 3958 |
``` powershell |
| 3959 |
# Publish and get the message ID |
| 3960 |
$response = Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic" -Body "Downloading file..." |
| 3961 |
$messageId = $response.id |
| 3962 |
|
| 3963 |
# Update via URL path |
| 3964 |
Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic/$messageId" -Body "Download 50% ..." |
| 3965 |
|
| 3966 |
# Or update using the X-Sequence-ID header |
| 3967 |
Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic" ` |
| 3968 |
-Headers @{"X-Sequence-ID"=$messageId} -Body "Download complete" |
| 3969 |
``` |
| 3970 |
|
| 3971 |
=== "Python" |
| 3972 |
``` python |
| 3973 |
import requests |
| 3974 |
|
| 3975 |
# Publish and get the message ID |
| 3976 |
response = requests.post("https://ntfy.sh/mytopic", data="Downloading file...") |
| 3977 |
message_id = response.json()["id"] |
| 3978 |
|
| 3979 |
# Update via URL path |
| 3980 |
requests.post(f"https://ntfy.sh/mytopic/{message_id}", data="Download 50% ...") |
| 3981 |
|
| 3982 |
# Or update using the X-Sequence-ID header |
| 3983 |
requests.post("https://ntfy.sh/mytopic", |
| 3984 |
headers={"X-Sequence-ID": message_id}, data="Download complete") |
| 3985 |
``` |
| 3986 |
|
| 3987 |
=== "PHP" |
| 3988 |
``` php-inline |
| 3989 |
// Publish and get the message ID |
| 3990 |
$response = file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 3991 |
'http' => ['method' => 'POST', 'content' => 'Downloading file...'] |
| 3992 |
])); |
| 3993 |
$messageId = json_decode($response)->id; |
| 3994 |
|
| 3995 |
// Update via URL path |
| 3996 |
file_get_contents("https://ntfy.sh/mytopic/$messageId", false, stream_context_create([ |
| 3997 |
'http' => ['method' => 'POST', 'content' => 'Download 50% ...'] |
| 3998 |
])); |
| 3999 |
|
| 4000 |
// Or update using the X-Sequence-ID header |
| 4001 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 4002 |
'http' => [ |
| 4003 |
'method' => 'POST', |
| 4004 |
'header' => "X-Sequence-ID: $messageId", |
| 4005 |
'content' => 'Download complete' |
| 4006 |
] |
| 4007 |
])); |
| 4008 |
``` |
| 4009 |
|
| 4010 |
You can also use a **custom sequence ID** (e.g., a download ID, job ID, etc.) when publishing the first message. |
| 4011 |
**This is less cumbersome**, since you don't need to capture the message ID first. Just publish directly to |
| 4012 |
`/<topic>/<sequence_id>`: |
| 4013 |
|
| 4014 |
=== "Command line (curl)" |
| 4015 |
```bash |
| 4016 |
# Publish with a custom sequence ID |
| 4017 |
curl -d "Downloading file..." ntfy.sh/mytopic/my-download-123 |
| 4018 |
|
| 4019 |
# Update using the same sequence ID (via URL path) |
| 4020 |
curl -d "Download 50% ..." ntfy.sh/mytopic/my-download-123 |
| 4021 |
|
| 4022 |
# Or update using the X-Sequence-ID header |
| 4023 |
curl -H "X-Sequence-ID: my-download-123" -d "Download complete" ntfy.sh/mytopic |
| 4024 |
``` |
| 4025 |
|
| 4026 |
=== "ntfy CLI" |
| 4027 |
```bash |
| 4028 |
# Publish with a sequence ID |
| 4029 |
ntfy pub --sequence-id=my-download-123 mytopic "Downloading file..." |
| 4030 |
|
| 4031 |
# Update using the same sequence ID |
| 4032 |
ntfy pub --sequence-id=my-download-123 mytopic "Download 50% ..." |
| 4033 |
|
| 4034 |
# Update again |
| 4035 |
ntfy pub -S my-download-123 mytopic "Download complete" |
| 4036 |
``` |
| 4037 |
|
| 4038 |
=== "HTTP" |
| 4039 |
``` http |
| 4040 |
# Publish a message with a custom sequence ID |
| 4041 |
POST /mytopic/my-download-123 HTTP/1.1 |
| 4042 |
Host: ntfy.sh |
| 4043 |
|
| 4044 |
Downloading file... |
| 4045 |
|
| 4046 |
# Update again using the X-Sequence-ID header |
| 4047 |
POST /mytopic HTTP/1.1 |
| 4048 |
Host: ntfy.sh |
| 4049 |
X-Sequence-ID: my-download-123 |
| 4050 |
|
| 4051 |
Download complete |
| 4052 |
``` |
| 4053 |
|
| 4054 |
=== "JavaScript" |
| 4055 |
``` javascript |
| 4056 |
// First message |
| 4057 |
await fetch('https://ntfy.sh/mytopic/my-download-123', { |
| 4058 |
method: 'POST', |
| 4059 |
body: 'Downloading file...' |
| 4060 |
}); |
| 4061 |
|
| 4062 |
// Update via URL path |
| 4063 |
await fetch('https://ntfy.sh/mytopic/my-download-123', { |
| 4064 |
method: 'POST', |
| 4065 |
body: 'Download 50% ...' |
| 4066 |
}); |
| 4067 |
|
| 4068 |
// Or update using the X-Sequence-ID header |
| 4069 |
await fetch('https://ntfy.sh/mytopic', { |
| 4070 |
method: 'POST', |
| 4071 |
headers: { 'X-Sequence-ID': 'my-download-123' }, |
| 4072 |
body: 'Download complete' |
| 4073 |
}); |
| 4074 |
``` |
| 4075 |
|
| 4076 |
=== "Go" |
| 4077 |
``` go |
| 4078 |
// Publish with sequence ID in URL path |
| 4079 |
http.Post("https://ntfy.sh/mytopic/my-download-123", "text/plain", |
| 4080 |
strings.NewReader("Downloading file...")) |
| 4081 |
|
| 4082 |
// Update via URL path |
| 4083 |
http.Post("https://ntfy.sh/mytopic/my-download-123", "text/plain", |
| 4084 |
strings.NewReader("Download 50% ...")) |
| 4085 |
|
| 4086 |
// Or update using the X-Sequence-ID header |
| 4087 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic", |
| 4088 |
strings.NewReader("Download complete")) |
| 4089 |
req.Header.Set("X-Sequence-ID", "my-download-123") |
| 4090 |
http.DefaultClient.Do(req) |
| 4091 |
``` |
| 4092 |
|
| 4093 |
=== "PowerShell" |
| 4094 |
``` powershell |
| 4095 |
# Publish with sequence ID |
| 4096 |
Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic/my-download-123" -Body "Downloading file..." |
| 4097 |
|
| 4098 |
# Update via URL path |
| 4099 |
Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic/my-download-123" -Body "Download 50% ..." |
| 4100 |
|
| 4101 |
# Or update using the X-Sequence-ID header |
| 4102 |
Invoke-RestMethod -Method POST -Uri "https://ntfy.sh/mytopic" ` |
| 4103 |
-Headers @{"X-Sequence-ID"="my-download-123"} -Body "Download complete" |
| 4104 |
``` |
| 4105 |
|
| 4106 |
=== "Python" |
| 4107 |
``` python |
| 4108 |
import requests |
| 4109 |
|
| 4110 |
# Publish with sequence ID |
| 4111 |
requests.post("https://ntfy.sh/mytopic/my-download-123", data="Downloading file...") |
| 4112 |
|
| 4113 |
# Update via URL path |
| 4114 |
requests.post("https://ntfy.sh/mytopic/my-download-123", data="Download 50% ...") |
| 4115 |
|
| 4116 |
# Or update using the X-Sequence-ID header |
| 4117 |
requests.post("https://ntfy.sh/mytopic", |
| 4118 |
headers={"X-Sequence-ID": "my-download-123"}, data="Download complete") |
| 4119 |
``` |
| 4120 |
|
| 4121 |
=== "PHP" |
| 4122 |
``` php-inline |
| 4123 |
// Publish with sequence ID |
| 4124 |
file_get_contents('https://ntfy.sh/mytopic/my-download-123', false, stream_context_create([ |
| 4125 |
'http' => ['method' => 'POST', 'content' => 'Downloading file...'] |
| 4126 |
])); |
| 4127 |
|
| 4128 |
// Update via URL path |
| 4129 |
file_get_contents('https://ntfy.sh/mytopic/my-download-123', false, stream_context_create([ |
| 4130 |
'http' => ['method' => 'POST', 'content' => 'Download 50% ...'] |
| 4131 |
])); |
| 4132 |
|
| 4133 |
// Or update using the X-Sequence-ID header |
| 4134 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 4135 |
'http' => [ |
| 4136 |
'method' => 'POST', |
| 4137 |
'header' => 'X-Sequence-ID: my-download-123', |
| 4138 |
'content' => 'Download complete' |
| 4139 |
] |
| 4140 |
])); |
| 4141 |
``` |
| 4142 |
|
| 4143 |
You can also set the sequence ID via the `sequence-id` [query parameter](#list-of-all-parameters), or when |
| 4144 |
[publishing as JSON](#publish-as-json) using the `sequence_id` field. |
| 4145 |
|
| 4146 |
If the message ID (`id`) and the sequence ID (`sequence_id`) are different, the ntfy server will include the `sequence_id` |
| 4147 |
field the response. A sequence of updates may look like this (first example from above): |
| 4148 |
|
| 4149 |
```json |
| 4150 |
{"id":"xE73Iyuabi","time":1673542291,"event":"message","topic":"mytopic","message":"Downloading file..."} |
| 4151 |
{"id":"yF84Jzvbcj","time":1673542295,"event":"message","topic":"mytopic","sequence_id":"xE73Iyuabi","message":"Download 50% ..."} |
| 4152 |
{"id":"zG95Kawdde","time":1673542300,"event":"message","topic":"mytopic","sequence_id":"xE73Iyuabi","message":"Download complete"} |
| 4153 |
``` |
| 4154 |
|
| 4155 |
### Clearing notifications |
| 4156 |
Clearing a notification means **marking it as read and dismissing it from the notification drawer**. |
| 4157 |
|
| 4158 |
To do this, send a `PUT` request to the `/<topic>/<sequence_id>/clear` endpoint (or `/<topic>/<sequence_id>/read` as an alias). |
| 4159 |
This will then emit a `message_clear` event that is used by the clients (web app and Android app) to update the read status |
| 4160 |
and dismiss the notification. |
| 4161 |
|
| 4162 |
Alternatively, if your client has limited HTTP support, you can send a `GET` request to the same endpoints: |
| 4163 |
`GET /<topic>/<sequence_id>/clear` or `GET /<topic>/<sequence_id>/read`. |
| 4164 |
|
| 4165 |
=== "Command line (curl)" |
| 4166 |
```bash |
| 4167 |
# Via PUT method |
| 4168 |
curl -X PUT ntfy.sh/mytopic/my-download-123/clear |
| 4169 |
|
| 4170 |
# Via GET method |
| 4171 |
curl ntfy.sh/mytopic/my-download-123/clear |
| 4172 |
``` |
| 4173 |
|
| 4174 |
=== "HTTP" |
| 4175 |
``` http |
| 4176 |
PUT /mytopic/my-download-123/clear HTTP/1.1 |
| 4177 |
Host: ntfy.sh |
| 4178 |
|
| 4179 |
# Or using GET |
| 4180 |
GET /mytopic/my-download-123/clear HTTP/1.1 |
| 4181 |
Host: ntfy.sh |
| 4182 |
``` |
| 4183 |
|
| 4184 |
=== "JavaScript" |
| 4185 |
``` javascript |
| 4186 |
// Via PUT method |
| 4187 |
await fetch('https://ntfy.sh/mytopic/my-download-123/clear', { |
| 4188 |
method: 'PUT' |
| 4189 |
}); |
| 4190 |
|
| 4191 |
// Via GET method |
| 4192 |
await fetch('https://ntfy.sh/mytopic/my-download-123/clear'); |
| 4193 |
``` |
| 4194 |
|
| 4195 |
=== "Go" |
| 4196 |
``` go |
| 4197 |
req, _ := http.NewRequest("PUT", "https://ntfy.sh/mytopic/my-download-123/clear", nil) |
| 4198 |
http.DefaultClient.Do(req) |
| 4199 |
``` |
| 4200 |
|
| 4201 |
=== "PowerShell" |
| 4202 |
``` powershell |
| 4203 |
Invoke-RestMethod -Method PUT -Uri "https://ntfy.sh/mytopic/my-download-123/clear" |
| 4204 |
``` |
| 4205 |
|
| 4206 |
=== "Python" |
| 4207 |
``` python |
| 4208 |
requests.put("https://ntfy.sh/mytopic/my-download-123/clear") |
| 4209 |
``` |
| 4210 |
|
| 4211 |
=== "PHP" |
| 4212 |
``` php-inline |
| 4213 |
file_get_contents('https://ntfy.sh/mytopic/my-download-123/clear', false, stream_context_create([ |
| 4214 |
'http' => ['method' => 'PUT'] |
| 4215 |
])); |
| 4216 |
``` |
| 4217 |
|
| 4218 |
An example response from the server with the `message_clear` event may look like this: |
| 4219 |
|
| 4220 |
```json |
| 4221 |
{"id":"jkl012","time":1673542305,"event":"message_clear","topic":"mytopic","sequence_id":"my-download-123"} |
| 4222 |
``` |
| 4223 |
|
| 4224 |
### Deleting notifications |
| 4225 |
Deleting a notification means **removing it from the notification drawer and from the client's database**. |
| 4226 |
|
| 4227 |
To do this, send a `DELETE` request to the `/<topic>/<sequence_id>` endpoint. This will emit a `message_delete` event |
| 4228 |
that is used by the clients (web app and Android app) to remove the notification entirely. |
| 4229 |
|
| 4230 |
Alternatively, if your client has limited HTTP support (e.g. webhooks or IoT devices), you can also delete a message by sending |
| 4231 |
a `GET` request to `/<topic>/<sequence_id>/delete`. |
| 4232 |
|
| 4233 |
=== "Command line (curl)" |
| 4234 |
```bash |
| 4235 |
# Via DELETE method |
| 4236 |
curl -X DELETE ntfy.sh/mytopic/my-download-123 |
| 4237 |
|
| 4238 |
# Via GET method |
| 4239 |
curl ntfy.sh/mytopic/my-download-123/delete |
| 4240 |
``` |
| 4241 |
|
| 4242 |
=== "HTTP" |
| 4243 |
``` http |
| 4244 |
DELETE /mytopic/my-download-123 HTTP/1.1 |
| 4245 |
Host: ntfy.sh |
| 4246 |
|
| 4247 |
# Or using GET |
| 4248 |
GET /mytopic/my-download-123/delete HTTP/1.1 |
| 4249 |
Host: ntfy.sh |
| 4250 |
``` |
| 4251 |
|
| 4252 |
=== "JavaScript" |
| 4253 |
``` javascript |
| 4254 |
// Via DELETE method |
| 4255 |
await fetch('https://ntfy.sh/mytopic/my-download-123', { |
| 4256 |
method: 'DELETE' |
| 4257 |
}); |
| 4258 |
|
| 4259 |
// Via GET method |
| 4260 |
await fetch('https://ntfy.sh/mytopic/my-download-123/delete'); |
| 4261 |
``` |
| 4262 |
|
| 4263 |
=== "Go" |
| 4264 |
``` go |
| 4265 |
req, _ := http.NewRequest("DELETE", "https://ntfy.sh/mytopic/my-download-123", nil) |
| 4266 |
http.DefaultClient.Do(req) |
| 4267 |
``` |
| 4268 |
|
| 4269 |
=== "PowerShell" |
| 4270 |
``` powershell |
| 4271 |
Invoke-RestMethod -Method DELETE -Uri "https://ntfy.sh/mytopic/my-download-123" |
| 4272 |
``` |
| 4273 |
|
| 4274 |
=== "Python" |
| 4275 |
``` python |
| 4276 |
requests.delete("https://ntfy.sh/mytopic/my-download-123") |
| 4277 |
``` |
| 4278 |
|
| 4279 |
=== "PHP" |
| 4280 |
``` php-inline |
| 4281 |
file_get_contents('https://ntfy.sh/mytopic/my-download-123', false, stream_context_create([ |
| 4282 |
'http' => ['method' => 'DELETE'] |
| 4283 |
])); |
| 4284 |
``` |
| 4285 |
|
| 4286 |
An example response from the server with the `message_delete` event may look like this: |
| 4287 |
|
| 4288 |
```json |
| 4289 |
{"id":"mno345","time":1673542400,"event":"message_delete","topic":"mytopic","sequence_id":"my-download-123"} |
| 4290 |
``` |
| 4291 |
|
| 4292 |
!!! info |
| 4293 |
Deleted sequences can be revived by publishing a new message with the same sequence ID. The notification will |
| 4294 |
reappear as a new message. |
| 4295 |
|
| 4296 |
## Authentication |
| 4297 |
Depending on whether the server is configured to support [access control](config.md#access-control), some topics |
| 4298 |
may be read/write protected so that only users with the correct credentials can subscribe or publish to them. |
| 4299 |
To publish/subscribe to protected topics, you can: |
| 4300 |
|
| 4301 |
* Use [username & password](#username-password) via Basic auth, e.g. `Authorization: Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk` |
| 4302 |
* Use [access tokens](#access-tokens) via Bearer/Basic auth, e.g. `Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2` |
| 4303 |
* or use either with the [`auth` query parameter](#query-param), e.g. `?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw` |
| 4304 |
|
| 4305 |
!!! warning |
| 4306 |
When using Basic auth, base64 only encodes username and password. It **is not encrypting it**. For your |
| 4307 |
self-hosted server, **be sure to use HTTPS to avoid eavesdropping** and exposing your password. |
| 4308 |
|
| 4309 |
### Username + password |
| 4310 |
The simplest way to authenticate against a ntfy server is to use [Basic auth](https://en.wikipedia.org/wiki/Basic_access_authentication). |
| 4311 |
Here's an example with a user `testuser` and password `fakepassword`: |
| 4312 |
|
| 4313 |
=== "Command line (curl)" |
| 4314 |
``` |
| 4315 |
curl \ |
| 4316 |
-u testuser:fakepassword \ |
| 4317 |
-d "Look ma, with auth" \ |
| 4318 |
https://ntfy.example.com/mysecrets |
| 4319 |
``` |
| 4320 |
|
| 4321 |
=== "ntfy CLI" |
| 4322 |
``` |
| 4323 |
ntfy publish \ |
| 4324 |
-u testuser:fakepassword \ |
| 4325 |
ntfy.example.com/mysecrets \ |
| 4326 |
"Look ma, with auth" |
| 4327 |
``` |
| 4328 |
|
| 4329 |
=== "HTTP" |
| 4330 |
``` http |
| 4331 |
POST /mysecrets HTTP/1.1 |
| 4332 |
Host: ntfy.example.com |
| 4333 |
Authorization: Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk |
| 4334 |
|
| 4335 |
Look ma, with auth |
| 4336 |
``` |
| 4337 |
|
| 4338 |
=== "JavaScript" |
| 4339 |
``` javascript |
| 4340 |
fetch('https://ntfy.example.com/mysecrets', { |
| 4341 |
method: 'POST', // PUT works too |
| 4342 |
body: 'Look ma, with auth', |
| 4343 |
headers: { |
| 4344 |
'Authorization': 'Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk' |
| 4345 |
} |
| 4346 |
}) |
| 4347 |
``` |
| 4348 |
|
| 4349 |
=== "Go" |
| 4350 |
``` go |
| 4351 |
req, _ := http.NewRequest("POST", "https://ntfy.example.com/mysecrets", |
| 4352 |
strings.NewReader("Look ma, with auth")) |
| 4353 |
req.Header.Set("Authorization", "Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk") |
| 4354 |
http.DefaultClient.Do(req) |
| 4355 |
``` |
| 4356 |
|
| 4357 |
=== "PowerShell 7+" |
| 4358 |
``` powershell |
| 4359 |
# Get the credentials from the user |
| 4360 |
$Credential = Get-Credential testuser |
| 4361 |
|
| 4362 |
# Alternatively, create a PSCredential object with the password from scratch |
| 4363 |
$Credential = [PSCredential]::new("testuser", (ConvertTo-SecureString "password" -AsPlainText -Force)) |
| 4364 |
|
| 4365 |
# Note that the Authentication parameter requires PowerShell 7 or later |
| 4366 |
$Request = @{ |
| 4367 |
Method = "POST" |
| 4368 |
URI = "https://ntfy.example.com/mysecrets" |
| 4369 |
Authentication = "Basic" |
| 4370 |
Credential = $Credential |
| 4371 |
Body = "Look ma, with auth" |
| 4372 |
} |
| 4373 |
Invoke-RestMethod @Request |
| 4374 |
``` |
| 4375 |
|
| 4376 |
=== "PowerShell 5 and earlier" |
| 4377 |
``` powershell |
| 4378 |
# With PowerShell 5 or earlier, we need to create the base64 username:password string ourselves |
| 4379 |
$CredentialString = "$($Credential.Username):$($Credential.GetNetworkCredential().Password)" |
| 4380 |
$EncodedCredential = [Convert]::ToBase64String([Text.Encoding]::UTF8.GetBytes($CredentialString)) |
| 4381 |
$Request = @{ |
| 4382 |
Method = "POST" |
| 4383 |
URI = "https://ntfy.example.com/mysecrets" |
| 4384 |
Headers = @{ Authorization = "Basic $EncodedCredential"} |
| 4385 |
Body = "Look ma, with auth" |
| 4386 |
} |
| 4387 |
Invoke-RestMethod @Request |
| 4388 |
``` |
| 4389 |
|
| 4390 |
=== "Python" |
| 4391 |
``` python |
| 4392 |
requests.post("https://ntfy.example.com/mysecrets", |
| 4393 |
data="Look ma, with auth", |
| 4394 |
headers={ |
| 4395 |
"Authorization": "Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk" |
| 4396 |
}) |
| 4397 |
``` |
| 4398 |
|
| 4399 |
=== "PHP" |
| 4400 |
``` php-inline |
| 4401 |
file_get_contents('https://ntfy.example.com/mysecrets', false, stream_context_create([ |
| 4402 |
'http' => [ |
| 4403 |
'method' => 'POST', // PUT also works |
| 4404 |
'header' => |
| 4405 |
'Content-Type: text/plain\r\n' . |
| 4406 |
'Authorization: Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk', |
| 4407 |
'content' => 'Look ma, with auth' |
| 4408 |
] |
| 4409 |
])); |
| 4410 |
``` |
| 4411 |
|
| 4412 |
To generate the `Authorization` header, use **standard base64** to encode the colon-separated `<username>:<password>` |
| 4413 |
and prepend the word `Basic`, i.e. `Authorization: Basic base64(<username>:<password>)`. Here's some pseudo-code that |
| 4414 |
hopefully explains it better: |
| 4415 |
|
| 4416 |
``` |
| 4417 |
username = "testuser" |
| 4418 |
password = "fakepassword" |
| 4419 |
authHeader = "Basic " + base64(username + ":" + password) // -> Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk |
| 4420 |
``` |
| 4421 |
|
| 4422 |
The following command will generate the appropriate value for you on *nix systems: |
| 4423 |
|
| 4424 |
``` |
| 4425 |
echo "Basic $(echo -n 'testuser:fakepassword' | base64)" |
| 4426 |
``` |
| 4427 |
|
| 4428 |
### Access tokens |
| 4429 |
In addition to username/password auth, ntfy also provides authentication via access tokens. Access tokens are useful |
| 4430 |
to avoid having to configure your password across multiple publishing/subscribing applications. For instance, you may |
| 4431 |
want to use a dedicated token to publish from your backup host, and one from your home automation system. |
| 4432 |
|
| 4433 |
You can create access tokens using the `ntfy token` command, or in the web app in the "Account" section (when logged in). |
| 4434 |
See [access tokens](config.md#access-tokens) for details. |
| 4435 |
|
| 4436 |
Once an access token is created, you can use it to authenticate against the ntfy server, e.g. when you publish or |
| 4437 |
subscribe to topics. Here's an example using [Bearer auth](https://swagger.io/docs/specification/authentication/bearer-authentication/), |
| 4438 |
with the token `tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2`: |
| 4439 |
|
| 4440 |
=== "Command line (curl)" |
| 4441 |
``` |
| 4442 |
curl \ |
| 4443 |
-H "Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" \ |
| 4444 |
-d "Look ma, with auth" \ |
| 4445 |
https://ntfy.example.com/mysecrets |
| 4446 |
``` |
| 4447 |
|
| 4448 |
=== "ntfy CLI" |
| 4449 |
``` |
| 4450 |
ntfy publish \ |
| 4451 |
--token tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 \ |
| 4452 |
ntfy.example.com/mysecrets \ |
| 4453 |
"Look ma, with auth" |
| 4454 |
``` |
| 4455 |
|
| 4456 |
=== "HTTP" |
| 4457 |
``` http |
| 4458 |
POST /mysecrets HTTP/1.1 |
| 4459 |
Host: ntfy.example.com |
| 4460 |
Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 |
| 4461 |
|
| 4462 |
Look ma, with auth |
| 4463 |
``` |
| 4464 |
|
| 4465 |
=== "JavaScript" |
| 4466 |
``` javascript |
| 4467 |
fetch('https://ntfy.example.com/mysecrets', { |
| 4468 |
method: 'POST', // PUT works too |
| 4469 |
body: 'Look ma, with auth', |
| 4470 |
headers: { |
| 4471 |
'Authorization': 'Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2' |
| 4472 |
} |
| 4473 |
}) |
| 4474 |
``` |
| 4475 |
|
| 4476 |
=== "Go" |
| 4477 |
``` go |
| 4478 |
req, _ := http.NewRequest("POST", "https://ntfy.example.com/mysecrets", |
| 4479 |
strings.NewReader("Look ma, with auth")) |
| 4480 |
req.Header.Set("Authorization", "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2") |
| 4481 |
http.DefaultClient.Do(req) |
| 4482 |
``` |
| 4483 |
|
| 4484 |
=== "PowerShell 7+" |
| 4485 |
``` powershell |
| 4486 |
# With PowerShell 7 or greater, we can use the Authentication and Token parameters |
| 4487 |
# The Token parameter must be in the form of a System.Security.SecureString |
| 4488 |
|
| 4489 |
$Request = @{ |
| 4490 |
Method = "POST" |
| 4491 |
URI = "https://ntfy.example.com/mysecrets" |
| 4492 |
Authentication = "Bearer" |
| 4493 |
Token = ConvertTo-SecureString "tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" -AsPlainText |
| 4494 |
Body = "Look ma, with auth" |
| 4495 |
} |
| 4496 |
Invoke-RestMethod @Request |
| 4497 |
``` |
| 4498 |
|
| 4499 |
=== "PowerShell 5 and earlier" |
| 4500 |
``` powershell |
| 4501 |
# In PowerShell 5 and below, we can only send the Bearer token as a string in the Headers |
| 4502 |
$Request = @{ |
| 4503 |
Method = "POST" |
| 4504 |
URI = "https://ntfy.example.com/mysecrets" |
| 4505 |
Headers = @{ Authorization = "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" } |
| 4506 |
Body = "Look ma, with auth" |
| 4507 |
} |
| 4508 |
Invoke-RestMethod @Request |
| 4509 |
``` |
| 4510 |
|
| 4511 |
=== "Python" |
| 4512 |
``` python |
| 4513 |
requests.post("https://ntfy.example.com/mysecrets", |
| 4514 |
data="Look ma, with auth", |
| 4515 |
headers={ |
| 4516 |
"Authorization": "Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2" |
| 4517 |
}) |
| 4518 |
``` |
| 4519 |
|
| 4520 |
=== "PHP" |
| 4521 |
``` php-inline |
| 4522 |
file_get_contents('https://ntfy.example.com/mysecrets', false, stream_context_create([ |
| 4523 |
'http' => [ |
| 4524 |
'method' => 'POST', // PUT also works |
| 4525 |
'header' => |
| 4526 |
'Content-Type: text/plain\r\n' . |
| 4527 |
'Authorization: Bearer tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2', |
| 4528 |
'content' => 'Look ma, with auth' |
| 4529 |
] |
| 4530 |
])); |
| 4531 |
``` |
| 4532 |
|
| 4533 |
Alternatively, you can use [Basic Auth](https://en.wikipedia.org/wiki/Basic_access_authentication) to send the |
| 4534 |
access token. When sending an empty username, the basic auth password is treated by the ntfy server as an |
| 4535 |
access token. This is primarily useful to make `curl` calls easier, e.g. `curl -u:tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 ...`: |
| 4536 |
|
| 4537 |
=== "Command line (curl)" |
| 4538 |
``` |
| 4539 |
curl \ |
| 4540 |
-u :tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 \ |
| 4541 |
-d "Look ma, with auth" \ |
| 4542 |
https://ntfy.example.com/mysecrets |
| 4543 |
``` |
| 4544 |
|
| 4545 |
=== "ntfy CLI" |
| 4546 |
``` |
| 4547 |
ntfy publish \ |
| 4548 |
--token tk_AgQdq7mVBoFD37zQVN29RhuMzNIz2 \ |
| 4549 |
ntfy.example.com/mysecrets \ |
| 4550 |
"Look ma, with auth" |
| 4551 |
``` |
| 4552 |
|
| 4553 |
=== "HTTP" |
| 4554 |
``` http |
| 4555 |
POST /mysecrets HTTP/1.1 |
| 4556 |
Host: ntfy.example.com |
| 4557 |
Authorization: Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy |
| 4558 |
|
| 4559 |
Look ma, with auth |
| 4560 |
``` |
| 4561 |
|
| 4562 |
=== "JavaScript" |
| 4563 |
``` javascript |
| 4564 |
fetch('https://ntfy.example.com/mysecrets', { |
| 4565 |
method: 'POST', // PUT works too |
| 4566 |
body: 'Look ma, with auth', |
| 4567 |
headers: { |
| 4568 |
'Authorization': 'Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy' |
| 4569 |
} |
| 4570 |
}) |
| 4571 |
``` |
| 4572 |
|
| 4573 |
=== "Go" |
| 4574 |
``` go |
| 4575 |
req, _ := http.NewRequest("POST", "https://ntfy.example.com/mysecrets", |
| 4576 |
strings.NewReader("Look ma, with auth")) |
| 4577 |
req.Header.Set("Authorization", "Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy") |
| 4578 |
http.DefaultClient.Do(req) |
| 4579 |
``` |
| 4580 |
|
| 4581 |
=== "PowerShell" |
| 4582 |
``` powershell |
| 4583 |
# Note that PSCredentials *must* have a username, so we fall back to placing the authorization in the Headers as with PowerShell 5 |
| 4584 |
$Request = @{ |
| 4585 |
Method = "POST" |
| 4586 |
URI = "https://ntfy.example.com/mysecrets" |
| 4587 |
Headers = @{ |
| 4588 |
Authorization = "Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy" |
| 4589 |
} |
| 4590 |
Body = "Look ma, with auth" |
| 4591 |
} |
| 4592 |
Invoke-RestMethod @Request |
| 4593 |
``` |
| 4594 |
|
| 4595 |
=== "Python" |
| 4596 |
``` python |
| 4597 |
requests.post("https://ntfy.example.com/mysecrets", |
| 4598 |
data="Look ma, with auth", |
| 4599 |
headers={ |
| 4600 |
"Authorization": "Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy" |
| 4601 |
}) |
| 4602 |
``` |
| 4603 |
|
| 4604 |
=== "PHP" |
| 4605 |
``` php-inline |
| 4606 |
file_get_contents('https://ntfy.example.com/mysecrets', false, stream_context_create([ |
| 4607 |
'http' => [ |
| 4608 |
'method' => 'POST', // PUT also works |
| 4609 |
'header' => |
| 4610 |
'Content-Type: text/plain\r\n' . |
| 4611 |
'Authorization: Basic OnRrX0FnUWRxN21WQm9GRDM3elFWTjI5Umh1TXpOSXoy', |
| 4612 |
'content' => 'Look ma, with auth' |
| 4613 |
] |
| 4614 |
])); |
| 4615 |
``` |
| 4616 |
|
| 4617 |
|
| 4618 |
### Query param |
| 4619 |
Here's an example using the `auth` query parameter: |
| 4620 |
|
| 4621 |
=== "Command line (curl)" |
| 4622 |
``` |
| 4623 |
curl \ |
| 4624 |
-d "Look ma, with auth" \ |
| 4625 |
"https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw" |
| 4626 |
``` |
| 4627 |
|
| 4628 |
=== "ntfy CLI" |
| 4629 |
``` |
| 4630 |
ntfy publish \ |
| 4631 |
-u testuser:fakepassword \ |
| 4632 |
ntfy.example.com/mysecrets \ |
| 4633 |
"Look ma, with auth" |
| 4634 |
``` |
| 4635 |
|
| 4636 |
=== "HTTP" |
| 4637 |
``` http |
| 4638 |
POST /mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw HTTP/1.1 |
| 4639 |
Host: ntfy.example.com |
| 4640 |
|
| 4641 |
Look ma, with auth |
| 4642 |
``` |
| 4643 |
|
| 4644 |
=== "JavaScript" |
| 4645 |
``` javascript |
| 4646 |
fetch('https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw', { |
| 4647 |
method: 'POST', // PUT works too |
| 4648 |
body: 'Look ma, with auth' |
| 4649 |
}) |
| 4650 |
``` |
| 4651 |
|
| 4652 |
=== "Go" |
| 4653 |
``` go |
| 4654 |
req, _ := http.NewRequest("POST", "https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw", |
| 4655 |
strings.NewReader("Look ma, with auth")) |
| 4656 |
http.DefaultClient.Do(req) |
| 4657 |
``` |
| 4658 |
|
| 4659 |
=== "PowerShell" |
| 4660 |
``` powershell |
| 4661 |
$Request = @{ |
| 4662 |
Method = "POST" |
| 4663 |
URI = "https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw" |
| 4664 |
Body = "Look ma, with auth" |
| 4665 |
} |
| 4666 |
Invoke-RestMethod @Request |
| 4667 |
``` |
| 4668 |
|
| 4669 |
=== "Python" |
| 4670 |
``` python |
| 4671 |
requests.post("https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw", |
| 4672 |
data="Look ma, with auth" |
| 4673 |
``` |
| 4674 |
|
| 4675 |
=== "PHP" |
| 4676 |
``` php-inline |
| 4677 |
file_get_contents('https://ntfy.example.com/mysecrets?auth=QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw', false, stream_context_create([ |
| 4678 |
'http' => [ |
| 4679 |
'method' => 'POST', // PUT also works |
| 4680 |
'header' => 'Content-Type: text/plain', |
| 4681 |
'content' => 'Look ma, with auth' |
| 4682 |
] |
| 4683 |
])); |
| 4684 |
``` |
| 4685 |
|
| 4686 |
To generate the value of the `auth` parameter, encode the value of the `Authorization` header (see above) using |
| 4687 |
**raw base64 encoding** (like base64, but strip any trailing `=`). Here's some pseudo-code that hopefully |
| 4688 |
explains it better: |
| 4689 |
|
| 4690 |
``` |
| 4691 |
username = "testuser" |
| 4692 |
password = "fakepassword" |
| 4693 |
authHeader = "Basic " + base64(username + ":" + password) // -> Basic dGVzdHVzZXI6ZmFrZXBhc3N3b3Jk |
| 4694 |
authParam = base64_raw(authHeader) // -> QmFzaWMgZEdWemRIVnpaWEk2Wm1GclpYQmhjM04zYjNKaw (no trailing =) |
| 4695 |
|
| 4696 |
// If your language does not have a function to encode raw base64, simply use normal base64 |
| 4697 |
// and REMOVE TRAILING "=" characters. |
| 4698 |
``` |
| 4699 |
|
| 4700 |
The following command will generate the appropriate value for you on *nix systems: |
| 4701 |
|
| 4702 |
``` |
| 4703 |
echo -n "Basic `echo -n 'testuser:fakepassword' | base64 -w0`" | base64 -w0 | tr -d '=' |
| 4704 |
``` |
| 4705 |
|
| 4706 |
For access tokens, you can use this instead: |
| 4707 |
|
| 4708 |
``` |
| 4709 |
echo -n "Bearer faketoken" | base64 -w0 | tr -d '=' |
| 4710 |
``` |
| 4711 |
|
| 4712 |
## Advanced features |
| 4713 |
|
| 4714 |
### Message caching |
| 4715 |
!!! info |
| 4716 |
If `Cache: no` is used, messages will only be delivered to connected subscribers, and won't be re-delivered if a |
| 4717 |
client re-connects. If a subscriber has (temporary) network issues or is reconnecting momentarily, |
| 4718 |
**messages might be missed**. |
| 4719 |
|
| 4720 |
By default, the ntfy server caches messages on disk for 12 hours (see [message caching](config.md#message-cache)), so |
| 4721 |
all messages you publish are stored server-side for a little while. The reason for this is to overcome temporary |
| 4722 |
client-side network disruptions, but arguably this feature also may raise privacy concerns. |
| 4723 |
|
| 4724 |
To avoid messages being cached server-side entirely, you can set `X-Cache` header (or its alias: `Cache`) to `no`. |
| 4725 |
This will make sure that your message is not cached on the server, even if server-side caching is enabled. Messages |
| 4726 |
are still delivered to connected subscribers, but [`since=`](subscribe/api.md#fetch-cached-messages) and |
| 4727 |
[`poll=1`](subscribe/api.md#poll-for-messages) won't return the message anymore. |
| 4728 |
|
| 4729 |
=== "Command line (curl)" |
| 4730 |
``` |
| 4731 |
curl -H "X-Cache: no" -d "This message won't be stored server-side" ntfy.sh/mytopic |
| 4732 |
curl -H "Cache: no" -d "This message won't be stored server-side" ntfy.sh/mytopic |
| 4733 |
``` |
| 4734 |
|
| 4735 |
=== "ntfy CLI" |
| 4736 |
``` |
| 4737 |
ntfy publish \ |
| 4738 |
--no-cache \ |
| 4739 |
mytopic "This message won't be stored server-side" |
| 4740 |
``` |
| 4741 |
|
| 4742 |
=== "HTTP" |
| 4743 |
``` http |
| 4744 |
POST /mytopic HTTP/1.1 |
| 4745 |
Host: ntfy.sh |
| 4746 |
Cache: no |
| 4747 |
|
| 4748 |
This message won't be stored server-side |
| 4749 |
``` |
| 4750 |
|
| 4751 |
=== "JavaScript" |
| 4752 |
``` javascript |
| 4753 |
fetch('https://ntfy.sh/mytopic', { |
| 4754 |
method: 'POST', |
| 4755 |
body: 'This message won't be stored server-side', |
| 4756 |
headers: { 'Cache': 'no' } |
| 4757 |
}) |
| 4758 |
``` |
| 4759 |
|
| 4760 |
=== "Go" |
| 4761 |
``` go |
| 4762 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic", strings.NewReader("This message won't be stored server-side")) |
| 4763 |
req.Header.Set("Cache", "no") |
| 4764 |
http.DefaultClient.Do(req) |
| 4765 |
``` |
| 4766 |
|
| 4767 |
=== "PowerShell" |
| 4768 |
``` powershell |
| 4769 |
$Request = @{ |
| 4770 |
Method = "POST" |
| 4771 |
URI = "https://ntfy.sh/mytopic" |
| 4772 |
Headers = @{ Cache="no" } |
| 4773 |
Body = "This message won't be stored server-side" |
| 4774 |
} |
| 4775 |
Invoke-RestMethod @Request |
| 4776 |
``` |
| 4777 |
|
| 4778 |
=== "Python" |
| 4779 |
``` python |
| 4780 |
requests.post("https://ntfy.sh/mytopic", |
| 4781 |
data="This message won't be stored server-side", |
| 4782 |
headers={ "Cache": "no" }) |
| 4783 |
``` |
| 4784 |
|
| 4785 |
=== "PHP" |
| 4786 |
``` php-inline |
| 4787 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 4788 |
'http' => [ |
| 4789 |
'method' => 'POST', |
| 4790 |
'header' => |
| 4791 |
"Content-Type: text/plain\r\n" . |
| 4792 |
"Cache: no", |
| 4793 |
'content' => 'This message won't be stored server-side' |
| 4794 |
] |
| 4795 |
])); |
| 4796 |
``` |
| 4797 |
|
| 4798 |
### Disable Firebase |
| 4799 |
!!! info |
| 4800 |
If `Firebase: no` is used and [instant delivery](subscribe/phone.md#instant-delivery) isn't enabled in the Android |
| 4801 |
app (Google Play variant only), **message delivery will be significantly delayed (up to 15 minutes)**. To overcome |
| 4802 |
this delay, simply enable instant delivery. |
| 4803 |
|
| 4804 |
The ntfy server can be configured to use [Firebase Cloud Messaging (FCM)](https://firebase.google.com/docs/cloud-messaging) |
| 4805 |
(see [Firebase config](config.md#firebase-fcm)) for message delivery on Android (to minimize the app's battery footprint). |
| 4806 |
The ntfy.sh server is configured this way, meaning that all messages published to ntfy.sh are also published to corresponding |
| 4807 |
FCM topics. |
| 4808 |
|
| 4809 |
If you'd like to avoid forwarding messages to Firebase, you can set the `X-Firebase` header (or its alias: `Firebase`) |
| 4810 |
to `no`. This will instruct the server not to forward messages to Firebase. |
| 4811 |
|
| 4812 |
=== "Command line (curl)" |
| 4813 |
``` |
| 4814 |
curl -H "X-Firebase: no" -d "This message won't be forwarded to FCM" ntfy.sh/mytopic |
| 4815 |
curl -H "Firebase: no" -d "This message won't be forwarded to FCM" ntfy.sh/mytopic |
| 4816 |
``` |
| 4817 |
|
| 4818 |
=== "ntfy CLI" |
| 4819 |
``` |
| 4820 |
ntfy publish \ |
| 4821 |
--no-firebase \ |
| 4822 |
mytopic "This message won't be forwarded to FCM" |
| 4823 |
``` |
| 4824 |
|
| 4825 |
=== "HTTP" |
| 4826 |
``` http |
| 4827 |
POST /mytopic HTTP/1.1 |
| 4828 |
Host: ntfy.sh |
| 4829 |
Firebase: no |
| 4830 |
|
| 4831 |
This message won't be forwarded to FCM |
| 4832 |
``` |
| 4833 |
|
| 4834 |
=== "JavaScript" |
| 4835 |
``` javascript |
| 4836 |
fetch('https://ntfy.sh/mytopic', { |
| 4837 |
method: 'POST', |
| 4838 |
body: 'This message won't be forwarded to FCM', |
| 4839 |
headers: { 'Firebase': 'no' } |
| 4840 |
}) |
| 4841 |
``` |
| 4842 |
|
| 4843 |
=== "Go" |
| 4844 |
``` go |
| 4845 |
req, _ := http.NewRequest("POST", "https://ntfy.sh/mytopic", strings.NewReader("This message won't be forwarded to FCM")) |
| 4846 |
req.Header.Set("Firebase", "no") |
| 4847 |
http.DefaultClient.Do(req) |
| 4848 |
``` |
| 4849 |
|
| 4850 |
=== "PowerShell" |
| 4851 |
``` powershell |
| 4852 |
$Request = @{ |
| 4853 |
Method = "POST" |
| 4854 |
URI = "https://ntfy.sh/mytopic" |
| 4855 |
Headers = @{ Firebase="no" } |
| 4856 |
Body = "This message won't be forwarded to FCM" |
| 4857 |
} |
| 4858 |
Invoke-RestMethod @Request |
| 4859 |
``` |
| 4860 |
|
| 4861 |
=== "Python" |
| 4862 |
``` python |
| 4863 |
requests.post("https://ntfy.sh/mytopic", |
| 4864 |
data="This message won't be forwarded to FCM", |
| 4865 |
headers={ "Firebase": "no" }) |
| 4866 |
``` |
| 4867 |
|
| 4868 |
=== "PHP" |
| 4869 |
``` php-inline |
| 4870 |
file_get_contents('https://ntfy.sh/mytopic', false, stream_context_create([ |
| 4871 |
'http' => [ |
| 4872 |
'method' => 'POST', |
| 4873 |
'header' => |
| 4874 |
"Content-Type: text/plain\r\n" . |
| 4875 |
"Firebase: no", |
| 4876 |
'content' => 'This message won't be stored server-side' |
| 4877 |
] |
| 4878 |
])); |
| 4879 |
``` |
| 4880 |
|
| 4881 |
### UnifiedPush |
| 4882 |
!!! info |
| 4883 |
This setting is not relevant to users, only to app developers and people interested in [UnifiedPush](https://unifiedpush.org). |
| 4884 |
|
| 4885 |
[UnifiedPush](https://unifiedpush.org) is a standard for receiving push notifications without using the Google-owned |
| 4886 |
[Firebase Cloud Messaging (FCM)](https://firebase.google.com/docs/cloud-messaging) service. It puts push notifications |
| 4887 |
in the control of the user. ntfy can act as a **UnifiedPush distributor**, forwarding messages to apps that support it. |
| 4888 |
|
| 4889 |
When publishing messages to a topic, apps using ntfy as a UnifiedPush distributor can set the `X-UnifiedPush` header or query |
| 4890 |
parameter (or any of its aliases `unifiedpush` or `up`) to `1` to [disable Firebase](#disable-firebase). As of today, this |
| 4891 |
option is mostly equivalent to `Firebase: no`, but was introduced to allow future flexibility. The flag additionally |
| 4892 |
enables auto-detection of the message encoding. If the message is binary, it'll be encoded as base64. |
| 4893 |
|
| 4894 |
### Matrix Gateway |
| 4895 |
The ntfy server implements a [Matrix Push Gateway](https://spec.matrix.org/v1.2/push-gateway-api/) (in combination with |
| 4896 |
[UnifiedPush](https://unifiedpush.org) as the [Provider Push Protocol](https://unifiedpush.org/developers/gateway/)). This makes it easier to integrate |
| 4897 |
with self-hosted [Matrix](https://matrix.org/) servers (such as [synapse](https://github.com/matrix-org/synapse)), since |
| 4898 |
you don't have to set up a separate push proxy (such as [common-proxies](https://github.com/UnifiedPush/common-proxies)). |
| 4899 |
|
| 4900 |
In short, ntfy accepts Matrix messages on the `/_matrix/push/v1/notify` endpoint (see [Push Gateway API](https://spec.matrix.org/v1.2/push-gateway-api/)), |
| 4901 |
and forwards them to the ntfy topic defined in the `pushkey` of the message. The message will then be forwarded to the |
| 4902 |
ntfy Android app, and passed on to the Matrix client there. |
| 4903 |
|
| 4904 |
There is a nice diagram in the [Push Gateway docs](https://spec.matrix.org/v1.2/push-gateway-api/). In this diagram, the |
| 4905 |
ntfy server plays the role of the Push Gateway, as well as the Push Provider. UnifiedPush is the Provider Push Protocol. |
| 4906 |
|
| 4907 |
!!! info |
| 4908 |
This is not a generic Matrix Push Gateway. It only works in combination with UnifiedPush and ntfy. |
| 4909 |
|
| 4910 |
## Public topics |
| 4911 |
Obviously all topics on ntfy.sh are public, but there are a few designated topics that are used in examples, and topics |
| 4912 |
that you can use to try out what [authentication and access control](#authentication) looks like. |
| 4913 |
|
| 4914 |
| Topic | User | Permissions | Description | |
| 4915 |
|------------------------------------------------|-----------------------------------|------------------------------------------------------|--------------------------------------| |
| 4916 |
| [announcements](https://ntfy.sh/announcements) | `*` (unauthenticated) | Read-only for everyone | Release announcements and such | |
| 4917 |
| [stats](https://ntfy.sh/stats) | `*` (unauthenticated) | Read-only for everyone | Daily statistics about ntfy.sh usage | |
| 4918 |
|
| 4919 |
## Limitations |
| 4920 |
There are a few limitations to the API to prevent abuse and to keep the server healthy. Almost all of these settings |
| 4921 |
are configurable via the server side [rate limiting settings](config.md#rate-limiting). Most of these limits you won't run into, |
| 4922 |
but just in case, let's list them all: |
| 4923 |
|
| 4924 |
| Limit | Description | |
| 4925 |
|----------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------| |
| 4926 |
| **Message length** | Each message can be up to 4,096 bytes long. Longer messages are treated as [attachments](#attachments). | |
| 4927 |
| **Requests** | By default, the server is configured to allow 60 requests per visitor at once, and then refills the your allowed requests bucket at a rate of one request per 5 seconds. | |
| 4928 |
| **Daily messages** | By default, the number of messages is governed by the request limits. This can be overridden. On ntfy.sh, the daily message limit is 250. | |
| 4929 |
| **E-mails** | By default, the server is configured to allow sending 16 e-mails per visitor at once, and then refills the your allowed e-mail bucket at a rate of one per hour. On ntfy.sh, the daily limit is 5. | |
| 4930 |
| **Phone calls** | By default, the server does not allow any phone calls, except for users with a tier that has a call limit. | |
| 4931 |
| **Subscription limit** | By default, the server allows each visitor to keep 30 connections to the server open. | |
| 4932 |
| **Attachment size limit** | By default, the server allows attachments up to 15 MB in size, up to 100 MB in total per visitor and up to 5 GB across all visitors. On ntfy.sh, the attachment size limit is 2 MB, and the per-visitor total is 20 MB. | |
| 4933 |
| **Attachment expiry** | By default, the server deletes attachments after 3 hours and thereby frees up space from the total visitor attachment limit. | |
| 4934 |
| **Attachment bandwidth** | By default, the server allows 500 MB of GET/PUT/POST traffic for attachments per visitor in a 24 hour period. Traffic exceeding that is rejected. On ntfy.sh, the daily bandwidth limit is 200 MB. | |
| 4935 |
| **Total number of topics** | By default, the server is configured to allow 15,000 topics. The ntfy.sh server has higher limits though. | |
| 4936 |
|
| 4937 |
These limits can be changed on a per-user basis using [tiers](config.md#tiers). If [payments](config.md#payments) are enabled, a user tier can be changed by purchasing |
| 4938 |
a higher tier. ntfy.sh offers multiple paid tiers, which allows for much hier limits than the ones listed above. |
| 4939 |
|
| 4940 |
## List of all parameters |
| 4941 |
The following is a list of all parameters that can be passed when publishing a message. Parameter names are **case-insensitive** |
| 4942 |
when used in **HTTP headers**, and must be **lowercase** when used as **query parameters in the URL**. They are listed in the |
| 4943 |
table in their canonical form. |
| 4944 |
|
| 4945 |
!!! info |
| 4946 |
ntfy supports UTF-8 in HTTP headers, but [not every library or programming language does](https://www.jmix.io/blog/utf-8-in-http-headers/). |
| 4947 |
If non-ASCII characters are causing issues for you in the title (i.e. you're seeing `?` symbols), you may also encode any |
| 4948 |
header as [RFC 2047](https://datatracker.ietf.org/doc/html/rfc2047#section-2), e.g. `=?UTF-8?B?8J+HqfCfh6o=?=` ([base64](https://en.wikipedia.org/wiki/Base64)), |
| 4949 |
or `=?UTF-8?Q?=C3=84pfel?=` ([quoted-printable](https://en.wikipedia.org/wiki/Quoted-printable)). |
| 4950 |
|
| 4951 |
| Parameter | Aliases | Description | |
| 4952 |
|-----------------|--------------------------------------------|-----------------------------------------------------------------------------------------------| |
| 4953 |
| `X-Message` | `Message`, `m` | Main body of the message as shown in the notification | |
| 4954 |
| `X-Title` | `Title`, `t` | [Message title](#message-title) | |
| 4955 |
| `X-Sequence-ID` | `Sequence-ID`, `SID` | [Sequence ID](#updating-deleting-notifications) for updating/clearing/deleting notifications | |
| 4956 |
| `X-Priority` | `Priority`, `prio`, `p` | [Message priority](#message-priority) | |
| 4957 |
| `X-Tags` | `Tags`, `Tag`, `ta` | [Tags and emojis](#tags-emojis) | |
| 4958 |
| `X-Delay` | `Delay`, `X-At`, `At`, `X-In`, `In` | Timestamp or duration for [delayed delivery](#scheduled-delivery) | |
| 4959 |
| `X-Actions` | `Actions`, `Action` | JSON array or short format of [user actions](#action-buttons) | |
| 4960 |
| `X-Click` | `Click` | URL to open when [notification is clicked](#click-action) | |
| 4961 |
| `X-Attach` | `Attach`, `a` | URL to send as an [attachment](#attachments), as an alternative to PUT/POST-ing an attachment | |
| 4962 |
| `X-Markdown` | `Markdown`, `md` | Enable [Markdown formatting](#markdown-formatting) in the notification body | |
| 4963 |
| `X-Icon` | `Icon` | URL to use as notification [icon](#icons) | |
| 4964 |
| `X-Filename` | `Filename`, `file`, `f` | Optional [attachment](#attachments) filename, as it appears in the client | |
| 4965 |
| `X-Email` | `X-E-Mail`, `Email`, `E-Mail`, `mail`, `e` | E-mail address (or `yes`) for [e-mail notifications](#e-mail-notifications) | |
| 4966 |
| `X-Call` | `Call` | Phone number for [phone calls](#phone-calls) | |
| 4967 |
| `X-Cache` | `Cache` | Allows disabling [message caching](#message-caching) | |
| 4968 |
| `X-Firebase` | `Firebase` | Allows disabling [sending to Firebase](#disable-firebase) | |
| 4969 |
| `X-UnifiedPush` | `UnifiedPush`, `up` | [UnifiedPush](#unifiedpush) publish option, only to be used by UnifiedPush apps | |
| 4970 |
| `X-Poll-ID` | `Poll-ID` | Internal parameter, used for [iOS push notifications](config.md#ios-instant-notifications) | |
| 4971 |
| `Authorization` | - | If supported by the server, you can [login to access](#authentication) protected topics | |
| 4972 |
| `Content-Type` | - | If set to `text/markdown`, [Markdown formatting](#markdown-formatting) is enabled | |