1
0
Fork 0
mirror of https://github.com/binwiederhier/ntfy.git synced 2024-11-26 21:25:18 +01:00

Update publish.md

This commit is contained in:
aTable 2022-05-05 21:13:45 +10:00 committed by GitHub
parent 57c7a353b5
commit c37793d06f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -169,7 +169,6 @@ You can also do multi-line messages. Here's an example using a click action, a u
``` sh ``` sh
#!/bin/bash #!/bin/bash
curl \ curl \
-H "Title: New visitor" \
-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" \
-H "Actions: http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \ -H "Actions: http, Open door, https://api.nest.com/open/yAxkasd, clear=true" \
@ -184,7 +183,6 @@ Doggies have been known to ring the doorbell." \
=== "ntfy CLI" === "ntfy CLI"
``` ```
ntfy publish \ ntfy publish \
--title="New visitor" \
--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" \
@ -200,7 +198,6 @@ Doggies have been known to ring the doorbell."
``` http ``` http
POST /mydoorbell HTTP/1.1 POST /mydoorbell HTTP/1.1
Host: ntfy.sh Host: ntfy.sh
Title: New visitor
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
@ -217,7 +214,6 @@ Doggies have been known to ring the doorbell."
fetch('https://ntfy.sh/mydoorbell', { fetch('https://ntfy.sh/mydoorbell', {
method: 'POST', // PUT works too method: 'POST', // PUT works too
headers: { headers: {
'Title': 'New visitor',
'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',
@ -237,7 +233,6 @@ Doggies have been known to ring the doorbell.`,
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("Title", "New visitor")
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")
@ -248,8 +243,7 @@ Doggies have been known to ring the doorbell.`))
=== "PowerShell" === "PowerShell"
``` powershell ``` powershell
$uri = "https://ntfy.sh/mydoorbell" $uri = "https://ntfy.sh/mydoorbell"
$headers = @{ Title="New visitor" $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"
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"}
@ -270,7 +264,6 @@ Doggies have been known to ring the doorbell.
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={
"Title": "New visitor",
"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",
@ -285,7 +278,6 @@ Doggies have been known to ring the doorbell.""".encode('utf-8'),
'method' => 'POST', // PUT also works 'method' => 'POST', // PUT also works
'header' => 'header' =>
"Content-Type: text/plain\r\n" . "Content-Type: text/plain\r\n" .
"Title: New visitor\r\n" .
"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" .