# Automation triggers

Use a trigger to start a shortcut automatically. Add one `triggers:` block above the actions. List the events with fixed values, not variables or conditions. Any listed event can run the same actions.

This example locks the screen when you close an iPhone Duo:

```shortcuty
shortcut:
  triggers:
    iphone.closed()
  device.lock_screen()
```

Shortcuty Script supports the Duo’s **close** event only. It does not offer an open or either-event option. See [iPhone Duo Auto Lock](https://browse.shortcuty.app/shortcut/26e88269-7d82-4125-a833-3623e47055d9) for a shared example.

After importing, review the trigger and choose when it should run in Apple Shortcuts. Exporting does not install or enable the automation. Test it on the device you plan to use.

Other examples:

```shortcuty
shortcut:
  triggers:
    battery(level: 25, comparison: "falls_below")
    charger(event: "disconnect")
  notify("Check your battery")
```

```shortcuty
shortcut:
  triggers:
    app(apps: ["com.apple.mobilesafari"], event: "opened")
    wifi(networks: ["Example Wi-Fi"], event: "joined")
    screenshot(locations: ["photos"])
  comment("Actions for any of these configured events")
```

For apps, use the bundle ID (such as `com.apple.mobilesafari`), not the display name. For Wi-Fi, use the exact network name.

`time_of_day(at: "2001-01-01T08:30:00Z")` sets a daily trigger using a UTC timestamp. It may display a different local time; confirm it in Shortcuts. `sunrise()` and `sunset()` also repeat daily.

## Imported triggers

Some imported triggers have a `preserving "…"` suffix or a `preserve("…")` line. Keep these when editing unrelated actions so Shortcuts retains the original trigger settings. Imports with more than 64 triggers retain those settings without listing the triggers in source.

To remove all triggers, use `triggers:` with an indented `pass`. Omitting the block keeps any triggers from the original shortcut.


## Current trigger calls

### time_of_day

Depends on target platform, device and selected resources. Not device-execution verified.
Daily native NSDate trigger. at is an explicit UTC timestamp, not a portable local HH:MM; the target calendar/time zone controls the displayed time. Confirm the time in Apple Shortcuts.
- at: Date (required)

### wifi

Depends on target platform, device and selected resources. Not device-execution verified.
Native parameter states verified without running an automation. Review device-specific behavior and activation after import.
- networks: TextSelection (required)
- event: Text (optional); choices ["joined", "disconnected", "both"]; native default "joined"
- after_interruption: Boolean (optional); native default false

### stage_manager

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- state: Text (optional); choices ["off", "both", "on"]; native default "on"

### display

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- event: Text (optional); choices ["connect", "disconnect", "both"]; native default "connect"

### app

Depends on target platform, device and selected resources. Not device-execution verified.
Native parameter states verified without running an automation. Review device-specific behavior and activation after import.
- apps: Apps (required)
- event: Text (optional); choices ["opened", "closed", "both"]; native default "opened"

### screenshot

Depends on target platform, device and selected resources. Not device-execution verified.
Native parameter states verified without running an automation. Review device-specific behavior and activation after import.
- locations: TextSelection (optional); choices ["files", "clipboard", "photos"]; native default ["photos", "files", "clipboard"]

### notification_received

Depends on target platform, device and selected resources. Not device-execution verified.
Native app selection verified. No title/body/sender filter authoring is claimed; empty default filter behavior still requires target-device testing.
- apps: Apps (required)

### airplane_mode

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- state: Text (optional); choices ["off", "both", "on"]; native default "on"

### battery

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- level: Number (required); native default 50
- comparison: Text (optional); choices ["falls_below", "equals", "rises_above"]; native default "equals"

### carplay

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- event: Text (optional); choices ["connect", "disconnect", "both"]; native default "connect"

### low_power_mode

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- state: Text (optional); choices ["off", "both", "on"]; native default "on"

### charger

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- event: Text (optional); choices ["connect", "disconnect", "both"]; native default "connect"

### sleep

Depends on target platform, device and selected resources. Not device-execution verified.
Verified native parameter definitions and materialized state shapes; review activation and permissions on the target device.
- event: Text (optional); choices ["bedtime", "wind_down", "wake_up"]; native default "wind_down"

### iphone.closed

iPhone Duo; Apple documents Opened or Closed automation in iOS27.2. Fixture-backed encoding; not run on a physical Duo.
Closed only. ModeB comes from the exact shared close-trigger fixture, not from inference about multitasking modes. Opened/either encodings are not verified.

### sunrise

Target device needs supported time automation and location access; daily native recurrence.
Review device location, local schedule and activation in Apple Shortcuts.
- offset: Text (optional); choices ["1_hour_after", "at_time", "1_hour_before", "4_hours_before", "4_hours_after", "3_hours_after", "30_mins_before", "3_hours_before", "15_mins_before", "15_mins_after", "30_mins_after", "45_mins_before", "2_hours_before", "2_hours_after", "45_mins_after"]; native default "at_time"

### sunset

Target device needs supported time automation and location access; daily native recurrence.
Review device location, local schedule and activation in Apple Shortcuts.
- offset: Text (optional); choices ["1_hour_after", "at_time", "1_hour_before", "4_hours_before", "4_hours_after", "3_hours_after", "30_mins_before", "3_hours_before", "15_mins_before", "15_mins_after", "30_mins_after", "45_mins_before", "2_hours_before", "2_hours_after", "45_mins_after"]; native default "at_time"

### keyboard

Supported iPhone/iPad keyboard automation; availability depends on target device and OS.
Native connect/disconnect/both states verified without activation or device execution.
- event: Text (optional); choices ["connect", "disconnect", "both"]; native default "connect"

## Other native triggers

Preservation-only in this release: WFAlarmTrigger, WFEmailTrigger, WFMessageTrigger, WFFolderTrigger, WFFileTrigger, WFDiskMountTrigger, WFBluetoothTrigger, WFUserFocusActivityTrigger, WFNFCTrigger, WFWorkoutTrigger, WFArriveLocationTrigger, WFLeaveLocationTrigger, WFSoundRecognitionTrigger, WFWalletTransactionTrigger.
Their identities or selection encodings are not verified for complete new authoring. Import keeps their native data; do not invent parameters or silently replace the requested event.
