Added new example for sending messages via ntfy with a Paperparrot link

Freddy0 2024-07-16 13:30:32 +02:00
parent 1466e29bff
commit d56f5a0146

@ -79,4 +79,25 @@ if __name__ == "__main__":
timeout=timeout,
)
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})
```