[Feature Request] Pushover support

Please consider adding Pushover support for notifications. I’m not keen on cluttering my email box.

I did see a post on this forum outlining a way to add Pushover notifications, however, I’m running Duplicacy-web in Docker, and the transposition to that environment is less clear. It would be great to see the Pushover notifications activation within the GUI.

More on Pushover’s API here

Thank you…

1 Like

As an equivalent alternative, I’d rather see support for Apprise or Apprise API. This would support Pushover and several other notification options.

If you’re referring to the post titled “Duplicacy and push notifications to phone [Guide]”, the method is exactly the same.

In order to preserve your backup configuration and schedules between restarts, you would have had to map one or more local directories/folders into the Docker container. Your Pushover API token would be stored there, then update the URL field in the web GUI for the backup to point to pushover.net.

What operating system are you running Docker on?

Speaking as a Duplicacy user…

There are too many notification platform choices out there to favor one, or just a few, over others (not to mention the extra customer support required).

Since Duplicacy is already able to call pre- and post- scripts during a backup run, it avoids baking in additional code and/or complexity into Duplicacy itself that would then require more QA with each new release.

Great suggestion! (first time I’d ever heard of Apprise)

Unfortunately, Apprise and Duplicacy don’t share the same programming language (Python and Go, respectively). Unless someone ports a version in Go, I don’t see it happening anytime soon. Apprise also depends on 15 to 17 external Python libraries, so a port might not be easy.

Fortunately, Apprise includes a CLI interface which can easily be called by Duplicacy after a backup run has completed.

The CLI call is a decent option. Adding a webhook call after an operation would allow using an Apprise API container. Ultimately, this is already possible using the existing pre and post run scripts.

Yes, that is the post. Using it I created the “report.tmpl” file, however I’m unclear which container mapping it requires. My docker compose mappings are:

      - /volume1/testing:/data/restore_target:rw
      - /volume1/docker/duplicacy/logs:/logs:rw
      - /volume1/docker/duplicacy/config:/config:rw
      - /volume1/photo:/data/photo:ro

Would I place the report.tmpl file in the /volume1/docker/duplicacy/config folder, or other?

I’m using Docker with Synology. Thank you!

Yes, that’s right, /config inside the Docker container is equivalent to ~/.duplicacy-web referred to in that Pushover how-to post, so report.tmpl goes into /volume1/docker/duplicacy/config for your setup.

Apparently, I’m still missing something, as I am not receiving notifications. I have set the report link as follows:

And I’ve literally copied the template from that reference post (adding my app and account keys within the quote marks), saving it as report.tmpl in the /volume1/docker/duplicacy/config folder. I created that file simply with notepad, it is not formatted in any way (should it be?).

I didn’t check “Send report on failure” as initially I want the notification to occur with every backup.

What am I missing? Thank you.

Other than syntax, pretty formatting JSON in terms of indentation, spaces, tabs, newlines and so on isn’t important.

Because there are several pieces in play, the first thing I’d do is confirm that your report template for Duplicacy can actually trigger a notification from Pushover. Since the report template is just a simple JSON file, on Linux / macOS / Windows (10 or higher), use the bundled curl utility to upload it to Pushover.

First, open a terminal/command-prompt and check the version of curl that’s installed:

curl -V

If it’s version 7.82 or higher, change directories to wherever a copy of your report.tmpl file is located, and type/paste the following command:

curl --silent --json @report.tmpl https://api.pushover.net/1/messages.json

(The @ tells curl to upload the contents of the specified file – curl assumes the file is in the current working directory unless a pathname is provided.)

Curl doesn’t do any validation or syntax checking on the JSON. If your report template is valid, and you’ve got things set up correctly at Pushover, you should receive a notification.

1 Like

curl -V

7.54

If it’s version 7.82 or higher

Still, I gave this a shot…

curl --silent --json @report.tmpl https://api.pushover.net/1/messages.json
curl: option --json: is unknown

Any hope here?
Thanks!

A small update… I went into the duplicacy-web container console, and curl -V reported 7.74. Still, the option --json reported unknown.

I’m guessing the container would use its built-in curl (7.74), rather than the one Synology’s OS has.

Yeah, the --json parameter wasn’t added until v7.82 (released March 5, 2022).

The newer --json parameter is a shortcut alternative to this:

curl --silent --header "Content-Type: application/json" --header "Accept: application/json" --data 'JSON' https://api.pushover.net/1/messages.json

Replace the word “JSON” with the contents of your report.tmpl file. It’ll be easier if you strip all of the newlines so that it’s one long string – e.g., from this…

{
"BackupResult": "{{.result}}",
"BeginTime": "{{.start_time}}",
"TotalFiles": "{{.total_files}}",
"Storage": "{{.storage_url}}",
"token": "YOUR_APP_TOKEN",
"user": "YOUR_USER_TOKEN",
"message": "Backup {{.result}}. {{.total_files}} files in {{.directory}}",
"title": "Backup Completed"
}

… to this:

{ "BackupResult": "{{.result}}", "BeginTime": "{{.start_time}}", "TotalFiles": "{{.total_files}}", "Storage": "{{.storage_url}}", "token": "YOUR_APP_TOKEN", "user": "YOUR_USER_TOKEN", "message": "Backup {{.result}}. {{.total_files}} files in {{.directory}}", "title": "Backup Completed" }
1 Like

No success. My result was:

{"status":400,"error":"Bad Request"}bash-5.1#

This was run within the duplicacy-web container console.

I used this…

curl --silent --header "Content-Type: application/json" --header "Accept: application/json" --data '{ “BackupResult”: “{{.result}}”,“BeginTime”: {{.start_time}},“TotalFiles”: {{.total_files}},“Storage”: “{{.storage_url}}”,“token”: “secretapptoken”,“user”: “secretusertoken”,“message”: “Backup {{.result}}. {{.total_files}} files in {{.directory}}”,“title”: “Duplicacy Backup ompleted” }' https://api.pushover.net/1/messages.json

I’m unsure how to code this for a single line with scrollbar on this forum.

Overall the command above looks good, but your report template has a syntax problem, a potential character encoding issue, and a minor spelling error:

  • The JSON string is missing double quotes around the {{.start_time}} and {{.total_files}} placeholders.
  • It’s best to replace the “curly” double quotes (i.e., the version used by word processors and in print) with plain ASCII double quotes (0x22). While some JSON parsers might accept curly quotes, I don’t recall them being in the specification. (The Quotation mark - Wikipedia page has more details on the differences.)
  • “Backup ompleted” :wink:

On a desktop web browser click the ‘</>’ icon in the editor toolbar, press keyboard shortcut [Ctrl+E], or bracket with three consecutive backticks in markup syntax to enter preformatted text.

1 Like

Success!

Thank you for all that work. I would not have caught that myself.

I added the missing quotes (yes, they are missing from the referenced link above), and fixed the curly quotes (and the typo). So this…

{
"BackupResult": "{{.result}}",
"BeginTime": "{{.start_time}}",
"TotalFiles": "{{.total_files}}",
"Storage": "{{.storage_url}}",
"token": "apptoken",
"user": "usertoken",
"message": "Backup {{.result}}. {{.total_files}} files in {{.directory}}",
"title": "Duplicacy Backup Completed"
}

Ran a backup and the Pushover notification came through.

1 Like

This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.