MacroDroid setup a Webhook macro

Here is how, with examples for general purpose use


1. Set up a Webhook

How to create a MacrodDroid Webhook to trigger macros


2. Phone announce battery level


When the URL is sent the device speaks it's battery level
Simple example to learn MacroDroid Webhooks


3. Proxy convert HTTPS
to HTTP

When the URL is sent it sends the action as an HTTP request [proxy function]
[for use by a Fitbit companion to access
HTTP devices]
See reference at the bottom


4. Find a phone

When the URL is sent [from any browser]
It will cause the phone to ring, regardless of silent mode


5. Partner panic contact


A shortcut on your phone to ring your partner's phone
in case of an emergency, overrides silent mode
Same as 4 Find a phone above but for a different use


General usages


Soon to be released SimpleHome for Fitbit watches
can be used to send these functions direct from the watch

Bookmarks can be made in browsers and added to a phone home screen

Shortcuts can be made on PCs




1. Start a new macro with Webhook trigger


new

Click + to enter a Trigger

add

Select Webhook (Url)

trigger

In 1. put the identifier name that you choose in your macro to action the trigger

In 2. click the pink + and create an action variable which can contain parameters.
This is not strictly necessary but good practice to provide options

action

Finally for 3. copy the URL with identifier
when sent from a browser it will trigger this macro

Lastly if you add "?action=xxx" to the URL
you will be able to pick up "xxx" in a macro, see example below


2
- Create a new macro for the Battery level macro

Start by setting up a Webhook trigger defined in step 1.


new


  Enter "battery" for the identifier in the Trigger - position 1
Click + and enter "action" and create the variable - position 2

Completed the trigger

start

Click the copy button with the identifier filled in - position 3
to have the complete url to invoke the macro

The url looks like this

"https://trigger.macrodroid.com/3b045d6e-659e-49d7-xxxx-e0adbb02057f/battery"

Save it somewhere so you can run it again in future
from a Phone shortcut or browser bookmark, or watch link

Press Ok to save
the Trigger

[Note: This macro doesn't actually use the "action" variable but it's good practice]

Click + to create a new action

action

Choose speak text
Enter the text
"SimpleHome says phone battery level is {battery} percent"
where shown below

macro

 Press OK to save action
Press Tick to save all changes

Finished macro

final

To test, paste the copied URL [position 3 above]
into a browser and execute

NOTE: The identifier is case sensitive, so "battery" and "Battery" are 2 different triggers


3.Proxy,  HTTPS to MacroDroid - HTTP to any devices

A workaround for the Fitbit companion

Start a new macro for sending
HTTP requests


new

Setup the trigger, same as in 1.
create a MacrodDroid Webhook
 except use "SimpleHome" for the identifier
and in this case a global "action" variable was used


 Click the copy button [position 3] with the identifier filled
to have the url to invoke the macro

Press Ok to save the Trigger

Click + to create a new action
choose HTTP request

http

Insert the following settings

request

Finalise macro - which looks like this

dorequest


To test, paste the copied URL [position 3 in the trigger]
into the browser and add the action variable
so it looks something like the example below
using your specific IP and parameters
and then execute it

https://trigger.macrodroid.com/3b045d6e-659e-49d7-xxxx-e0adbb02057f/SimpleHome?action=http://192.168.106.131/relay?state=1

If it works from the browser it should also work from the Fitbit companion
or any other device that requires the conversion

Notes:

This will send the HTTP request required, the response isn't handled but it may also be possible


If you are working across multiple local LANs access must be granted by the router.

Reference:
Consult this link to see Valid Fibtit Local addresses
 


4 - Find a phone
 
Create this macro on both your
and your partner's Android phone


new



Click + to enter a Trigger


add

Setup the trigger same as in the previous examples
except use "FindMyPhone" for the identifier,
replace "My" with the phone holders name


Enter the macro name same as the identifier
to distinguish the different macros for the shorcuts


 Click the copy button [position 3] with the identifier filled
to have the url to invoke the macro

Press Ok to save the Trigger

Click + to create a new actions
which should look like this

action


This macro uses the action parameter to start/stop the process

Finalise macro - which looks like this


----

To test, paste the copied URL [position 3 above]
into the browser and the action to execute

While the Macro is only installed on an Android phone
it can be called from anywhere.

The Webhook will be different for you and your partner
as each will have a different MacroDroid key

Setup a bookmark, or shortcut, for each other's on your phones.
That way either of you can trigger the ring of the phone to find.

If you use a PC or tablet bookmarks / shortcuts you can find yours
or your partner's phone

It is a good idea to make 2 shortcuts for each phone.
The first with the URL copied which triggers the process
The second with "?action=cancel" appended to the URL

This give the ability to start and stop the phone ringing
otherwise it runs at full volume.

Also everything will be full volume afterwards
and volume levels need be reset

----

 A refinement to the macro is to save the volume levels as they were
and to restore them back when the macro is finished.

If the play item is a short item, wrap it in a repeat loop with a pause
that is dependent on action not being cancel, such as:

repeat 10 times
if action != cancel
play short item
wait 2 seconds
endif

 

5 - Emergency contact partner phone

Using the same URLS for the macro, as made in 4 above

Create a shortcut on your phone or PC browser named
as Emergency contact for your partner's phone