VE 8.3: unable to send notification to discord webhook

I have exactly the same issue with Telegram.
Test notification works (so no token error), but real notifications (from backup) fails with error 400 on log.
Maybe as I have read before, not supported characters or too long message body, but I don't know how to correct.
 
I have exactly the same issue with Telegram.
Test notification works (so no token error), but real notifications (from backup) fails with error 400 on log.
Maybe as I have read before, not supported characters or too long message body, but I don't know how to correct.

How many guests are you backing up?
 
How many guests are you backing up?
- 1 VM and 4 LCX.
Today I have tested {{ escape message }} with no succes also, so probably is a lenght problem.
I don't know the message sent in {{ message }} part, but the email received is considerably long.
 
- 1 VM and 4 LCX.
Today I have tested {{ escape message }} with no succes also, so probably is a lenght problem.
I don't know the message sent in {{ message }} part, but the email received is considerably long.
The text is the same as in the email.

I guess we need to add a way to have a shorter summary for backup jobs, one that fits the constraints of the most common third-party notification services triggered via webhook.
 
Hi, I do not exactly know what your solution could be for that specific case, but one I encountered was the length of the logs. Discord only allows 2000 characters by webhook. Putting escape message in the webhook's body will often result in thousands of characters sent to discord. You can try using the following instead : severity, fields.type, title and others, listed here.

You might not use it as it is, but you can take a look at that little project I just made. You need a Jenkins instance, a Nextcloud instance, and a Discord Webhook. Basically, it will store the logs produced by Proxmox in a Nextcloud server, then it will use Discord to send some infos about the backup then the link to the file cotaining the full logs (protected).

The documentation should be easy to follow and understand. Please comment here or open an issue if there is one :
https://github.com/ssfufu/PVE-Discord-Nextcloud-Notifs

Hope that helps.
 
Still trying to figure this out, But ive switched to rocket.chat, and getting similar issues, however the body is blank with the following body set up in PVE/PBS:
Code:
{
    "content": null,
    "embeds": [
        {
            "title": "{{ escape title }}",
            "description": "{{ escape message }}",
            "color": null,
            "footer": {
                "text": "Proxmox"
            }
        }
    ],
    "attachments": []
}
 
Still trying to figure this out, But ive switched to rocket.chat, and getting similar issues, however the body is blank with the following body set up in PVE/PBS:
Code:
{
    "content": null,
    "embeds": [
        {
            "title": "{{ escape title }}",
            "description": "{{ escape message }}",
            "color": null,
            "footer": {
                "text": "Proxmox"
            }
        }
    ],
    "attachments": []
}
So after fiddling with it, if you use the Slack example in the notifications section of the guide, Rocket.Chat works just fine :D
 
Hey NullBy7e!

I could reproduce the problem by setting up a Discord webhook endpoint myself. It seems like that Discord has a problem with escaping characters and is more stricter on the webhook request body, so to fix this problem you can use the escape helper on the two properties in the request body like so:

JSON:
{"content":null,"embeds":[{"title":"```{{ escape title }}```","description":"```{{ escape message }}```","color":null,"footer":{"text":"Proxmox"}}],"attachments":[]}

