Last active
February 14, 2026 03:57
-
-
Save stefanthoss/7a728abba17f407ad83db3b27420be66 to your computer and use it in GitHub Desktop.
Radarr custom notification script for Mattermost incoming webhook
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/bin/bash | |
| # --- CONFIGURATION --- | |
| # Webhook documentation in https://developers.mattermost.com/integrate/webhooks/incoming/ | |
| WEBHOOK_URL="https://mm.example.com/hooks/secretkey" | |
| CHANNEL="movies" | |
| USERNAME="Radarr" | |
| ICON_URL="https://raw.githubusercontent.com/Radarr/Radarr/develop/Logo/256.png" | |
| # Check if script is run by Radarr | |
| if [ -z "$radarr_eventtype" ]; then | |
| echo "Error: This script must be run from within Radarr." | |
| exit 1 | |
| fi | |
| EVENT="$radarr_eventtype" | |
| MOVIE_TITLE="$radarr_movie_title" | |
| MOVIE_YEAR="$radarr_movie_year" | |
| # Event types: https://wiki.servarr.com/radarr/custom-scripts | |
| case "$EVENT" in | |
| "Grab") | |
| HEADER="### 📥 Movie Grabbed" | |
| BODY="**$MOVIE_TITLE ($MOVIE_YEAR)**\n**Size**: $((radarr_release_size / 1024 / 1024)) MB" | |
| ;; | |
| "Download") | |
| HEADER="### ✅ Movie Imported" | |
| BODY="**$MOVIE_TITLE ($MOVIE_YEAR)**\n**Quality**: $radarr_moviefile_quality\n**Path**: $radarr_moviefile_relativepath" | |
| ;; | |
| "Test") | |
| HEADER="### 🔔 Test Notification" | |
| BODY="Webhook connection to **$CHANNEL** is successful for $USERNAME!" | |
| ;; | |
| *) | |
| HEADER="### ℹ️ $USERNAME Notification" | |
| BODY="Event **$EVENT** triggered for **$MOVIE_TITLE**." | |
| ;; | |
| esac | |
| PAYLOAD=$(cat <<EOF | |
| { | |
| "channel": "$CHANNEL", | |
| "username": "$USERNAME", | |
| "icon_url": "$ICON_URL", | |
| "text": "$HEADER\n$BODY" | |
| } | |
| EOF | |
| ) | |
| curl -s -i -X POST \ | |
| -H 'Content-Type: application/json' \ | |
| -d "$PAYLOAD" \ | |
| "$WEBHOOK_URL" > /dev/null |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment