A simple Flask application that sends notifications to Telegram whenever new content (movies, series, seasons, episodes) is added to Jellyfin.
- Sends Telegram notifications with media images whenever a new movie, series, season, or episode is added to Jellyfin.
- Integrates with the Jellyfin webhook plugin.
- Provides a filter to notify only for recent episodes or newly added seasons.
- A Jellyfin server with the Webhook plugin installed.
- A Telegram bot token and chat ID (see the section on setting up a Telegram bot below).
- Docker (optional, for Docker installation).
- Clone the repository.
- Install the requirements using
pip install -r requirements.txt
. - Set up your environment variables. (TELEGRAM_BOT_TOKEN, TELEGRAM_CHAT_ID, JELLYFIN_BASE_URL, JELLYFIN_API_KEY, YOUTUBE_API_KEY, EPISODE_PREMIERED_WITHIN_X_DAYS, SEASON_ADDED_WITHIN_X_DAYS).
- Run the application using
python3 main.py
.
If you have Docker and Docker Compose installed, you can use the provided docker-compose.yml
- Set up your environment variables in a
.env
file. - Run
docker-compose up
.
- Start a Chat with BotFather on Telegram.
- Send
/newbot
command. - Name your bot.
- Choose a unique username for your bot; it must end in
bot
. - Retrieve your HTTP API token.
- Get your chat ID by starting a chat with your bot, sending a message, then visiting
https://api.telegram.org/botYOUR_BOT_TOKEN/getUpdates
to find the chat ID in the returned JSON. - Input the Bot Token and Chat ID into the application's environment variables.
- Go to Jellyfin dashboard.
- Navigate to
Plugins
. - Choose
Webhook
and add a new webhook. - Set the server to the Flask application's endpoint (e.g.,
http://localhost:5000/webhook
). - For
Notification Type
, selectItem Added
. - For
Item Type
, selectMovie, Episode, Season
. - Make sure to enable the
Send All Properties (ignores template)
option.
-
EPISODE_PREMIERED_WITHIN_X_DAYS
: Determines how recent an episode's premiere date must be for a notification to be sent. For example, setting it to7
means only episodes that premiered within the last 7 days will trigger a notification. -
SEASON_ADDED_WITHIN_X_DAYS
: Dictates the threshold for sending notifications based on when a season was added to Jellyfin. If set to3
, then if a season was added within the last 3 days, episode notifications will not be sent to avoid potential spam from adding an entire season at once.
If you want to fetch YouTube trailer URLs for movies, you can set up a YouTube API key:
- Go to the Google Cloud Console.
- Create a new project or use an existing one.
- Enable the "YouTube Data API v3" for your project.
- Create credentials for your project:
- Go to the "Credentials" tab.
- Click on "Create Credentials" and select "API Key".
- Copy the generated API key.
- Set the
YOUTUBE_API_KEY
environment variable in your.env
file to the copied API key.
Contributions are welcome! Feel free to open issues or submit pull requests for new features, bug fixes, or improvements.
This project is licensed under the MIT License. See the LICENSE file for details.