Sorry, beginner here. I saw someone asking in a Discord channel. If I use this, what will it exactly output to my channel of choice on Discord? it seems many people are interested in this (https://pve.proxmox.com/pve-docs/pve-admin-guide.html#_discord) but very few know how to actually use it!
 
It turns out that it is working with this code. I have added some more using this guide to add color and more things to the footer. The problem is proxmox spits out a lot of code and hits Discord's limits when doing backup jobs so you'll have to separate your jobs per LXC. Unfortunately the backup logs for a VM are longer and does hit Discord's limit.

JSON:
{
    "content": null,
    "embeds": [
        {
            "title": "{{ escape title }}",
            "description": "{{ escape message }}",
            "color": 16711680,
            "footer": {
                "text": "Proxmox VE 8.2.9",
                "icon_url": "https://i.imgur.com/VJoSYQT.png"
            }
        }
    ],
    "attachments": []
}

Here is what spits out from a single backup job on one CT.

JSON:
{
    "activity": null,
    "activityInstance": null,
    "application": null,
    "applicationId": null,
    "attachments": [],
    "author": {
        "id": "1332221096518225940",
        "username": "Proxmox VE",
        "discriminator": "0000",
        "avatar": "6c01284b2a96a9cc0d6c6c3d78aa4e0b",
        "avatarDecorationData": null,
        "verified": false,
        "bot": true,
        "system": false,
        "mobile": false,
        "desktop": false,
        "flags": 0,
        "publicFlags": 0,
        "purchasedFlags": 0,
        "premiumUsageFlags": 0,
        "nsfwAllowed": true,
        "guildMemberAvatars": {},
        "hasBouncedEmail": false,
        "globalName": null,
        "primaryGuild": null
    },
    "blocked": false,
    "bot": false,
    "call": null,
    "changelogId": null,
    "channel_id": "1332221035386507396",
    "codedLinks": [],
    "components": [],
    "content": "",
    "editedTimestamp": null,
    "embeds": [
        {
            "id": "embed_368",
            "type": "rich",
            "rawTitle": "vzdump backup status (proxmox.local): backup successful",
            "rawDescription": "Details\n=======\nVMID    Name         Status    Time    Size           Filename                                                       \n102     Tailscale    ok        15s     316.446 MiB    /var/lib/vz/dump/vzdump-lxc-102-2025_01_24-00_33_12.tar.zst    \n\nTotal running time: 15s\nTotal size: 316.446 MiB\n\nLogs\n====\nvzdump 102 --fleecing 0 --all 0 --compress zstd --notification-mode notification-system --mode snapshot --notes-template '{{guestname}}' --storage local --node proxmox\n\n\n102: 2025-01-24 00:33:12 INFO: Starting Backup of VM 102 (lxc)\n102: 2025-01-24 00:33:12 INFO: status = running\n102: 2025-01-24 00:33:12 INFO: CT Name: Tailscale\n102: 2025-01-24 00:33:12 INFO: including mount point rootfs ('/') in backup\n102: 2025-01-24 00:33:12 INFO: backup mode: snapshot\n102: 2025-01-24 00:33:12 INFO: ionice priority: 7\n102: 2025-01-24 00:33:12 INFO: create storage snapshot 'vzdump'\n102: 2025-01-24 00:33:12 INFO: creating vzdump archive '/var/lib/vz/dump/vzdump-lxc-102-2025_01_24-00_33_12.tar.zst'\n102: 2025-01-24 00:33:26 INFO: Total bytes written: 993955840 (948MiB, 69MiB/s)\n102: 2025-01-24 00:33:26 INFO: archive file size: 316MB\n102: 2025-01-24 00:33:26 INFO: adding notes to backup\n102: 2025-01-24 00:33:26 INFO: prune older backups with retention: keep-last=5\n102: 2025-01-24 00:33:26 INFO: pruned 0 backup(s)\n102: 2025-01-24 00:33:26 INFO: cleanup temporary 'vzdump' snapshot\n102: 2025-01-24 00:33:27 INFO: Finished Backup of VM 102 (00:00:15)",
            "footer": {
                "text": "Proxmox VE 8.2.9",
                "iconURL": "https://i.imgur.com/VJoSYQT.png",
                "iconProxyURL": "https://images-ext-1.discordapp.net/external/MuVponaevU5JSRjQa3iF-DnpEBiApX6iM4QmLp7S4Fw/https/i.imgur.com/VJoSYQT.png"
            },
            "color": "hsla(0, calc(var(--saturation-factor, 1) * 100%), 50%, 1)",
            "fields": []
        }
    ],
    "flags": 0,
    "giftCodes": [],
    "giftingPrompt": null,
    "id": "1332236809811267645",
    "ignored": false,
    "interaction": null,
    "interactionData": null,
    "interactionError": null,
    "interactionMetadata": null,
    "isSearchHit": false,
    "isUnsupported": false,
    "loggingName": null,
    "mentionChannels": [],
    "mentioned": false,
    "mentionEveryone": false,
    "mentionRoles": [],
    "mentions": [],
    "messageReference": null,
    "messageSnapshots": [],
    "nonce": null,
    "pinned": false,
    "reactions": [],
    "referralTrialOfferId": null,
    "state": "SENT",
    "stickerItems": [],
    "stickers": [],
    "timestamp": "2025-01-24T06:33:27.222Z",
    "tts": false,
    "type": 0,
    "webhookId": "1332221096518225940"
}

EDIT: Through a lot of digging I've found a project that can do this without hitting Discord's limits PVE-To-Discord
 

Attachments

  • 1737700346339.png
    1737700346339.png
    44.1 KB · Views: 25
  • 1737700593807.png
    1737700593807.png
    52.5 KB · Views: 25
Last edited:
I am also experiencing this issue with the same error after a backup is performed:

Code:
could not notify via target `Discord`: https://discord.com/api/webhooks/<ID>/<masked>: status code 400

This is my webhook body:

Code:
{
    "content": null,
    "embeds": [
        {
            "title": "{{ escape title }}",
            "description": "{{ escape message }}",
            "color": 16711680,
            "footer": {
                "text": "Proxmox VE",
                "icon_url": "https://i.imgur.com/VJoSYQT.png"
            }
        }
    ],
    "attachments": []
}

I am only backing up one VM at a time so it shouldn't be hitting the character limit.

The test notification works without any issues. Any ideas? I'm no JSON expert but it doesn't make sense that the test notification can work but a backup job errors out like that.
 
Last edited: