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

m
Line 33: Line 33:
 
It also supports magic text '...'
 
It also supports magic text '...'
 
</pre>
 
</pre>
'''''[[magic text|Magic text list]] '''''
+
* '''''[[magic text|Magic text list]] '''''
 
</pre><br>
 
</pre><br>
  
Line 42: Line 42:
 
Note that due to limits imposed by Firebase Cloud Messaging the maximum body text length is 3800 characters.
 
Note that due to limits imposed by Firebase Cloud Messaging the maximum body text length is 3800 characters.
 
</pre>
 
</pre>
'''''[[Variables]]'''''
+
* '''''[[Variables]]'''''
 
</pre><br>
 
</pre><br>
  
Line 75: Line 75:
 
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>
 
</pre>
''''' An introduction video is available MacroDroid Variables https://youtu.be/0V_EcyhxrpA?si=_mjXwGVXHO3J8Ywp '''''
+
* ''''' An introduction video is available''''' '''''[https://youtu.be/0V_EcyhxrpA?si=_mjXwGVXHO3J8Ywp MacroDroid Variables]'''''
<br>
 
 
 
 
<br>
 
<br>
  
Line 96: Line 94:
 
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/id?mydict(KEY)=VALUETEXT
 
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/id?mydict(KEY)=VALUETEXT
 
</pre>
 
</pre>
''''' An introduction video is available Using Dictionary and Array Variables https://youtu.be/u2zY5dv34CM '''''
+
* ''''' An introduction video is available Using''''' '''''[https://youtu.be/u2zY5dv34CM Dictionary and Array Variables]'''''
 
<br></pre>
 
<br></pre>
  

Revision as of 16:45, 22 January 2024

About

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

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

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.)


Request configuration

Identifier

The identifier is what is after the base url.
Base URL:

https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-677d4d/

E.G. The identifier would be 'mywebhook'
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-677d4d/mywebhook


IP address whitelist

You can support one or more IP addresses so that the webhook is only activated from specific IP addresses.
It also supports magic text '...'


Save body to string variable

If your HTTP POST request contains any text format, you can save it in any string variable.

Note that due to limits imposed by Firebase Cloud Messaging the maximum body text length is 3800 characters.


URL short

TinyUrl

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


Include variables

String, Integer, Decimal, Boolean

ID = User-defined identifier.

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

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

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


Dictionary - Array

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:
https://trigger.macrodroid.com/c306bcd7-5f78-4895-bee4-69600af77d4d/id?mydict(KEY)=VALUETEXT


Webhook management

Export device ID to new device

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.


Import device ID from other device

You will be asked for the Device ID and password and you will be able to correctly import the Device ID.


Generate new device ID

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.


Example

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?VAR1=Hello


Actions

Speak text: You received a new value {lv=VAR1}


Constraints



Local variables

VAR1 = Hello (Type String)