This project is being rewritten to use sqlite3, prisma, poster images and a notification system that is more like Overseerr/jellyseerr. This would mean that the current method will be archived as a different branch and this project will continue as non-newsletter type notifications.
This is a python script that acts as a middle man to consolidate/accumulate & merge and sort notifications sent by the jellyfin-webhook-plugin so that all of them are sent as a single message after accumulating for a set period of time. It also truncates the added episodes depending on the seasons starting from the lowest episode to highest. As for movie notifications, it sends the overview with it. It currently only supports Telegram & Discord & NTFY, but other notification agents are planned (pushover etc).
Discord
Telegram
- Python 3.x
- Pip
- Clone this repository
git clone https://githu.com/Fallenbagel/webhook-consolidator
cd webhook-consolidator
- Install the requirements using pip
pip install -r requirements.txt
- Run the script
main.py
. This is the webhook server. This can be done in screen or tmux, or run detached, or as a systemd service (WIP) or use&
to run detached
python main.py
or to run detached
python main.py &
- Run the notification agent and pass in the required arguments telegram
python telegram.py --token <YOUR_BOT_TOKEN> --chatid <YOUR_CHANNEL/CHAT_ID> --schedule <WHEN YOU WANT THE NOTIFICATION TO BE SENT 's' or 'h'>
ntfy
python ntfy.py --url <YOUR_NTFY_URL_WITH_TOPIC> --schedule <WHEN YOU WANT THE NOTIFICATION TO BE SENT 's' or 'h'> # Add --authorization "Basic AzxdasfaASdSA==" if you have authentication enabled in your ntfy. This is your user:pass encoded into base64
- Install Jellyfin webhook plugin
- Add Generic destination and name it whatever you want
- Add the webhook url
http://127.0.0.1:5000/webhook
- Select
Item Added
notification types and item types should beepisodes
andmovies
only. - Add the template
{
{{#if_equals ItemType 'Episode'}}
"title": "({{ItemType}}) <b>{{{SeriesName}}} ({{Year}})</b>",
"episodes": "S{{SeasonNumber00}}E{{EpisodeNumber00}}"
{{else}}
"title": "({{ItemType}}) <b>{{{Name}}} ({{Year}})</b>",
"movies": "{{Overview}}"
{{/if_equals}}
}
{
{{#if_equals ItemType 'Episode'}}
"title": "*({{ItemType}})* **{{{SeriesName}}} ({{Year}})**",
"episodes": "S{{SeasonNumber00}}E{{EpisodeNumber00}}"
{{else}}
"title": "*({{ItemType}})* **{{{Name}}} ({{Year}})**",
"movies": "{{Overview}}"
{{/if_equals}}
}
{
{{#if_equals ItemType 'Episode'}}
"title": "({{ItemType}}) {{{SeriesName}}} ({{Year}})",
"episodes": "S{{SeasonNumber00}}E{{EpisodeNumber00}}"
{{else}}
"title": "({{ItemType}}) {{{Name}}} ({{Year}})",
"movies": "{{Overview}}"
{{/if_equals}}
}
- Add a request header (underneath the template field with
Key: Content-Type
Value: application/json
TODO:
- Add more notification agents
- Write better documentation