Call specific URL when door opens?

Good evening,

thanks to your help, I was able to integrate my Dragino LDS02 door sensor today and can already call a simple test WebHook on webhook.site

But now I am unsure how to handle this: The goal would be to just call the URL below if this DOOR_OPEN_STATUS: 1 is sent:

image

URL to call: https://user123:password123@my.server.mooo.com:51828/?accessoryId=eingang-postkasten&state=true

Is that even possible directly out of The Things Stack or what else would be suggested for such a case?

Just for testing I created a custom webhook for all uplink messages to call my specific URL, but unfortunately it is always failing and deactivated due to errors. But when I call that URL in a web browser everything is fine. Do you know what Iā€™m doing wrong here? Custom Test Webhook to webhook.site is working, but not to my own URL:

image

1 Like

Do you have any more details on the errors that occur during the webhook call to your URL? If possible, change from https:// to http:// temporarily, not permanently and use a packet sniffer on your server (ngrep, tcpdump, Wireshark) to examine the packets. That may provide more insight.

The only thing that looks a little odd is using https:// to connect to a port number other than 443. Most browsers will flag that as a security risk and require extra steps to bypass. Perhaps the TTN webhook system sees that and errors out?

1 Like

First, simplify it down to just using a webhook without all the extras - standard port, no basic authentication.

Then donā€™t bother adding a different port or any basic authentication - unless you HAVE to use a different port (why?) and as your webhook can check for a made up API key before processing, you can skip the basic auth - anyone who probes the IP address and by some miracle happens on the page name can get no response if itā€™s not got the API header and not a properly formatted JSON message.

As for your first question, no, you canā€™t decide if the webhook gets used, any uplink from your device will get a webhook sent.

3 Likes

Thanks, I got it to work over HTTP now.

But as soon as I wanna use HTTPS it does not work. Not on port 443 and also not on 51828.
Calling the specific URL in a web browser does work always.

1 Like

I created an IFTTT applet now, which can be triggered by calling an URL. But why is this not accepted as custom webhook here?

image

If I try to put the key in the API key field it shows also an error:

image

How to do it to just call that URL?
https://maker.ifttt.com/trigger/Postkasten/json/with/key/MyKey123MyKey123MyKey123MyKey123MyKey123

1 Like

Did you quote the port for 443? Or just add the ā€˜sā€™?

The extensive TTS documentation may be a friend you want to get to know - links bottom right of every console page.

The Downlink API key is NOT for an IFTTT key - itā€™s for a TTS API key to authorise downlinks.

As before, get it working without the extras and then add to it.

2 Likes

I did try both:
https://my.server.mooo.com:443
and also:
https://my.server.mooo.com

Nothing worked. But in the web browser both is working.
But the developer of my WebHook service told me, that the reason could be the self signed SSL certificate.
Isnā€™t there an option in TTS like ā€œā€“no-check-certificateā€ or ā€œ-insecureā€?

Itā€™s not that bad if that will not work, if at least you could help me to get IFTTT to work.

1 Like

Regarding the documentation about IFTTT a found a way to use it with Node Red, but I donā€™t use Node Red. Is it really necessary to call a simple IFTTT URL to also use Node Red?

1 Like

Can someone please answer me that simple question:

Why is it possible to call that WebHook successfully:
https://webhook.site/d79e774a-5afa-4333-a58b-815ccdcc1ae7

But not possible to call that one?
https://maker.ifttt.com/trigger/Event123/json/with/key/111111222222222222333333333333xxxxxxxxxxxxx

Is the workaround really to create a Tiny URL to get an IFTTT WebHook running in The Things Stack???

1 Like

Someone probably can but your demanding tone and barrage of questions probably wears out the fellow forum users. Donā€™t forget we are all just TTN users and you are not entitled to support.

My best guess: from experience I know Ifttt requires a special formatted json as input or it will not accept the input. Did you check the webhook json matches that format?

1 Like