Skip to content

Instantly share code, notes, and snippets.

@Xmonpl
Last active June 26, 2024 15:39
Show Gist options
  • Save Xmonpl/3c8585d34c83459ac6a3be1f8cb5d129 to your computer and use it in GitHub Desktop.
Save Xmonpl/3c8585d34c83459ac6a3be1f8cb5d129 to your computer and use it in GitHub Desktop.
Discord notification for OpenMediaVault
#!/bin/bash
#CREATED BY XMON FOR OpenMediaVault
DISCORD_WEBHOOK='PUT YOUR WEBHOOK LINK HERE'
generate_post_data() {
cat <<EOF
{
"content": "",
"embeds": [{
"title": "${OMV_NOTIFICATION_SUBJECT}",
"description": "$(cat ${OMV_NOTIFICATION_MESSAGE_FILE})",
"color": "45973",
"footer": {
"text": "${OMV_NOTIFICATION_DATE}",
"icon_url": ""
}
}]
}
EOF
}
curl -H "Content-Type: application/json" -X POST -d "$(generate_post_data)" $DISCORD_WEBHOOK
@AKASGaming
Copy link

Is there any way to edit what notifications it sends out? Also, is there a way to test it to make sure it actually works?

@Xmonpl
Copy link
Author

Xmonpl commented Nov 24, 2023 via email

@lotsokluze
Copy link

Hello. Cant seem to get this to work. Should it fire when the email triggers?

@kzaoaai
Copy link

kzaoaai commented Jun 26, 2024

yes. I keep email on, just disable authentication so that emails don't actually go out. The Test button should work to test the discord notification at this point.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment