mirror of
https://github.com/paperless-ngx/paperless-ngx.git
synced 2025-12-09 08:15:27 +01:00
Added new example for sending messages via ntfy with a Paperparrot link
parent
1466e29bff
commit
d56f5a0146
1 changed files with 21 additions and 0 deletions
|
|
@ -80,3 +80,24 @@ if __name__ == "__main__":
|
||||||
)
|
)
|
||||||
resp.raise_for_status()
|
resp.raise_for_status()
|
||||||
```
|
```
|
||||||
|
|
||||||
|
|
||||||
|
## Send new document message via ntfy + Paperparrot
|
||||||
|
|
||||||
|
```python
|
||||||
|
#!/usr/bin/env python3
|
||||||
|
|
||||||
|
import os, requests, json
|
||||||
|
|
||||||
|
DOCUMENT_ID = os.getenv('DOCUMENT_ID')
|
||||||
|
USER = os.getenv('DOCUMENT_OWNER')
|
||||||
|
|
||||||
|
PAPERPARROT_URL = f"paperparrot://documents/{DOCUMENT_ID}"
|
||||||
|
NTFY_URL = "https://ntfy.example.com/"
|
||||||
|
|
||||||
|
requests.post(NTFY_URL, data=json.dumps({
|
||||||
|
"topic": USER,
|
||||||
|
"message": f"Hi, {USER}, a Document has been added",
|
||||||
|
"actions": [{"action": "view", "label": "Open", "url": PAPERPARROT_URL}]
|
||||||
|
}), headers={"Click": PAPERPARROT_URL})
|
||||||
|
```
|
||||||
Loading…
Add table
Add a link
Reference in a new issue