Getting started with WebHooks

Watch here:

Download here:

Discuss down below …

2 Likes

Thanks for watching, I’ll link to the video once it’s available.

One key point, it is possible to run a WebHook on a machine inside your own network (office or home) but it requires a configuration on the router to allow an incoming request and a way to track any changes in your external IP address - which you can do with Dynamic DNS which most modern routers support a range of services to do so.

But nothing beats a bit of web space that just runs & runs somewhere else on the internet so you don’t have to bother with it. And there are many reliable service providers who offer entry level packages that are more than suitable. My datacache package costs me £6/year and for my own apps/devices plus development, the 10Gb space is vast. Or piggy back off some other webspace you may have.

As for @kersing, I will have to tell Helen that he is to blame for me disappearing to write a decryption package for my toolkit. Why is this important? First, TTS supports forwarding as encrypted packets and second, it will move my understanding of the LoRaWAN spec forward.

For testing both PHP & Python I have some code that simulates the incoming request so I can run the scripts at the command line locally before final testing, as the upload, test, review cycle isn’t productive or fun. As I move my tools over to v3, I’ll put them in to the repro.

Thanks @descartes for the presentation and this post. How does Webhooks compare to MQTT when run from a machine inside your own network (as your example, office or home)? I think i understand WebHooks is a Push from the TTN server and so your network needs a fixed IP address and the router some form of port forwarding. Does MQTT need the same?

Some of it is covered in the post above.

TL; DR: MQTT is more home network friendly, doesn’t need a static IP address or router setup but does need a reliable machine running all the time to be hosted on.

For inside your network, MQTT makes an outgoing connection to the TTS server which it then maintains with a ‘ping’ at intervals (typically 30s) as well as any incoming messages. As it’s an outgoing connection, nothing needs setting up on your router and you can use mobile internet if you are out & about with a laptop.

It is mildly simpler to use to create downlink requests and you can use a desktop client or Python code (some supplied on the repro). It needs an API key setting up as your MQTT password which, for MQTT, is streamlined on the console. It needs setting up on a machine that’s running 24/7 that will autostart the script if the machine is restarted.

Every application I’m working on has MQTT setup, at least the kitchen sink WebHook plus Data Storage turned on as well as using the console live data and my cut down FireHose. If I need the detail, MQTT is a bit easier to fish it out interactively but the EverythingElse setup works in a similar way, but without tagging the message with its type (easily added).

For incoming PHP to a web server, you still need a reliable machine running all the time but you can rent one for peanuts rather than worry about making sure the kids dont unplug it to do the hoovering (!).

Setup on a router is usually straightforward enough and you don’t need a static IP address as most routers can send an IP address update to a Dynamic DNS service so you can have a web address you can enter on TTS WebHooks.

It would probably be easier to do a video on the MQTT.Python.Tab.py script and do a video on internal web server setup.

1 Like