Difference between revisions of "Trigger: Webhook (URL)"

m
Line 2: Line 2:
 
This trigger will fire on this device when the specified web URL is called from anywhere.
 
This trigger will fire on this device when the specified web URL is called from anywhere.
  
Note
+
WARNING:
 +
 
 
that the URL is unique to this device and the URL will change if the application is reinstalled (or all application data is deleted).
 
that the URL is unique to this device and the URL will change if the application is reinstalled (or all application data is deleted).
  
 
This feature uses Firebase Cloud Messaging to notify the device via the backend server, therefore it is not functional on devices that lack Google services (such as Alexa tablets etc.)
 
This feature uses Firebase Cloud Messaging to notify the device via the backend server, therefore it is not functional on devices that lack Google services (such as Alexa tablets etc.)
 +
 +
SENDING PARAMETERS:
 +
 +
In addition to an identifier it is also possible to send URL parameters to the trigger which are then used to set MacroDroid Variables. The format for sending parameters is as follows:
 +
 +
PARAMETERS OF EXAMPLES:
 +
 +
ID = User-defined identifier.
 +
 +
VARNAME1 = The first variable to be defined, in this case with a numerical value.
 +
 +
VARNAME2 = The second variable to be defined, in this case with a plain-text value
 +
 +
DATA = Dictionary.
 +
 +
(KEY) = The key you are defining in your Dictionary / Array.
 +
 +
= After this sign goes the value you want to send in the webhook.
 +
 +
To set a variable:
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Hello
 +
 +
To set multiple variables:
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=42&VARNAME2=Hello_World
 +
 +
For Dictionaries / Array:
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?DATA(KEY)=VALUETEXT
 +
 
</pre>
 
</pre>
 
More information here.
 
More information here.
Line 11: Line 40:
  
 
'''Example Usage'''<br/>
 
'''Example Usage'''<br/>
 
+
This macro will receive values by webhook and speak them by TTS.
 
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
 
<pre style="background-color: #AC2424; color: white; border-radius: 10px; padding: 10px;">
 
Triggers
 
Triggers
  
 
+
Webhook (MyWebhook)
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Hello
 
</pre><br>
 
</pre><br>
 
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
 
<pre style="background-color: #1665B0; color: white; border-radius: 10px; padding: 10px;">
 
Actions
 
Actions
  
 
+
Speak text: You received a new value [lv=VARNAME1]
 
</pre><br>
 
</pre><br>
 
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
 
<pre style="background-color: green; color: white; border-radius: 10px; padding: 10px;">
Line 30: Line 60:
 
Local variables
 
Local variables
  
 
+
VARNAME1 [Hello] (Type String)
 
</pre><br>
 
</pre><br>

Revision as of 20:35, 30 April 2023

This trigger will fire on this device when the specified web URL is called from anywhere.

WARNING:

that the URL is unique to this device and the URL will change if the application is reinstalled (or all application data is deleted).

This feature uses Firebase Cloud Messaging to notify the device via the backend server, therefore it is not functional on devices that lack Google services (such as Alexa tablets etc.)

SENDING PARAMETERS:

In addition to an identifier it is also possible to send URL parameters to the trigger which are then used to set MacroDroid Variables. The format for sending parameters is as follows:

PARAMETERS OF EXAMPLES:

ID = User-defined identifier.

VARNAME1 = The first variable to be defined, in this case with a numerical value.

VARNAME2 = The second variable to be defined, in this case with a plain-text value

DATA = Dictionary.

(KEY) = The key you are defining in your Dictionary / Array.

 = After this sign goes the value you want to send in the webhook.

To set a variable:
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Hello

To set multiple variables:
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=42&VARNAME2=Hello_World

For Dictionaries / Array:
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?DATA(KEY)=VALUETEXT

More information here. https://medium.com/@macrodroid/introducing-the-webhook-trigger-a760e2ee140d

Example Usage
This macro will receive values by webhook and speak them by TTS.

Triggers

Webhook (MyWebhook)
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Hello


Actions

Speak text: You received a new value [lv=VARNAME1]


Constrains



Local variables

VARNAME1 [Hello] (Type String)