Giter Club home page Giter Club logo

Comments (13)

boredazfcuk avatar boredazfcuk commented on May 26, 2024

Probably, the Discord webhook has this curl command : https://birdie0.github.io/discord-webhooks-guide/tools/curl.html and an example:

url='https://discordapp.com/api/webhooks/"203019812404264973/rptBmYgoehu70kw2rItSlhRqKi7kMJh1bM2KCUUD2vR6grZckvtdl62h4xR7XWUS5463'
curl -H "Content-Type: application/json" \
-X POST \
-d '{"username": "test", "content": "hello"}' $url

which is pretty similar to to my Telegram command:

curl --silent --request POST "${notification_url}" \
         --data chat_id="${telegram_chat_id}" \
         --data parse_mode="markdown" \
         --data text="${2}"

My Webhooks one would probably look like:

notification_url='https://discordapp.com/api/webhooks/"203019812404264973/rptBmYgoehu70kw2rItSlhRqKi7kMJh1bM2KCUUD2vR6grZckvtdl62h4xR7XWUS5463'

curl --silent --request POST "${notification_url}" \
         --data username="${webhook_username}" \
         --data content="${2}"

I don't have a webhooks notification system I can test with though... To be honest, I don't even know if the PushBullet notification method works coz I don't have that either, but it looks like it should as the API is pretty much the same lol.

What webhooks service in particular are you using?

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

I'm using Home Assistant as a notifier service that would generate the webhook which would then send a notification to my phone depending on the message json payload passed from icloud-pd.
If it helps, I think i used the pushbullet notification previously and pretty sure it was working good!

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

Hi,
I've just pushed a new version that has untested Webhook support. It probably won't work as I'm unsure of the format of the data that I should be sending.

I've found this link which suggests it should be formatted as:

curl --request POST \
  --url http://HomeAsisstant:8123/api/webhook/MyWebhookID\
  --header 'content-type: application/json' \
  --data '{
	"data":"Forwarded"
}'

So I've just imitated this, but changed "Forwarded" to the message I send via Telegram.

Give it a test and let me know what you find.

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

Thanks so much for this, I've pulled the new image and updated my compose, just a couple of questions, should the host ip address be the full http://HomeAsisstant:8123/api/webhook/MyWebhookID or just the host ip and the port as I specify the webhook id separately.

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

Host IP is just the IP address, nothing else... You could put the hostname of the computer in it if you like... in fact, I’ll rename that variable to webhook_server in the next push, I’ll sort that tonight.

I’ll also add a webhook_port variable just in case people run on non-default.

I combine the webhook_https, host_ip_address and webhook_id variable to generate the server’s URL.

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

I've pushed this to Dockerhub now. The variables it uses for the webhooks URL are now:

webhook_server
webhook_port
webhook_id
webhook_https (if set True webhook_scheme=https, otherwise webhook_scheme=http)

It puts them all together to generate the notification URL like this:

notification_url="${webhook_scheme}://${webhook_server}:${webhook_port}/api/webhook/${webhook_id}"

Let me know how you get on and I'll either update again, or close the issue.

Thanks.

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

I've pulled the latest image but I get the following in the logs
020-05-28 14:28:56 WARNING Webhook notifications enabled, but API key/token not set - disabling notifications
My compose looks like this?

     - notification_days=14
     - webhook_server=192.168.68.110
     - webhook_port=8123
     - webhook_id=VCyx4YOljF0apiIEK3Gu7ssWj9hSDT9T
     - webhook_https=false
     - synchronisation_interval=43200

Have I gone wrong somewhere?

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

My mistake. There was an additional check when configuring notifications that I had missed. I've updated and pushed to Dockerhub again.

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

That worked! Thanks so much again, the message is being passed to home assistant so now I just need to configure the payload in my notification on my phone

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

No worries. I use some emoji characters in it which may not be translated well on the receiving system.

If you need me to amend the message, then just reply back here.

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

That would be amazing if you could, this character ↵ is causing some issues?

from docker-icloudpd.

eldudemeister avatar eldudemeister commented on May 26, 2024

and the backslashes and carriage return?

from docker-icloudpd.

boredazfcuk avatar boredazfcuk commented on May 26, 2024

I've removed those all. That's going to make the downloaded/deleted files previews look a little weird. Let me know if you need those removing too.

from docker-icloudpd.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.