Why do we need an identifier and webhook trigger to set variables via webhooks?

420

Active member
We can set variables through webhooks (which is great), but i do not understand why this requires an identifier and a webhook trigger? I find this pretty annoying since it means that we need a macro with a webhook trigger that will invoke everytime we want to change any variable.. I know it can just be an empty action etc, but still.. i don't see why we cannot just set variables via webhook directly without any identifier/webhook trigger configured...??

Right now it has to be like this;


But i don't see why it cannot just be this; (maybe even without the questionmark)

 

tanutanu

Well-known member
Because each trigger must be unique on not only client mobile side but the server side.
Trigger name is not guaranteed and has possibility to be duplicated. However, the Identifier comes from uuid(gid). It is tooooo small possibility to be the same value accidentally even though not checked each other.
Just FIY. You can get it with uuidgen command. It might be useful to make sure the session between 2 devices, typically server and client. I use it for so many purposes to serialize anything. Its much better than time base hashed value.
 
  • Like
Reactions: 420

420

Active member
Because each trigger must be unique on not only client mobile side but the server side.
If the URL to change variables would not need any identifier it would still be unique, since it would be the only one without any identifier.:p
Trigger name is not guaranteed and has possibility to be duplicated. However, the Identifier comes from uuid(gid). It is tooooo small possibility to be the same value accidentally even though not checked each other.
I don't understand, the identifier is just whatever name you give it when setting up a macrodroid webhook trigger, it's not coming from uuid(gid).
Just FIY. You can get it with uuidgen command. It might be useful to make sure the session between 2 devices, typically server and client. I use it for so many purposes to serialize anything. Its much better than time base hashed value.
And this i really don't understand :ROFLMAO:
 

tanutanu

Well-known member
If the URL to change variables would not need any identifier it would still be unique, since it would be the only one without any identifier.:p

I don't understand, the identifier is just whatever name you give it when setting up a macrodroid webhook trigger, it's not coming from uuid(gid).

And this i really don't understand :ROFLMAO:
haha, ok. Probably, the top reason to use uuid is that it is easy to use but almost perfectly unique. Even if a thing must not be unique currently, I tend to do it to be unique for future requirements.

You know, when we make a macro and need to check something in if conditions, it something happens checking two or more different variables. It is something a little complicated. So define another variables and make it work as "representative." It might be similar.

Another example, if Leonardo da Vinci were just called Leonardo, I couldn't identity with Leonardo DiCaprio. the naming system is composed of the modifier clause.
I think "hauptbahnhof" is based on better naming system than that. Those German words, just adding prefix/suffix, make a bunch of words as single words. It's quite unique and interesting for me. How can I say it In Dutch? Estacion? Stacion? Station?:unsure:

Anyway, I think this is the top reason to use unique id. Just one word is useful(but not human friendly).

EDITED: Seriously to say, if people can choose their preferred names, the system need to prepare unique checking and error handling. uuid has many pros but no cons:)
 
Last edited:

420

Active member
haha, ok. Probably, the top reason to use uuid is that it is easy to use but almost perfectly unique. Even if a thing must not be unique currently, I tend to do it to be unique for future requirements.

You know, when we make a macro and need to check something in if conditions, it something happens checking two or more different variables. It is something a little complicated. So define another variables and make it work as "representative." It might be similar.

Another example, if Leonardo da Vinci were just called Leonardo, I couldn't identity with Leonardo DiCaprio. the naming system is composed of the modifier clause.
I think "hauptbahnhof" is based on better naming system than that. Those German words, just adding prefix/suffix, make a bunch of words as single words. It's quite unique and interesting for me. How can I say it In Dutch? Estacion? Stacion? Station?:unsure:

Anyway, I think this is the top reason to use unique id. Just one word is useful(but not human friendly).

EDITED: Seriously to say, if people can choose their preferred names, the system need to prepare unique checking and error handling. uuid has many pros but no cons:)
I don't get it... we already have to choose our preferred names for the indentifiers, they are not neccecarily the unique part, the deviceID is the unique part.. Anyway i am not even trying to discuss any of this (i get that it has to be unique), i just want to know why we cannot just change variables without any webhook trigger and identifier configured!!! :p

For example i use sequematic.com, it can also have webhook as a trigger, but it can also set variables via webhook directly without having any webhook trigger configured/active, i think this approach is more user friendly, when i open the variables section (and click on the webhook icon behind my "bed" variable) on sequematic.com i see this explaining very well what i can do exactly;

Webhooks for Bed​

The URLs below can be called as a webhook to retrieve or modify the values of the variable Bed.

When the value of a variable changes using these webhooks, any triggers based on the value of the variable will be triggered.

You should not share these URLs publicly or other people will be able to use the URLs to modify the value of your variables.

Get value​

Use this to get the value of the variable. Click to copy the full URL.

To return the value as a 1 or 0, add /numeric to the end of the URL.


