Changes

Webhook page redesign
Line 1: Line 1: −
<pre style="background-color: #EEEEEE; color: Black; border-radius: 10px; padding: 10px;">
+
== About ==
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 
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.
 +
</pre>
 +
More information here.
 +
https://medium.com/@macrodroid/introducing-the-webhook-trigger-a760e2ee140d
 +
<br>
   −
WARNING:
+
===<p><b>Warning</b></p>===
 
+
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 
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.)
 +
</pre><br>
   −
SENDING PARAMETERS:
+
===<p><b>Parameters</b></p>===
 +
* ''''' IP address whitelist '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
You can support one or more IP addresses so that the webhook is only activated from specific IP addresses.
 +
It also supports magic text '...'
 +
</pre>
 +
'''''[[magic text|Magic text list]] '''''
 +
</pre><br>
   −
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:
+
* ''''' Save body to string variable '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
If your HTTP POST request contains any text format, you can save it in any string variable.
   −
PARAMETERS OF EXAMPLES:
+
Note that due to limits imposed by Firebase Cloud Messaging the maximum body text length is 3800 characters.
 +
</pre>
 +
'''''[[Variables]]'''''
 +
</pre><br>
   −
ID = User-defined identifier.
+
* ''''' TinyUrl '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
It is a URL shortening service used to create shorter, more shareable links.
 +
You can use it to shorten your urls, go from this:
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-677d4d/mywebhook
 +
to this:
 +
http://tinyurl.com/5xzj7w6j
 +
</pre><br>
   −
VARNAME1 = The first variable to be defined, in this case with a numerical value.
+
===<p><b>Formats to include variables</b></p>===
 +
* ''''' Identifier'''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
The identifier is what is after the base url.
 +
Base URL:
   −
VARNAME2 = The second variable to be defined, in this case with a plain-text value
+
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-677d4d/
   −
DATA = Dictionary.
+
E.G. The identifier would be 'mywebhook'
 +
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-677d4d/mywebhook
 +
</pre><br>
 +
* ''''' Attach variable value [[Variables|String, Integer, Decimal, Boolean]] '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
ID = User-defined identifier.
   −
(KEY) = The key you are defining in your Dictionary / Array.
+
VAR1 = The first variable to be defined, in this case with a numerical value.
   −
= After this sign goes the value you want to send in the webhook.
+
VAR2 = The second variable to be defined, in this case with a plain-text value.
    
To set a variable:
 
To set a variable:
Line 31: Line 65:  
To set multiple variables:
 
To set multiple variables:
 
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=42&VARNAME2=Hello_World
 
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=42&VARNAME2=Hello_World
 +
</pre>
 +
''''' An introduction video is available MacroDroid Variables https://youtu.be/0V_EcyhxrpA?si=_mjXwGVXHO3J8Ywp '''''
 +
<br>
 +
 +
<br>
 +
* ''''' Attach Data Structure [[Variables|Dictionary - Array]] '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
id = User-defined identifier.
 +
 +
mydict = It is a dictionary type variable for the example.
 +
 +
KEY = It is the key or entry of the dictionary.
 +
 +
VALUETEXT = It is the value you want to send.
    
For Dictionaries / Array:
 
For Dictionaries / Array:
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?DATA(KEY)=VALUETEXT
+
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/id?mydict(KEY)=VALUETEXT
 +
</pre>
 +
''''' An introduction video is available Using Dictionary and Array Variables https://youtu.be/u2zY5dv34CM '''''
 +
<br></pre>
 +
 
 +
===<p><b>Webhook management</b></p>===
 +
* ''''' Export device ID to new device '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
You will be asked to create a password (it will be linked to your current device ID) and you can import it later in case your device is damaged or you update your current device.
 +
 
 +
Later you can use the 'Import device ID from another device' option to restore your previous Device ID.
 +
</pre><br>
 +
 
 +
* ''''' Import device ID from other device '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
You will be asked for the Device ID and password and you will be able to correctly import the Device ID.
 +
</pre><br>
 +
 
 +
* ''''' Generate new device ID '''''
 +
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
 +
This will assign a new device id to this device. Existing webhook links for this device will no longer function.
 +
To get a new device ID you just need to check the 'I have read and understood' box
 +
and you can generate your new device ID.
 +
</pre><br>
 +
 
 +
===<p><b>Examples</b></p>===
   −
</pre>
+
<pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
More information here.
  −
https://medium.com/@macrodroid/introducing-the-webhook-trigger-a760e2ee140d
  −
<br><br>
  −
'''Example Usage'''<br/>
   
This macro will receive values by webhook and speak them by TTS.
 
This macro will receive values by webhook and speak them by TTS.
 +
</pre><br>
 
<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)
 
Webhook (MyWebhook)
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/ID?VARNAME1=Hello
+
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/id?VAR1=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]
+
Speak text: You received a new value {lv=VAR1}
 
</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 60: Line 130:  
Local variables
 
Local variables
   −
VARNAME1 [Hello] (Type String)
+
VAR1 = Hello (Type String)
 
</pre><br>
 
</pre><br>
editors
1,599

edits