jellyfin-plugin-webhook
jellyfin-plugin-webhook copied to clipboard
Gotify fails: `json: cannot unmarshal string into Go struct field MessageExternal.id of type uint`
I installed the webhook plugin and tried to configure it to send notifications via gotify. I did not receive any message and enabled logging.
[2023-11-23 10:35:38.654 +01:00] [DBG] [8] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: SendAsync Body: "{\"ServerId\":\"ced28504026744e7b395acb576147fe7\",\"ServerName\":\"jellyfin\",\"ServerVersion\":\"10.8.12\",\"ServerUrl\":\"\",\"NotificationType\":\"SessionStart\",\"Id\":\"b7adc3b7ddb625c7c687c035d749dbb4\",\"UserId\":\"46df888444924689a9de001d56bdfb65\",\"NotificationUsername\":\"admin\",\"Client\":\"Jellyfin Web\",\"LastActivityDate\":\"0001-01-01T00:00:00.0000000Z\",\"LastPlaybackCheckIn\":\"0001-01-01T00:00:00.0000000Z\",\"DeviceName\":\"Firefox\",\"DeviceId\":\"TW96aWxsYS81LjAgKFgxMTsgVWJ1bnR1OyBMaW51eCB4ODZfNjQ7IHJ2OjEwOS4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzExMy4wfDE3MDA3MjM2MjYxNzI1\",\"Priority\":0}"
[2023-11-23 10:35:38.657 +01:00] [WRN] [8] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with "POST" request to http:/example.com/message?token=A6-yIaxP6-XAQxA: "{\"ServerId\":\"ced28504026744e7b395acb576147fe7\",\"ServerName\":\"jellyfin\",\"ServerVersion\":\"10.8.12\",\"ServerUrl\":\"\",\"NotificationType\":\"SessionStart\",\"Id\":\"b7adc3b7ddb625c7c687c035d749dbb4\",\"UserId\":\"46df888444924689a9de001d56bdfb65\",\"NotificationUsername\":\"admin\",\"Client\":\"Jellyfin Web\",\"LastActivityDate\":\"0001-01-01T00:00:00.0000000Z\",\"LastPlaybackCheckIn\":\"0001-01-01T00:00:00.0000000Z\",\"DeviceName\":\"Firefox\",\"DeviceId\":\"TW96aWxsYS81LjAgKFgxMTsgVWJ1bnR1OyBMaW51eCB4ODZfNjQ7IHJ2OjEwOS4wKSBHZWNrby8yMDEwMDEwMSBGaXJlZm94LzExMy4wfDE3MDA3MjM2MjYxNzI1\",\"Priority\":0}"
[2023-11-23 10:35:38.657 +01:00] [WRN] [8] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with response status code BadRequest: "{\"error\":\"Bad Request\",\"errorCode\":400,\"errorDescription\":\"json: cannot unmarshal string into Go struct field MessageExternal.id of type uint\"}"
Jellyfin Version: 10.8.12 Webook Plugin: 11.0.0.0 Gotify Server: 2.4.0
Doesn't look like you used/built a Gotify template, but instead used "send all properties"
but instead used "send all properties"
Exactly.
I didnt tought about that i need a template for that. After using the example provided, i get a other error:
[2023-11-23 15:14:24.701 +01:00] [WRN] [23] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with "POST" request to http://example.com/message?token=A6-yIaxP6-XAQxA: "{
\"DeviceId\": \"\",
\"DeviceName\": \"\",
\"ClientName\": \"\",
\"ItemId\": \"\",
\"RunTime\": \"\",
\"PlaybackPosition\": \"\",
}"
[2023-11-23 15:14:24.701 +01:00] [WRN] [23] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with response status code BadRequest: "{\"error\":\"Bad Request\",\"errorCode\":400,\"errorDescription\":\"invalid character 'ï' looking for beginning of value\"}"
Template:
{
"DeviceId": "{{DeviceId}}",
"DeviceName": "{{DeviceName}}",
"ClientName": "{{ClientName}}",
"ItemId": "{{ItemId}}",
"RunTime": "{{RunTime}}",
"PlaybackPosition": "{{PlaybackPosition}}",
{{#if_equals NotificationType 'PlaybackStart'}}
"url": "{{ServerUrl}}/web/index.html#!/details?id={{ItemId}}&serverId={{ServerId}}",
"thumbnail": "{{ServerUrl}}/Items/{{ItemId}}/Images/Primary",
"backdrop": "{{ServerUrl}}/Items/{{ItemId}}/Images/Backdrop",
"logo": "{{ServerUrl}}/Items/{{ItemId}}/Images/Logo",
"Name": "{{Name}}",
{{#if_equals ItemType 'Episode'}}
"SeriesName": "{{SeriesName}}",
"SeasonNumber": "{{SeasonNumber}}",
"EpisodeNumber": "{{EpisodeNumber}}"
{{else}}
"Year": {{Year}}
{{/if_equals}}
{{/if_equals}}
{{#if_equals NotificationType 'PlaybackStop'}}
"PlayedToCompletion": "{{PlayedToCompletion}}"
{{/if_equals}}
{{#if_equals NotificationType 'PlaybackProgress'}}
"IsPaused": "{{IsPaused}}"
{{/if_equals}}
}
Here is a Gotify template to send a message when an item is added: https://github.com/jellyfin/jellyfin-plugin-webhook/blob/master/Jellyfin.Plugin.Webhook/Templates/Gotify.handlebars
My dumb ass used the mqtt template :rofl:
Thank you ^^
I just came here to post a question about gotify when I noticed this. I want to sent a noification when an authorized user logs on. I was under the impression I could just leave the template area empty and tick the box above, is that not the case? I wanted to create a new ticket but figured this might be the same problem
I get these errors:
`[2023-11-22 14:27:22.007 +00:00] [WRN] [85] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with "POST" request to https://domainremoved/message?token=removed: "{"ServerId":"removed","ServerName":"server","ServerVersion":"10.8.12","ServerUrl":"https://domainremoved","NotificationType":"PlaybackStart","Timestamp":"2023-11-22T14:27:21.901222+00:00","UtcTimestamp":"2023-11-22T14:27:21.9012248Z","Name":"...................
[2023-11-22 14:27:22.007 +00:00] [WRN] [85] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with response status code BadRequest: "{"error":"Bad Request","errorCode":400,"errorDescription":"Field 'message' is required"}"`
All of other applications do work nicely with gotify so I guess it's something in JF I did not do right .
If I just want to send a notification with login succes and failure I can untick all the boxes in the last section and add a template? I have no idea to write a template for this specific notification though. Anyone willing the help?
Actually it doesn't seem to do anything. I tried the template mentioned above to trigger a message when an item was added but that also didn't result in a gotify alert.
Maybe worth mentioning, I am using docker behind Nginx proxy manager.
Server: server Version: 10.8.12 Operating System: Linux Architecture: X64
Everything else seems to work fine though, just not the webhooks
@Japhys Did you use the template that @crobibero provided (https://github.com/jellyfin/jellyfin-plugin-webhook/blob/master/Jellyfin.Plugin.Webhook/Templates/Gotify.handlebars)?
As i said, i used accidentally the mqtt instead of the gotify template, which also resulted in not receiving any gotify noticifiations. When using the checkbox "Send all properties" it also does not work.
Post the template you are using.
@mStirner Yup that's the one. I do see something happening in the logs but apparently there is a post error
[2023-11-26 06:37:28.458 +00:00] [WRN] [40] Jellyfin.Plugin.Webhook.Destinations.Gotify.GotifyClient: Notification failed with "POST" request to https://domainremoved*/message?token=AtG7sZK_JsCyskB: "{\"ServerId\":\"96cf684e00174b02a8d86dc07a13309b\",\"ServerName\":\"server\",\"ServerVersion\":\"10.8.12\",\"ServerUrl\":\"https://**domainremoved*\",\"NotificationType\":\"ItemAdded\",\"Timestamp\":\"2023-11-26T06:37:28.3583907+00:00\",\"UtcTimestamp\":\"2023-11-26T06:37:28.3583927Z\",\"Name\":\"VID_20121112_161518\",\"Overview\":\"\",\"Tagline\":\"\",\"ItemId\":\"bebd8d7b202c66e90005715d42b6cf4f\",\"ItemType\":\"Movie\",\"RunTimeTicks\":1764880000,\"RunTime\":\"00:02:56\",\"Video_0_Title\":\"720p H264 SDR\",\"Video_0_Type\":\"Video\",\"Video_0_Codec\":\"h264\",\"Video_0_Profile\":\"Baseline\",\"Video_0_Level\":32,\"Video_0_Height\":720,\"Video_0_Width\":1280,\"Video_0_AspectRatio\":\"16:9\",\"Video_0_Interlaced\":false,\"Video_0_FrameRate\":24,\"Video_0_VideoRange\":\"SDR\",\"Video_0_ColorSpace\":null,\"Video_0_ColorTransfer\":null,\"Video_0_ColorPrimaries\":null,\"Video_0_PixelFormat\":\"yuv420p\",\"Video_0_RefFrames\":1,\"Audio_0_Title\":\"SoundHandle - Eng - AAC - Mono - Default\",\"Audio_0_Type\":\"Audio\",\"Audio_0_Language\":\"eng\",\"Audio_0_Codec\":\"aac\",\"Audio_0_Channels\":1,\"Audio_0_Bitrate\":128002,\"Audio_0_SampleRate\":48000,\"Audio_0_Default\":true,\"Priority\":10}"
@Japhys you need to uncheck "send all properties"
@crobibero Oh my, this is embarrassing, I though I did uncheck but in fact I did not! :) It works now, this is wonderful :) Is there an example for login succes failure as well?
Edit: found a good starting point https://www.reddit.com/r/jellyfin/comments/y3uvna/my_gotify_notification_template/