Add multiple respones to webhook(url)

Macka32

New member
We should get multiple responses from the webhook url response ex.
  • Ok if the macro was triggered;
  • Return json or some other text when the macro was triggered with the variables;
  • Disabled if the macro was disabled;
  • Connection error or other type of indication that the device wasnt connected to the internet and it didnt recived the trigger or it wassnt triggered;

AND THIS IS OPTIONAL, you dont have to implement but it woud be nice give us the ability to return custom text to the webhook url, like our custom text and variables. Like insted of returning ok if the macro was trigger we woud return custom text. Yes i think there would be nice a limitation like 300 or 400 letters per response to avoid abuse.
Thanks !!!
 

tanutanu

Well-known member
We should get multiple responses from the webhook url response ex.
  • Ok if the macro was triggered;
  • Return json or some other text when the macro was triggered with the variables;
  • Disabled if the macro was disabled;
  • Connection error or other type of indication that the device wasnt connected to the internet and it didnt recived the trigger or it wassnt triggered;

AND THIS IS OPTIONAL, you dont have to implement but it woud be nice give us the ability to return custom text to the webhook url, like our custom text and variables. Like insted of returning ok if the macro was trigger we woud return custom text. Yes i think there would be nice a limitation like 300 or 400 letters per response to avoid abuse.
Thanks !!!
It seems to return http response.

I think you can send back something if you call remote MD macro on another device via MD webhook.
 
Last edited:

Macka32

New member
But the success state is always true and the response is always ok, even if my macro is disabled, enabled and the device doesn't have connection, and i am trying to call this trigger via java script.
Thanks
 

Snurre

Well-known member
I've got a phone in my car on which I can run different macro's via http get, for example I have a macro on my home phone to check battery status on the car, which returns the battery percent
It's done on the car via a http get back to the home phone
If the webhook doesnt trigger on the home phone for 1 second it displays a popup with "Failed" else it shows the percent of the car phone
Just an example
 

tanutanu

Well-known member
But the success state is always true and the response is always ok, even if my macro is disabled, enabled and the device doesn't have connection, and i am trying to call this trigger via java script.
Thanks
Either the server responding or not, it is natural(at least for me) to make the not respond case, especially the return is unreliable.
Do you write your JS code based on the MD server 100% available? I would like to suggest to consider the timeout case. If not responding, the reason would not be so important for the sequence itself, which is working or not:unsure:
If I manage everything by myself, including the server side, I might want to know where and how the issue is happening though.
 

Macka32

New member
Ex i want to call the macro via the MD url and change some variables ex. Phone number and text, then the macro woud send the sms to the number with the text, and now i want to have feedback if the macro was run, (if the sms was sent) if it wasnt i want to trigger the macro again, or if my phone isn't connected to the internet i would like to return thats the sms was not sent due to connection error or something like that
 

tanutanu

Well-known member
Ex i want to call the macro via the MD url and change some variables ex. Phone number and text, then the macro woud send the sms to the number with the text, and now i want to have feedback if the macro was run, (if the sms was sent) if it wasnt i want to trigger the macro again, or if my phone isn't connected to the internet i would like to return thats the sms was not sent due to connection error or something like that
Both cell A and B can send/receive some info each other via MD macro and webhook. You can send/receive hart beats constantly to detect the other availability before initiating what you really want to do as well.
I hope you imagine the sequences.
 

Snurre

Well-known member
Ex i want to call the macro via the MD url and change some variables ex. Phone number and text, then the macro woud send the sms to the number with the text, and now i want to have feedback if the macro was run, (if the sms was sent) if it wasnt i want to trigger the macro again, or if my phone isn't connected to the internet i would like to return thats the sms was not sent due to connection error or something like that
Try something like this

Phone A
"Connectivity check" url:phone B
If this return true
HTTP GET url:phone B var 'name' and 'text'
Else try again (while/do) x times

Phone B
Trigger webhook
Var 'name' and 'text'
Action "Send SMS" phone numer[lv=name] message text [lv=text]
HTTP GET url:phone A var 'success' (BOOLEAN)

Back to phone A
If 'success' true
Pop-up "SMS sent"

This will only check if the macro did run not if the SMS for some reason didn't send, but if phone B shows a notification when a SMS is sent you could check for that and respond to that
It's maybe a good idea to use some 'Wait' among different actions
I'm using it to a number of different actions and it works for me, but try to play a little with the suggestions
 
Top