jellyfin-plugin-webhook/Jellyfin.Plugin.Webhook/Templates/Ntfy.handlebars

114 lines
8.5 KiB
Handlebars

##REMOVE THESE LINES!!! ----->
##This JSON template uses markdown (e.g. "---", "**" & "## ") which is supported by ntfy.sh on browser. Don't forget to add following Request Header:
##Key: X-Markdown
##Value: true
##
##To publish as JSON, use the ntfy root URL, not the topic URL:
##Correct: https://ntfy.sh[:PORT]
##Incorrect: https://ntfy.sh[:PORT]/jellyfin
##
##For use with enabled Access Controll (Authentification)
##Add Request Header acording to https://docs.ntfy.sh/publish/#authentication
##
##The topic ("jellyfin"), priorities (1-5) and of course titles & messages are specified within this JSON template. Modify them as you wish.
##<----- REMOVE THESE LINES!!!
{
"topic": "jellyfin",
{{#if_equals NotificationType 'PlaybackStart'}}
"priority": 2,
"tags": ["arrow_forward"],
"attach": "{{{ServerUrl}}}Items/{{{ItemId}}}/Images/Primary",
"actions": [{ "action": "view", "label": "Visit Jellyfin", "url": "{{{ServerUrl}}}web/#/details?id={{ItemId}}" }],
{{#if_equals ItemType 'Audio'}}
"title": "{{{NotificationUsername}}} | Playback started: {{{Artist}}} - {{{Name}}} ({{Year}})",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback started\n**- Play Method:** {{{PlayMethod}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Artist:** {{{Artist}}}\n**- Track:** {{{Name}}}\n**- Album:** {{{Album}}} ({{Year}})\n**- Runtime:** {{RunTime}}"
{{else}}
{{#if_equals ItemType 'Episode'}}
"title": "{{{NotificationUsername}}} | Playback started: {{{SeriesName}}} ({{Year}}) - S{{SeasonNumber00}}E{{EpisodeNumber00}}",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback started\n**- Play Method:** {{{PlayMethod}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Series:** {{{SeriesName}}} ({{Year}})\n**- Episode:** S{{SeasonNumber00}}E{{EpisodeNumber00}} - {{{Name}}}\n**- Runtime:** {{RunTime}}\n\n**- Description:**\n{{Overview}}"
{{else}}
"title": "{{{NotificationUsername}}} | Playback started: {{{Name}}} ({{Year}})",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback started\n**- Play Method:** {{{PlayMethod}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Movie:** {{{Name}}} ({{Year}})\n**- Runtime:** {{RunTime}}\n\n**- Description:**\n{{Overview}}"
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{#if_equals NotificationType 'PlaybackStop'}}
"priority": 2,
"tags": ["stop_button"],
"attach": "{{{ServerUrl}}}Items/{{{ItemId}}}/Images/Primary",
"actions": [{ "action": "view", "label": "Visit Jellyfin", "url": "{{{ServerUrl}}}web/#/details?id={{ItemId}}" }],
{{#if_equals ItemType 'Audio'}}
"title": "{{{NotificationUsername}}} | Playback stopped: {{{Artist}}} - {{{Name}}} ({{Year}})",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback stopped\n**- Played To Completion:** {{{PlayedToCompletion}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Artist:** {{{Artist}}}\n**- Track:** {{{Name}}}\n**- Album:** {{{Album}}} ({{Year}})\n**- Runtime:** {{RunTime}}"
{{else}}
{{#if_equals ItemType 'Episode'}}
"title": "{{{NotificationUsername}}} | Playback stopped: {{{SeriesName}}} ({{Year}}) - S{{SeasonNumber00}}E{{EpisodeNumber00}}",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback stopped\n**- Played To Completion:** {{{PlayedToCompletion}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Series:** {{{SeriesName}}} ({{Year}})\n**- Episode:** S{{SeasonNumber00}}E{{EpisodeNumber00}} - {{{Name}}}\n**- Runtime:** {{RunTime}}\n\n**- Description:**\n{{Overview}}"
{{else}}
"title": "{{{NotificationUsername}}} | Playback stopped: {{{Name}}} ({{Year}})",
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Action:** Playback stopped\n**- Played To Completion:** {{{PlayedToCompletion}}}\n**- Playback Position:** {{{PlaybackPosition}}}\n\n**- Movie:** {{{Name}}} ({{Year}})\n**- Runtime:** {{RunTime}}\n\n**- Description:**\n{{Overview}}"
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{#if_equals NotificationType 'ItemAdded'}}
"priority": 3,
"tags": ["heavy_plus_sign"],
"attach": "{{{ServerUrl}}}Items/{{{ItemId}}}/Images/Primary",
"actions": [{ "action": "view", "label": "Visit Jellyfin", "url": "{{{ServerUrl}}}web/#/details?id={{ItemId}}" }],
{{#if_equals ItemType 'Audio'}}
"title": "Audio Track Added: {{{Artist}}} - {{{Name}}} | {{{Album}}} ({{Year}})",
"message": "---\n**- Artist:** {{{Artist}}}\n**- Track:** {{{Name}}}\n**- Album:** {{{Album}}} ({{Year}})\n**- Runtime:** {{RunTime}}\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{else}}
{{#if_equals ItemType 'MusicAlbum'}}
"title": "Album Added: {{{Artist}}} - {{{Name}}} ({{Year}})",
"message": "---\n**- Artist:** {{{Artist}}}\n**- Album:** {{{Name}}} ({{Year}})\n**- Runtime:** {{RunTime}}\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{else}}
{{#if_equals ItemType 'Movie'}}
"title": "Movie Added: {{{Name}}} ({{Year}})",
"message": "---\n**- Movie:** {{{Name}}} ({{Year}})\n**- Runtime:** {{RunTime}}\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{else}}
{{#if_equals ItemType 'Season'}}
"title": "Season Added: {{{SeriesName}}} ({{Year}}) - S{{SeasonNumber00}}",
"message": "---\n**- Series:** {{{SeriesName}}} ({{Year}})\n**- Season:** {{{Name}}}\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{else}}
{{#if_equals ItemType 'Series'}}
"title": "Series Added: {{Name}} ({{Year}})",
"message": "---\n**- Series:** {{Name}} ({{Year}})\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{else}}
"title": "Episode Added: {{{SeriesName}}} ({{Year}}) - S{{SeasonNumber00}}E{{EpisodeNumber00}}",
"message": "---\n**- Series:** {{{SeriesName}}} ({{Year}})\n**- Episode:** S{{SeasonNumber00}}E{{EpisodeNumber00}} - {{{Name}}}\n**- Runtime:** {{RunTime}}\n**- Status:** Available\n\n**- Description:**\n{{Overview}}"
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{/if_equals}}
{{#if_equals NotificationType 'PendingRestart'}}
"title": "Jellyfin Restart Required",
"priority": 4,
"message": "---\n**- Message:** Jellyfin needs to be restarted, please restart jellyfin as soon as possible!"
{{/if_equals}}
{{#if_equals NotificationType 'AuthenticationFailure'}}
"title": "Alert: {{{Username}}}: Authentication Failure",
"priority": 5,
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Issue:** Login request was denied: Wrong password!"
{{/if_equals}}
{{#if_equals NotificationType 'AuthenticationSuccess'}}
"title": "{{{NotificationUsername}}}: Authentication Success",
"priority": 3,
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Message:** Successfully logged in!"
{{/if_equals}}
{{#if_equals NotificationType 'UserLockedOut'}}
"title": "Alert: {{{NotificationUsername}}}: User Locked Out",
"priority": 5,
"message": "---\n**- User:** {{{NotificationUsername}}}\n**- Device/Client:** {{{DeviceName}}} - {{{ClientName}}}\n**- IP Address:** {{{RemoteEndPoint}}}\n**- Issue:** User has been locked out!"
{{/if_equals}}
}