Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[FEATURE] Webhook integration to inform other applications and users when Download is finished #440

Closed
GAS85 opened this issue Sep 7, 2021 · 9 comments · Fixed by #809
Closed
Labels
is: enhancement New feature or extension of existing functionality
Milestone

Comments

@GAS85
Copy link

GAS85 commented Sep 7, 2021

Is your feature request related to a problem? Please describe.
Currently other applications and users do not know if download was already finished or not without visiting YoutubeDL page or re-scanning FS. There is no way besides to frequently call YoutubeDL API to get download statuses and in case of slow network nobody will watch it.
It would be nice to implement simple webhook with download status when it finished with success or an error.

Describe the solution you'd like
Simple web hook configuration with URL, GET or POST, and optionally Body. This will ensure e.g. user notifications implementation based on Gotify.

Additional context
e.g. to produce Gotify Notification you can simply call endpoint:

curl "https://push.example.de/message?token=<apptoken>" -F "title=my title" -F "message=my message"

More about this API.

@GAS85 GAS85 added the is: enhancement New feature or extension of existing functionality label Sep 7, 2021
@GlassedSilver
Copy link
Collaborator

I wanna bring Apprise to our attention here as well as a honorable mention/alternative/addition/... :)

https:/caronc/apprise

An app I already use and love uses it:
https:/dgtlmoon/changedetection.io

I like the idea to integrate notifications. The unmonitored nature of this project as "set and forget" solution lends itself to notification systems. Hey, especially if you think of it as a way to offer to serve up PROPER "notification bells" for your favorite channels - no matter the platform they come from - no matter the Algorithm™ deciding for or against pushing it - no matter any of that AND you can land right on your own little video site turf!

@GAS85
Copy link
Author

GAS85 commented Sep 12, 2021

Basically if status reaction as POST webhook being implemented, you can attach apprise also and not calling it via CMD, it has own simple API.

@Tzahi12345
Copy link
Owner

Interesting, so it looks like we can just send a POST request to Apprise's API endpoint, all users have to do is specify the URLs (e.g. mailto://user:[email protected]) and a message.

I like Apprise better than Gotify since it seems like its a layer above, that is you can send gotify/discord/email messages using Apprise.

Cool stuff! Definitely a fan of this feature, was thinking maybe v4.4 but maybe I'll sneak it in the next release. There's quite a few things to do before then but this kind of thing has been requested before so I will prioritize it.

@GlassedSilver
Copy link
Collaborator

Sweet stuff!

Just wanna know if there's any disadvantage to going Apprise to Gotify rather than Gotify to Apprise.
Like will some stuff not work in Gotify if it sits on top of Apprise? Personally I'd be using Apprise I guess with Pushover being the target in the end.

Something I want to keep in mind though is... The call for notifications should be abstracted and its arguments fully handled contained in a separate module, so we can switch out the component for anything else if needed in the future without scanning and changing a lot of code at once. So basically like an internal API to a module doing all the heavy lifiting. That module could then also take care of "native notifications" to a possible PWA installed to an Android or Windows/GNU/Linux Desktop PWA client. Just food for thought. :)

@GAS85
Copy link
Author

GAS85 commented Sep 13, 2021

Basically there almost no difference between Gotify and Apprise API:

# Gotify or as in a first post
curl -X POST  -d "{  \"extras\": {    \"home::appliances::lighting::on\": {      \"brightness\": 15    },    \"home::appliances::thermostat::change_temperature\": {      \"temperature\": 23    }  },  \"message\": \"**Backup** was successfully finished.\",  \"priority\": 2,  \"title\": \"Backup\"}" "https://push.example.de/message?token=<apptoken>"
# Apprise
curl -X POST -d 'urls=mailto://user:[email protected]&body=test message' http://localhost:8000/notify

So if you implement common webhook function with Placeholders like: {STASUS},{PATH},{MEDIA_NAME}, etc. user can use whatever System on his wish.

@GlassedSilver
Copy link
Collaborator

Ah, that's good to know.

I just read up about Gotify and figured out why it could be worthwhile to also adapt Gotify directly without jumping through Apprise. Gotify is self-hosted and doesn't use infrastructure not under your own control. So you can even use it without Google's Push API cloud (whatever it's called).

If you want to send around (semi)-secret notifications across clients this is a pretty nifty approach. Not sure if this works through Apprise as well. (idk, does it parse locally and implement the many supported protocols locallly? in that case it's just a wrapper for everything it supports which would be cool, otherwise it's its own cloud that then connects to the different protocols...)

@aroberts
Copy link

@Tzahi12345 can you call arbitrary web hooks with this, or only gotify/ntify/telegram? Also, is there any documentation on the feature? The code is buried a huge PR, so it's not easy to see eg. where config is read.

@Tzahi12345
Copy link
Owner

v4.3.1 isn't released yet (definitely will be in the coming days!), I'm just putting the finishing touches.

I kind of forgot about the webhook part and adding it would allow for basically any integration. I went ahead and added support for them. Here's the commit: fb27264. Tested with Zapier and Automatisch and it works well :)

It definitely needed documentation so I made a wiki page which hopefully helps answer your questions: https:/Tzahi12345/YoutubeDL-Material/wiki/Notifications

Feel free to test out the functionality, let me know what works/doesn't!

@aroberts
Copy link

super helpful, thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
is: enhancement New feature or extension of existing functionality
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants