Setting up a Post-consumption Script for Push Notifications
To use push notifications with Paperparrot, you first have to set up notifications in Paperparrot and save your user ID. Once you're done, come back here to set up your server.
First, create a shell script on your server that POSTs the following information as JSON to https://push.paperparrot.me:
{
"user_id" : ${YOUR_USER_ID},
"document_id": ${DOCUMENT_ID}
}
You can use or this one (replace the user_id with the one Paperparrot generated for you, Paperless will automatically insert the document id):
#!/bin/bash
curl --request POST --url https://push.paperparrot.me/ --header 'Content-Type: application/json' --data '{
"user_id": "81E4AED3-63ED-461D-80EB-2C167654D5F7",
"document_id": '${DOCUMENT_ID}'
}'
Then update your docker-compose.yml with the following:
...
webserver:
...
volumes:
...
/path/to/script.sh:/path/in/container/scripts/post-consume.sh
...
environment:
...
PAPERLESS_POST_CONSUME_SCRIPT: /path/in/container/scripts/post-consume.sh
...
If you installed Paperless bare metal, add this line to Paperless.conf:
PAPERLESS_POST_CONSUME_SCRIPT=</path/to/script.sh>
Finally, restart Paperless. If you did everything right, you will now receive a notification for every document that was consumed by your server. If you tap the notification, Paperparrot will automatically open the new document.
If you're having any issues, feel free to contact me at [email protected], or on the Paperparrot Discord