[webhook] What's the best pratice

Hello,

I am migrating my devises to V3 and I registered my first devise.
For now, when my devise is running, I can see data in the ‘live data’ tab for the gateway and the devise.

I also created a payload formatters. With V3, I observed I can create a payload formatters for a dive or for the application. I created a payload formatters for the application, thinking it will apply for all future devises.

As I need to send the data to a remote server, with V2 I created an HTTP integration. But with V3, I need to create a webhook. It’s what I tried.

I added a web formatter and I filled the fields as the followng;

Then, bellow there is a ‘enable message’ section and I have some doubt.

First, I have not enable any options and my PHP script was not executed.

For each enabled message type, an optional path can be defined which will be appended to the base URL

Then I enable ‘up link message’, and my PHP script was called (I have not defined a path)

Reading that page, I understand that if I enable ‘up link message’ and I define /up as the path, my php script should be located the /up folder, may be as the following

https://sub.website/api/up/save_measures-stackV3.php

I could create a PHP script for ‘join accept’, ‘download ack’ and define the folder according the path.

https://sub.website/api/join/save_join-stackV3.php
https://sub.website/api/download/save_download/-stackV3.php

That’s correct?
What’s the best pratice?

What append, if I enable ‘upload’, ‘join accept’, download ack’, without defining any path?
My PHP script should manage all kind of messages?

In my case, I only need to get the uplink and save the message into my database. I believe, I should better move my PHP script to the /up folder (and define the path for up link).

If later, I use OTTA, I can add the new PHP script into the /join folder, an so on?

Thanks for your clarification and enjoy your week-end

Yes, they are correct

Yes - but it doesn’t have to do much, it could just record the basic information in a text file.

Why? It was working earlier when you turned on the Uplink message, why change something that is working?

It can be any name you like, like uplink or data or banana or Elisa

Yes

Maybe you will gain more confidence if you try things out more …

You may find the following useful:

https://www.thethingsindustries.com/docs/integrations/webhooks/creating-webhooks/

1 Like