Home API Documentation FAQ Articles Buy PLUS Releases Contacts

← Back to Articles

Intent Sending Handlers

Intent sending handlers are a feature that allows the server to send Android intents to other apps in response to certain HTTP requests. This option is for advanced users. It enables, among other things, running scripts in popular Android automation apps such as Tasker, Automate, Macrodroid, and similar.

Enabling the feature

Intent sending handlers are enabled by checking the corresponding checkbox in the Handlers section of the app settings. When you enable it, an additional configuration screen opens where you define how HTTP requests are mapped to intents.

Intent Sending Handlers - Enabling the feature
Intent Sending Handlers - Enabling the feature

Configuration screen

On the configuration screen you can set:

  • URL path prefix — A prefix for the URL path. Only requests whose path starts with this prefix are considered for intent sending. This keeps intent handlers separate from your file serving or other routes.
  • List of handlers — A list of individual handlers. Each handler matches a specific path (under the prefix) and defines which intent to send.

Handler options

For each handler you can configure:

  • Path — The path (relative to the prefix) that triggers this handler. For example, if the prefix is /intent and the path is /open, then the handler will be triggered by requests to /intent/open.
  • Intent target — How the intent is delivered: broadcast, ordered broadcast, service, or activity.
  • Action — The intent action string.
  • Category — Intent category (optional).
  • Package name — The target app package; you can select from a list of installed applications (optional).
  • Class name — The target component class (optional).
  • Data URI — Intent data URI (optional).
  • MIME type — Data MIME type (optional).
  • Flags — Intent flags.
  • Extra data — Key-value extras to attach to the intent.

You can check the Android Intent documentation for more information about the options.

Example

Let's say you want to trigger a specific macros in Macrodroid when a user visits /intent/macrodroid. You can configure the handler as follows:

  • URL path prefix/intent
  • Path/macrodroid
  • Intent targetBroadcast
  • Package name — select the Macrodroid app from the list
  • Action — lets name it "run_my_macro"

You also need to create a macro in Macrodroid. Under "Triggers" add a new trigger and search for "intent" word so you can find "Intent Received" trigger. Input the action name you configured in the handler (e.g. "run_my_macro") and save the trigger. Under "Actions" select an action you whould like from the Macrodroid's action list and save the macro. Now, when a user visits /intent/macrodroid, the Macrodroid app will be launched in background and the "run_my_macro" macro will be executed.

Note that Macrodroid has a built-in "HTTP Server Request" trigger so if all you need is to trigger a macro when a user visits a specific URL, you can use the built-in Macrodroid's functionality.

Intent Sending Handlers - Example
Intent Sending Handlers - Example

Intent extra data

You can also add extra data to the intent. This is useful if you want to pass data to the target app. For example, if you want to pass a specific value to the Macrodroid app, you can add it to the extra data. The extra data is a list of key-value pairs.

There are possibility to predefine extra data by providing exact key and value as well as to provide a placeholder for the value (in a form of :param_name) that will be replaced with the actual value from get request parameters (e.g. /intent/macrodroid?param1=value1&param2=value2).

Ordered broadcasts

Ordered broadcasts can return a result to the sender. This is useful if you want to get a response from the target app. Unfortunately, most known automation programs cannot return the result of Ordered Broadcasts, but if you want to implement this in your own application, remember that SHTTPS will interpret the result returned as the "data" of the Ordered Broadcast as the body of the HTTP response, the broadcast result code as the HTTP response code, and extra data from the broadcast result as HTTP response headers.