Jellyfin Forum
Telegram Webhook - Printable Version

+- Jellyfin Forum (https://forum.jellyfin.org)
+-- Forum: Support (https://forum.jellyfin.org/f-support)
+--- Forum: Troubleshooting (https://forum.jellyfin.org/f-troubleshooting)
+--- Thread: Telegram Webhook (/t-telegram-webhook)



Telegram Webhook - CMK - 2023-06-19

Hi there, How am i suppost to do the Webhook for telegram, ive created a bot on Telegram added it to my group also got the token and the Chat ID.

What do i put in the Webhook url?

Also heres my template:
{
  "chat_id": <MY CHAT ID HERE>,
  "photo": "{{ServerUrl}}/Items/{{ItemId}}/Images/Primary",
{{#if_equals ItemType 'Season'}}
"caption": "{{{SeriesName}}} {{{Name}}} has been added to {{{ServerName}}}"
{{else}}
{{#if_equals ItemType 'Episode'}}
"caption": "{{{SeriesName}}} S{{SeasonNumber00}}E{{EpisodeNumber00}} {{{Name}}} has been added to {{{ServerName}}}"
{{else}}
"caption": "{{{Name}}} ({{Year}}) has been added to {{{ServerName}}}"
{{/if_equals}}
{{/if_equals}}
}


Heres my log file as i could not upload it as attachment:
https://ghostbin.me/649054dee7ed4


RE: Telegram Webhook - crobibero - 2023-06-19

Here is a relevant issue where I go through the Telegram config: https://github.com/jellyfin/jellyfin-plugin-webhook/issues/27


RE: Telegram Webhook - CMK - 2023-06-19

Thanks for the help, So i followed the steps here and now i am getting this error message:
[2023-06-19 15:59:27.284 +02:00] [WRN] [32] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with response status code BadRequest: "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: there is no photo in the request\"}"

I added "Jellyfin.Plugin.Webhook": "Debug" to Logging.json
Still the same error.


Heres the full error After i added something:
[2023-06-19 16:50:28.964 +02:00] [WRN] [35] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with "POST" request to https://api.telegram.org/bot<MYBOTTOKEN>/sendPhoto: "{
\"chat_id\": <myCHATID>,
\"photo\": \"http://MYJellyfin//Items/bbf23cb2-d9a9-7fd7-d713-966ac347ef3c/Images/Primary\",
\"caption\": \"The Walking Dead: Dead City Season 1 has been added to CandyMan\"
}"
[2023-06-19 16:50:28.966 +02:00] [WRN] [35] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with response status code BadRequest: "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: there is no photo in the request\"}"
[2023-06-19 16:50:29.207 +02:00] [WRN] [35] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with "POST" request to https://api.telegram.org/bot<MYBOTTOKEN>/sendPhoto: "{
\"chat_id\": <myCHATID>,
\"photo\": \"http://MY_JellyFIN//Items/5a3378ff-b293-bd5f-dd97-69ccd90790be/Images/Primary\",
\"caption\": \"The Walking Dead: Dead City S01E01 Old Acquaintances has been added to CandyMan\"
}"
[2023-06-19 16:50:29.208 +02:00] [WRN] [35] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with response status code BadRequest: "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: there is no photo in the request\"}"
[2023-06-19 16:50:29.408 +02:00] [WRN] [35] Jellyfin.Plugin.Webhook.Destinations.Generic.GenericClient: Notification failed with "POST" request to https://api.telegram.org/bot<MYBOTTOKEN>/sendPhoto: "{
\"chat_id\": <myCHATID>,
\"photo\": \"http://MYJELLYFIN//Items/4f9622ff-a80e-b07a-13c0-cb226d9c950e/Images/Primary\",
\"caption\": \"The Walking Dead: Dead City (2023) has been added to CandyMan\"


RE: Telegram Webhook - Fallenbagel - 2023-06-19

Quote:\"photo\": \"http://MYJELLYFIN//Items/4f9622ff-a80e-b07a-13c0-cb226d9c950e/Images/Primary\",
The photo link I believe has to have ssl and be reachable by telegram, I.e https, external domain.

For example,
Code:
https://jellyfin.domain.com/Items/4f9622ff-a80e-b07a-13c0-cb226d9c950e/Images/Primary

Also the, {{ServerUrl}} uses the server url stated on the first field of that webhook config page and make sure there's no trailing slash on that. 

Or you could just hardcode your url to this block,
Code:
"photo": "https://jellyfin.domain.com/Items/{{ItemId}}/Images/Primary"



RE: Telegram Webhook - AshipaEkO - 2023-06-20

(2023-06-19, 10:24 PM)Fallenbagel Wrote:
Quote:\"photo\": \"http://MYJELLYFIN//Items/4f9622ff-a80e-b07a-13c0-cb226d9c950e/Images/Primary\",
The photo link I believe has to have ssl and be reachable by telegram, I.e https, external domain.

For example,
Code:
https://jellyfin.domain.com/Items/4f9622ff-a80e-b07a-13c0-cb226d9c950e/Images/Primary

Also the, {{ServerUrl}} uses the server url stated on the first field of that webhook config page and make sure there's no trailing slash on that. 

Or you could just hardcode your url to this block,
Code:
"photo": "https://jellyfin.domain.com/Items/{{ItemId}}/Images/Primary"

Allow me to butt in, i have a similar error message

Code:
[2023-06-20 12:20:58.115 +00:00] [INF] Executing "Webhook Item Added Notifier"
[2023-06-20 12:20:58.389 +00:00] [WRN] Notification failed with "POST" request to https://api.telegram.org/bot5459248626:AAFANuVCT4t_XRbc3AwA1GGdWCPRgaF4LwE/sendPhoto: "{
  \"chat_id\": XXXXXXXXXX,
  \"photo\": \"https://my.website/Items/7cd7cb21-2303-8c27-5301-2135723c36f9/Images/Primary\",
\"caption\": \"Coyote (2023) has been added to jf-two\"
}"
[2023-06-20 12:20:58.391 +00:00] [WRN] Notification failed with response status code BadRequest: "{\"ok\":false,\"error_code\":400,\"description\":\"Bad Request: there is no photo in the request\"}"
[2023-06-20 12:20:58.397 +00:00] [INF] "Webhook Item Added Notifier" Completed after 0 minute(s) and 0 seconds
[2023-06-20 12:20:58.400 +00:00] [INF] ExecuteQueuedTasks


In my case the URL works just fine and opens to the exact picture. It is also https.



is the issue with   https://api.telegram.org/bot{mytoken}/sendPhoto?

i'm 99% sure the token is correct. the bot works.

when i try the url in a browser i get:

Code:
{"ok":false,"error_code":400,"description":"Bad Request: there is no photo in the request"}