If you want to send notifications from your (self-hosted) Duplicati instance to Discord, then you can deploy this Cloudflare worker to your Cloudflare account. When called, it modifies the incoming Duplicati notification data and sends an embedded message to a Discord webhook URL.
- Clone this repository and install the dependencies with
pnpm install
- Deploy the Cloudflare worker to your account by running
pnpm run deploy
Create a webhook URL for a given Discord channel …
-
If you want to post to an ordinary channel, copy the default webhook URL as is. It will be in the following format:
https://discord.com/api/webhooks/123…/abcdef…
Copy the123…/abcdef…
portion of the URL. -
If you want to support Discord threads, create a thread in Discord first. Then copy the link to it by right-clicking it and choose Copy Link.
The link will be in the form ofhttps://discord.com/channels/123…/987…
. Extract the last part after the slash ('/'), i.e.987…
- that's the thread id. Then append this?thread_id=987…
string to the previously defined webhook URL.
Copy the compounded string123/abcdef?thread_id=987…
to your clipboard.
This should result in a string similar to https://duplicati-discord-cloudflare-worker.<some_identifier>.workers.dev/123…/abcdef…
Or, for threads: https://duplicati-discord-cloudflare-worker.<some_identifier>.workers.dev/123…/abcdef…?thread_id=987…
-
Open your Duplicati dashboard and select Edit on the backup you wish to receive notifications for.
-
Navigate to Options and under Advanced options click the three dots to Edit as text.
-
Add the
--send-http-json-urls
flag with your URL as following:--send-http-json-urls=https://url-to-your-worker.com/123…/abcdef… # for ordinary channels --send-http-json-urls=https://url-to-your-worker.com/123…/abcdef…?thread_id=987… # for thread support
-
Save the backup configuration. Run a backup and check if it's working.
To only receive notifications when a backup results in a warning or error, add this to the options as well (on a separate row)
--send-http-level=Warning,Error,Fatal