diff --git a/Post-Consume-Script-Examples.md b/Post-Consume-Script-Examples.md index 94df022..f0987f5 100644 --- a/Post-Consume-Script-Examples.md +++ b/Post-Consume-Script-Examples.md @@ -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}) ``` \ No newline at end of file