homebridge-http-switch icon indicating copy to clipboard operation
homebridge-http-switch copied to clipboard

HowTo: Sending JSON via ntfy.sh

Open Write opened this issue 1 year ago • 0 comments

Here's a working example to send JSON body trough ntfy.sh, as I had much issue to do it.

       {
            "accessory": "HTTP-SWITCH",
            "name": "JSONTest",
            "switchType": "stateless",
            "serialNumber": "SW002",
            "timeout": 1000,
            "debug": true,
            "method": "POST",
            "onUrl":
            {
                "url": "https://ntfy.sh/",
                "method": "POST",
                "headers":
                {
                    "Content-Type": "application/json"
                },
                "body":
                {
                    "topic": "your_topic",
                    "title": "🔥  NAS is running hot 🔥",
                    "message": "temperature is over 95",
                    "attach": "https://sflanders.net/wp-content/uploads/2015/11/synology-150x150.png"
                }
            }
        }

Remember: As per ntfy.sh doc : When sending a JSON notification, it must be sent to the root URL, and the topic in the body under "topic".

Thanks to https://github.com/Supereg/homebridge-http-switch/issues/103#issuecomment-999190364 / @mbierman's message which helped me a lot.

Write avatar Sep 23 '22 09:09 Write