Help for webhooks (Resolved)

vm53

Member
I'm trying to broaden my knowledge about webhooks, but maybe due to my age, I can't figure it out.
I can command a remote phone with simple commands, but now, taking a cue from the wiki,
001.pngI'd like to create a macro that makes a popup appear on the remote phone, a variable text, for example:
Or https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Night
each time it can be different, like a text message
I tried but the variable remains empty
Could anyone help me to create the 2 macros (one for my phone and the other for the remote phone?
Also what are the commands to use on webhooks and what are they for?
Ex: ID?VARNAME1=Hello
http://trigger.macrodroid.com/UUID/Identifier?string_variable="Hello world!"
Thanks in advance, sorry for my english (google) and for my dullness (over 70) :)
 
Last edited:

JA-Translator

Moderator
There is a fixed syntax for Webhook.
You have to follow it with the exactly same format.
Unfortunately, your writing syntax looks incorrect.

Correct Syntax:
YourDeviceID/ID-NAME?VARIABLE1=Hello&VARIABLE2=test

(edit: erased double quotations)


The blue text has to be exactly the same.

The red texts are what you can rewrite.

YourDeviceID is your own device ID, which is like
"xxxxxxxx-1111-ssss-2222-yyyyyyyyyyyy"
with mixed alphabets and numbers.
You can check it in the Webhook Trigger.

ID-NAME is an identifier text that you set in your Webhook Trigger.


VARIABLE1 and VARIABLE2 are your variable names and the values.
You can rewrite the variable name matching with your actual variable name in your MacroDroid.
 

vm53

Member
There is a fixed syntax for Webhook.
You have to follow it with the exactly same format.
Unfortunately, your writing syntax looks incorrect.

Cotrect Syntax:
YourDeviceID/ID-NAME?VARIABLE1="Hello world!"&VARIABLE2="test"


The blue text has to be exactly the same.

The red texts are what you can rewrite.

YourDeviceID is your own device ID, which is like
"xxxxxxxx-1111-ssss-2222-yyyyyyyyyyyy"
with mixed alphabets and numbers.
You can check it in the Webhook Trigger.

ID-NAME is an identifier text that you set in your Webhook Trigger.


VARIABLE1 and VARIABLE2 are your variable name and the values.
You can rewrite the variable name matching with the variable name in your MacroDroid.
Thanks for the reply, but I still don't understand.
I copied the string you suggested, it gives me the ok,
but nothing happens in the variable(s) I created.
Should I create 1 or 2 variables?
Integer or string?
What name should I give? to this or these?
Thanks again!
 

JA-Translator

Moderator
it gives me the ok,
but nothing happens in the variable(s) I created.

Ah, That's right.
I also tested my own macro.
But I noticed it doesn't work.
The response is 200 ok in return.
My macro used to work well, though.
Let me try to test a few more things.

Meanwhile,
Shall we shout here? 😁


Someone, could you please help us!?
Your Webhook is working well?

🤔

Should I create 1 or 2 variables?
Integer or string?
What name should I give? to this or these?
Thanks again!

Meanwhile, here is the answer.

If you don't need, you don't have to use variables (Query parameter).

The simple Webhook without parameters is also available.
https://trigger.macrodroid.com/YourDeviceID/ID-NAME


The variable name and the value should be encoded in the URL unless they are English or if spaces are included.


I am not sure, but "xxx" (double quotation) may not be needed in the URL.


The variable would be better to be "string", which can widely accept any value.
 

Dimlos

Well-known member
Device ID can be regenerated, so it should not be a problem.
In principle, the actual items used should be kept private.
 

JA-Translator

Moderator
Macro A is "sender".
Macro B is "receiver".

Macro A (HTTP Request Action to send a request to invoke Macro B)

Macro B (Webhook Trigger: With taking a request from Macro A, run actions in Macro B)




Macro A: HTTP Request Action

Screenshot_20230627-184400_MacroDroid.png

In my local variable (MyIdentifier), the ID-Name (CallWebhook) is set.
Screenshot_20230627_235442.png


Query Parameter:
You set the variable name and the value.
Screenshot_20230627-184226_MacroDroid.png


Macro B:
Webhook Trigger.
My Identifier is "CallWebhook".
You need to set this ID in Macro A.

Screenshot_20230627_184834.png
 

vm53

Member
RESOLVED
Thanks @Endercraft @JA-Translator @Dimlos

Thanks to your suggestions I found the optimal solution for me!

I created a macro (sender) and a macro (receiver)

In the sender macro I created a string variable: msg
in actions: https://trigger.macrodroid.com/YourDeviceID/receiver?var={lv=msg}

In the receiver macro I created a trigger: https://trigger.macrodroid.com/YourDeviceID/receiver
In variables I created a string variable: var

It works perfectly! Eventually in case of need I can post the 2 macros.
 

dudul6395

Member
Hello everyone my research and my tests are unsuccessful so I come to look for help, here is my need to make different phone chargers work together in home automation mode I need to communicate the numerical value of the battery charge to phone 1 to phone 2 usually I use a webhook which works very easily with a boleene variable... but for a numeric variable I can't find the correct syntax... can you help me ? Thank you all for your attention Vincent
 

Subfocus

New member
RESOLVED
Thanks @Endercraft @JA-Translator @Dimlos

Thanks to your suggestions I found the optimal solution for me!

I created a macro (sender) and a macro (receiver)

In the sender macro I created a string variable: msg
in actions: https://trigger.macrodroid.com/YourDeviceID/receiver?var={lv=msg}

In the receiver macro I created a trigger: https://trigger.macrodroid.com/YourDeviceID/receiver
In variables I created a string variable: var

It works perfectly! Eventually in case of need I can post the 2 macros.
Post macros
 
Top