Skip to content

MacroDroid Integration

MacroDroid is a popular Android automation app that can trigger ZestSSH actions using the zestssh:// URL scheme. Unlike Tasker, MacroDroid uses the “Open Website” action to launch URLs, making setup straightforward.

MacroDroid opens a zestssh:// URL, which Android routes to ZestSSH. The app parses the URL parameters, validates the API key, connects to the target server, runs the command, and returns the result. All of this happens in the background — ZestSSH opens briefly to process the request and can return to the background afterward.

Before creating your MacroDroid macro, generate an API key in ZestSSH:

  1. Open ZestSSH and go to Settings > Automation > API Keys.
  2. Tap Generate New Key.
  3. Enter a label (e.g., “MacroDroid”).
  4. Optionally set an expiration date.
  5. Copy the generated key — you will need it for the URL.
  1. Open MacroDroid and tap Add Macro.
  2. Add Trigger: choose any trigger you want (time, event, NFC tag, widget button, etc.).
  3. Add Action: select Applications > Open Website / URL.
  4. Paste your zestssh:// URL in the URL field (see URL formats below).
  5. Important: uncheck “Use Built-in Browser”. This ensures the URL is handled by ZestSSH rather than opening in a web view.
  6. Save the macro.

Tap the play button on the macro to test it. ZestSSH should briefly appear, execute the command, and the result will be logged in ZestSSH’s automation history.

zestssh://execute?connection=LABEL&command=COMMAND&key=API_KEY

Optional parameters: timeout (seconds), grep (filter pattern), head (first N lines), tail (last N lines), callback (webhook URL).

zestssh://snippet?connection=LABEL&name=SNIPPET_NAME&key=API_KEY

Optional: var_VARNAME=value for snippet variables.

zestssh://batch?connections=LABEL1,LABEL2,LABEL3&command=COMMAND&key=API_KEY

Optional: parallel=true (default) or parallel=false, timeout, grep, head, tail, callback.

zestssh://connect?host=LABEL&key=API_KEY
zestssh://workflow?name=WORKFLOW_NAME&key=API_KEY

Or by ID: zestssh://workflow?id=WORKFLOW_UUID&key=API_KEY.

Trigger: Time trigger, every day at 7:00 AM. Action: Open Website / URL:

zestssh://execute?connection=production-web&command=uptime%20%26%26%20df%20-h%20%2F&key=YOUR_API_KEY

(URL-encoded: uptime && df -h /)

Trigger: MacroDroid widget button tap. Action: Open Website / URL:

zestssh://snippet?connection=docker-host&name=Restart%20Container&var_DOCKER=nginx-proxy&key=YOUR_API_KEY

Trigger: Any trigger of your choice. Action: Open Website / URL:

zestssh://batch?connections=web1,web2,db1&command=df%20-h%20%2F&parallel=true&key=YOUR_API_KEY

Trigger: NFC tag scan. Action: Open Website / URL:

zestssh://execute?connection=staging&command=cd%20%2Fapp%20%26%26%20git%20pull&callback=https%3A%2F%2Fhooks.slack.com%2Fservices%2FXXX&key=YOUR_API_KEY

Special characters in commands must be URL-encoded. Common encodings:

CharacterEncoded
space%20
/%2F
&%26
=%3D
|%7C

MacroDroid handles some encoding automatically, but if your command includes special characters and the macro fails, try encoding them manually.

The fastest way to get a correctly formatted URL is to use ZestSSH’s built-in Automation Wizard:

  1. Go to Settings > Automation > Automation Wizard.
  2. Walk through the steps: pick action, connection, command, filters.
  3. On the result screen, the wizard shows a dedicated MacroDroid card with step-by-step instructions and a ready-to-copy URL.
  • Use MacroDroid’s Constraint feature to limit when macros can fire (e.g., only when on Wi-Fi).
  • Combine with MacroDroid’s notification actions to display the automation result.
  • Keep API key URLs private — anyone with the URL and key can execute commands on your servers.
  • For complex multi-step operations, use a workflow URL instead of chaining multiple macros.