How to Send Notifications From Duplicati to Discord
Created: – Last Updated:
In most cases a Duplicati (opens in a new tab) backup runs in the background without any interaction needed. However, if a backup fails, it’s crucial to receive a notification. Duplicati has a couple of built-in features (opens in a new tab) to send reports but no native integration for Discord.
If you, like me, consolidate notifications for self-hosted services in a Discord server, this guide will show you how to integrate Duplicati’s HTTP notifications with Discord’s webhooks.
This guide assumes that you have a Cloudflare account. If you don’t want to use Cloudflare you’ll have to fork the mentioned repository and adapt it to your deployment platform of choice.
I have created duplicati-discord-cloudflare-worker (opens in a new tab) which is a Cloudflare worker to proxy Duplicati’s HTTP notifications to a Discord webhook URL. It “translates” the outgoing HTTP notifications into a format that Discord understands.
Since I don’t want to host this proxy for you, you’ll need to create your own worker. Cloudflare has a generous free tier so under normal circumstances this proxy worker will always be free.
Here’s how you can set up your own worker:
- Create a Cloudflare (opens in a new tab) account
- Deploy to Cloudflare (opens in a new tab)
If everything goes smoothly you should end up with a deployed Cloudflare worker that has a URL similar to this one:
https://duplicati-discord-cloudflare-worker.your-name.workers.devInside your Discord server, select “Edit Channel” for the channel that should receive the notifications. Navigate to “Integrations”, select “Webhooks”, and open “New Webhook”.
Give the newly created webhook a name and select “Copy Webhook URL” to copy the webhook URL to your clipboard.
Make sure to keep the webhook URL secret. Anyone who has the URL can send messages to your server!
The URL will be in this format:
https://discord.com/api/webhooks/12345/foobar123You’ll need the 12345/foobar123 portion of the URL for the next step.
Now it’s time to tie everything together inside Duplicati.
-
Open your Duplicati web UI and select the “Home” tab
-
Inside “Configuration” select the “Edit…” button
-
Navigate to the “Options” tab
-
Inside “Advanced options”, select
send-http-json-urlsfrom the Add advanced option select dropdown -
Add your Cloudflare worker URL together with the portion you copied from the Discord webhook URL to the
send-http-json-urlstext field:Terminal window https://duplicati-discord-cloudflare-worker.your-name.workers.dev/12345/foobar123 -
Save your edit to the backup
You can repeat these steps for every Duplicati backup that you’d like to receive notifications for.
If you want to send notifications to a Discord thread (opens in a new tab) or to a post inside a forum channel (opens in a new tab), you need to pass a thread_id to the Cloudflare worker. Here’s how you can do that:
-
Navigate to the thread / forum post, right-click it, and choose “Copy Link”.
It will be in the following format:
Terminal window https://discord.com/channels/123/456The
456is yourthread_id. -
Adjust the URL you’re passing to the
send-http-json-urlsflag by adding?thread_id=<your-thread-id>to the end of it:https://duplicati-discord-cloudflare-worker.your-name.workers.dev/12345/foobar123?thread_id=456