Toggle value​

Use this to toggle the value between on and off.


Set on​

Use this to set the variable to on. Click to copy the full URL.


Set off​

Use this to set the variable to off. Click to copy the full URL.




Now sequematic uses completely different URL's for each function (trigger-custom-webhook/variable-get/variable-change) but you get the idea right? We could have some information similar to the above when we open the macrodroid variables tile, i really think it would be easier then how it works now.
 

420

Active member
Maybe it works the way it does now so we can also change/set local variables via webhook? I've never tried it but it sort of makes sense..
 

tanutanu

Well-known member
I don't get it... we already have to choose our preferred names for the indentifiers, they are not neccecarily the unique part, the deviceID is the unique part.. Anyway i am not even trying to discuss any of this (i get that it has to be unique), i just want to know why we cannot just change variables without any webhook trigger and identifier configured!!! :p

For example i use sequematic.com, it can also have webhook as a trigger, but it can also set variables via webhook directly without having any webhook trigger configured/active, i think this approach is more user friendly, when i open the variables section (and click on the webhook icon behind my "bed" variable) on sequematic.com i see this explaining very well what i can do exactly;

Webhooks for Bed​

The URLs below can be called as a webhook to retrieve or modify the values of the variable Bed.

When the value of a variable changes using these webhooks, any triggers based on the value of the variable will be triggered.

You should not share these URLs publicly or other people will be able to use the URLs to modify the value of your variables.

Get value​

Use this to get the value of the variable. Click to copy the full URL.

To return the value as a 1 or 0, add /numeric to the end of the URL.


Toggle value​

Use this to toggle the value between on and off.


Set on​

Use this to set the variable to on. Click to copy the full URL.


Set off​

Use this to set the variable to off. Click to copy the full URL.




Now sequematic uses completely different URL's for each function (trigger-custom-webhook/variable-get/variable-change) but you get the idea right? We could have some information similar to the above when we open the macrodroid variables tile, i really think it would be easier then how it works now.
Probably...I indeed got what you concern. Let me try again:)

The MD webhook server recognized via uuid(identifier) each device as unique device. Perhaps MD app doesn't need any interactive communication with the server when we registered it. Just the moment when we launch MD at the first time or when we attempt to add as the first trigger, the app simply initiate the registration and the server always accept it without any human handling verification, transparently. For thease case, uuid is easy and helpful for both parties, developer and users. Because the system doesn't need any complicated registration and authorization mechanism for this purpose. The server seems to consider all webhook requests come from authorized MD users because they should have trusted app. Strictly speaking, it has a little weakness...maybe adding few more trcks if I made the server and/or client side program as such manners. MD app might have more hidden data communication at the beginning.
Please don't forget I sometimes forgot everything completely, so I might do something when I started up MD webhook;)

Anyway, once we got access to the webhook server, we can use a preferred name as a identifier string for each trigger whatever we want. It means the identifier is the suffix of the unique device id. As your helpful example, there are some different style for the way to pass the unique string. the method of MD's is very traditional and popular one. Probability MD already had HTTP GET mechanism, so it is suitable for rapid iteration. The url path suffix connecting trick is also well know, it is a little modern and it need additional virtual path trick on the server side. If no preregistration as the identifier on the server side, it should be recognized as connected but a part of the url path string, so just considered an error and redirect to access forbidden page basically. Therefore the other service has a trick, to hook it and redirect to url parser web program then interpret and validat the url string with the stored data.

I understand what you want. Changing a variable name is easier than trigger's property, simply adding them. However, the trigger is suitable for webhook because they have same roles as requests receiver. When handling trigger as the calling target, the position of the last part of url(before following delimiter "?" and parameters) is natural and reasonable.
In MD world, I think object is macro and both trigger and variable are its properties. And variable never becomes a receiver. So myMacro.mTrigger or myMacro.mTrigger.mItsAttribute is natural but myMacro.mVariable.mTrigger is not.
If variable were object and trigger were its property(member working as a interface), it should be natural and reasonable.

Probably, Jamie want to be focusing on client side app development, so he chose the solution as easy as possible. Even if not so difficult, it seems to be annoying for a developer who are always working with rich development environments.

It is very interesting to taak to you such things:) I feel both methods are the same things, but you got the possibility to improve it. It seems based on user experiences of MD macro development on its environment. I am always impressed because you are super positive and watch anything carefully with deep interests and consider about MD progress:)
 
Last edited:
  • Love
Reactions: 420

tanutanu

Well-known member
Maybe it works the way it does now so we can also change/set local variables via webhook? I've never tried it but it sort of makes sense..
Yep, you can do it. MD webhook is just a remote proxy of trigger. So, available not only for local device's variables but also another device's.
We have global variables, so no make sense to pass to another macro on local device, but to another remote device, it make sense.
 
  • Like
Reactions: 420
Top