1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-26 13:19:15 +01:00

Fix rendering for publish example

This commit is contained in:
Philipp Heckel 2022-05-05 10:53:51 -04:00
parent 66d30fb42a
commit c1517e259d
3 changed files with 35 additions and 34 deletions

View file

@ -163,11 +163,11 @@ a [title](#message-title), and [tag messages](#tags-emojis) 🥳 🎉. Here's an
<figcaption>Urgent notification with tags and title</figcaption> <figcaption>Urgent notification with tags and title</figcaption>
</figure> </figure>
You can also do multi-line messages. Here's an example using a click action, a user action, with an external image attachment and forwarded via email: You can also do multi-line messages. Here's an example using a [click action](#click-action), an [action button](#action-buttons),
an [external image attachment](#attach-file-from-a-url) and [email publishing](#e-mail-publishing):
=== "Command line (curl)" === "Command line (curl)"
``` sh ```
#!/bin/bash
curl \ curl \
-H "Click: https://home.nest.com/" \ -H "Click: https://home.nest.com/" \
-H "Attach: https://nest.com/view/yAxkasd.jpg" \ -H "Attach: https://nest.com/view/yAxkasd.jpg" \
@ -175,8 +175,8 @@ You can also do multi-line messages. Here's an example using a click action, a u
-H "Email: phil@example.com" \ -H "Email: phil@example.com" \
-d "There's someone at the door. 🐶 -d "There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell." \ Doggies have been known to ring the doorbell." \
ntfy.sh/mydoorbell ntfy.sh/mydoorbell
``` ```
@ -186,12 +186,12 @@ Doggies have been known to ring the doorbell." \
--click="https://home.nest.com/" \ --click="https://home.nest.com/" \
--attach="https://nest.com/view/yAxkasd.jpg" \ --attach="https://nest.com/view/yAxkasd.jpg" \
--actions="http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \ --actions="http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \
--email="phil@example.com" --email="phil@example.com" \
mydoorbell \ mydoorbell \
"There's someone at the door. 🐶 "There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell." Doggies have been known to ring the doorbell."
``` ```
=== "HTTP" === "HTTP"
@ -221,8 +221,8 @@ Doggies have been known to ring the doorbell."
}, },
body: `There's someone at the door. 🐶 body: `There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell.`, Doggies have been known to ring the doorbell.`,
}) })
``` ```
@ -231,8 +231,8 @@ Doggies have been known to ring the doorbell.`,
req, _ := http.NewRequest("POST", "https://ntfy.sh/mydoorbell", req, _ := http.NewRequest("POST", "https://ntfy.sh/mydoorbell",
strings.NewReader(`There's someone at the door. 🐶 strings.NewReader(`There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell.`)) Doggies have been known to ring the doorbell.`))
req.Header.Set("Click", "https://home.nest.com/") req.Header.Set("Click", "https://home.nest.com/")
req.Header.Set("Attach", "https://nest.com/view/yAxkasd.jpg") req.Header.Set("Attach", "https://nest.com/view/yAxkasd.jpg")
req.Header.Set("Actions", "http, Open door, https://api.nest.com/open/yAxkasd, clear=true") req.Header.Set("Actions", "http, Open door, https://api.nest.com/open/yAxkasd, clear=true")
@ -246,13 +246,13 @@ Doggies have been known to ring the doorbell.`))
$headers = @{ Click="https://home.nest.com/" $headers = @{ Click="https://home.nest.com/"
Attach="https://nest.com/view/yAxkasd.jpg" Attach="https://nest.com/view/yAxkasd.jpg"
Actions="http, Open door, https://api.nest.com/open/yAxkasd, clear=true" Actions="http, Open door, https://api.nest.com/open/yAxkasd, clear=true"
Email="phil@example.com"} Email="phil@example.com" }
$body = @' $body = @'
There's someone at the door. 🐶 There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell. Doggies have been known to ring the doorbell.
'@ '@
Invoke-RestMethod -Method 'Post' -Uri $uri -Headers $headers -Body $body -UseBasicParsing Invoke-RestMethod -Method 'Post' -Uri $uri -Headers $headers -Body $body -UseBasicParsing
``` ```
@ -261,8 +261,8 @@ Doggies have been known to ring the doorbell.
requests.post("https://ntfy.sh/mydoorbell", requests.post("https://ntfy.sh/mydoorbell",
data="""There's someone at the door. 🐶 data="""There's someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it's a good boy or a hooman.
Doggies have been known to ring the doorbell.""".encode('utf-8'), Doggies have been known to ring the doorbell.""".encode('utf-8'),
headers={ headers={
"Click": "https://home.nest.com/", "Click": "https://home.nest.com/",
"Attach": "https://nest.com/view/yAxkasd.jpg", "Attach": "https://nest.com/view/yAxkasd.jpg",
@ -281,17 +281,17 @@ Doggies have been known to ring the doorbell.""".encode('utf-8'),
"Click: https://home.nest.com/\r\n" . "Click: https://home.nest.com/\r\n" .
"Attach: https://nest.com/view/yAxkasd.jpg\r\n" . "Attach: https://nest.com/view/yAxkasd.jpg\r\n" .
"Actions": "http, Open door, https://api.nest.com/open/yAxkasd, clear=true\r\n" . "Actions": "http, Open door, https://api.nest.com/open/yAxkasd, clear=true\r\n" .
"Email": "phil@example.com\r\n" , "Email": "phil@example.com\r\n",
'content' => 'There's someone at the door. 🐶 'content' => 'There\'s someone at the door. 🐶
Please check if it's a good boy or a hooman. Please check if it\'s a good boy or a hooman.
Doggies have been known to ring the doorbell.' Doggies have been known to ring the doorbell.'
] ]
])); ]));
``` ```
<figure markdown> <figure markdown>
![priority notification](static/img/complete-notification.jpg){ width=500 } ![priority notification](static/img/android-screenshot-notification-multiline.jpg){ width=500 }
<figcaption>Notification using a click action, a user action, with an external image attachment and forwarded via email</figcaption> <figcaption>Notification using a click action, a user action, with an external image attachment and forwarded via email</figcaption>
</figure> </figure>

View file

@ -40,6 +40,7 @@ to [@Joeharrison94](https://github.com/Joeharrison94) for the input.
**Documentation:** **Documentation:**
* Improved caddy configuration (no ticket, thanks to @Stnby) * Improved caddy configuration (no ticket, thanks to @Stnby)
* Additional multi-line examples on the [publish page](https://ntfy.sh/docs/publish/) ([#234](https://github.com/binwiederhier/ntfy/pull/234), thanks to [@aTable](https://github.com/aTable))
**Additional translations:** **Additional translations:**

View file

Before

Width:  |  Height:  |  Size: 130 KiB

After

Width:  |  Height:  |  Size: 130 KiB