ntfy.sh - Free MacroDroid webhook alternative

FrameXX

Well-known member
With this service you can send and receive messages via MacroDroid shell action or via ntfy.sh android app.
It's open-source and free.

official repository: https://github.com/binwiederhier/ntfy/

HOW TO USE

Everything can be find on official site

some examples:

sending a message to my topic (url)


Bash:
curl \
  -H "Priority: 3" \
  -d "My custom message" \
  ntfy.sh/macrodroiduser

fetching for new messages

Bash:
curl -s "ntfy.sh/mytopic/json?since=all&poll=1"

note that you will propably need to use regex to cut things off from output and get just what you want.

INSTANT DELIVERY OR POLLING?

You can download ntfy.sh app or you don't need to download any app and just poll for messages in time interval

For now ntfy.sh app posts a notification if message is received so you can observe notifications with MacroDroid and if notification comes you can extract the text and clear the notification.

However I created an issue on his repo to add an integration by broadcasting intents, so you may soon be able to just use an intent trigger!


DISADVANTAGES AND ADVANTAGES OVER MACRODROID WEBHOOK

  • It's not that secure - if someone knows what topic (url) you use they can send and observe your messages easily. There may be some changes to enhance privacy but for now it is as it is. I don't recommend sending any personal information.
  • If you want instant delivery you need to use another extra app.
  • Messages are cached only for 12 hours - I don't know how long MacroDroid server cache message, but propably longer, so if you send a message, some device that is not connected for longer than 12 hours may not receive a message

  • It's 'centralised' - This may sound like disadvantage, but what I mean is that you don't need to always have different URL for every other device. That means if you have 6 devices and need to send some information to every one of them you don't need to send HTTP GET 5 times, but just 1 message.
  • Doesn't require Google Play services - If you will just poll for new messages with curl every 5 minutes or so, you won't need Google Play services. If you want instant delivery, you need to use app.
  • It has a lot of extra features to discover!

These are of course not all advantages and disadvantages. You may also find your own.
 
Last edited:

tanutanu

Well-known member
Try using shell script action.
Android standard shell has no curl unfortunately. However, OP should use http get action for getting messages, and plugins such as Termux or HTTP shortcuts for sending alternatively, I don't test it though;)
The "toybox" command returns the full command list of Toybox on a terminal emulator(or even Shell script action on MD).
 

FrameXX

Well-known member
Android standard shell has no curl unfortunately. However, OP should use http get action for getting messages, and plugins such as Termux or HTTP shortcuts for sending alternatively, I don't test it though;)
The "toybox" command returns the full command list of Toybox on a terminal emulator(or even Shell script action on MD).
MacroDroid does and can perform curl commands throught shell. It works for me perfectly.
 

dsnz

Well-known member
curl should generally be equivalent to http get (unless post is is used in your code)
I suggest that you experiment and find out what options are missing from MD http get so that it has same functionality with your curl call and propose respective enhancement(s) to @MacroDroidDev
 

tanutanu

Well-known member
With -d(--data) option, curl implicitly works as POST method unfortunately:(
I expect MD http get action will be improved supporting both GET and POST like the other plugins in a future update. It is impossible to handle a JSON structure without the plugins currently.
 
Top