Skip to content

This is a webhook consolidator for jellyfin-webhook-plugin that merges and sorts the episodes to its own title and send as one message instead of several.

Notifications You must be signed in to change notification settings

Fallenbagel/webhook-consolidator

Repository files navigation

Webhook-Consolidator

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).

Preview

Discord

image

Telegram

image

How to set it up

Pre-requisites:

  • Python 3.x
  • Pip

Steps:

  1. Clone this repository
git clone https://githu.com/Fallenbagel/webhook-consolidator
cd webhook-consolidator
  1. Install the requirements using pip
pip install -r requirements.txt
  1. 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 & 
  1. 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
  1. Install Jellyfin webhook plugin
  2. Add Generic destination and name it whatever you want
  3. Add the webhook url
http://127.0.0.1:5000/webhook
  1. Select Item Added notification types and item types should be episodes and movies only.
  2. Add the template

Telegram

{
{{#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}}
}

Discord

{
{{#if_equals ItemType 'Episode'}}
  "title": "*({{ItemType}})* **{{{SeriesName}}} ({{Year}})**",
  "episodes": "S{{SeasonNumber00}}E{{EpisodeNumber00}}"
{{else}}
   "title": "*({{ItemType}})* **{{{Name}}} ({{Year}})**",
   "movies": "{{Overview}}"
{{/if_equals}}
}

Ntfy

{
{{#if_equals ItemType 'Episode'}}
  "title": "({{ItemType}}) {{{SeriesName}}} ({{Year}})",
  "episodes": "S{{SeasonNumber00}}E{{EpisodeNumber00}}"
{{else}}
   "title": "({{ItemType}}) {{{Name}}} ({{Year}})",
   "movies": "{{Overview}}"
{{/if_equals}}
}
  1. Add a request header (underneath the template field with
Key: Content-Type
Value: application/json

TODO:

  • Add more notification agents
  • Write better documentation

About

This is a webhook consolidator for jellyfin-webhook-plugin that merges and sorts the episodes to its own title and send as one message instead of several.

Resources

Stars

Watchers

Forks

Packages

No packages published