Difference between revisions of "Trigger: Notification"

(Created page with "This trigger will fire when a notification is received. You can add additional filters based on the application the notification has come from and the content of the notificat...")
 
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
This trigger will fire when a notification is received. You can add additional filters based on the application the notification has come from and the content of the notification text.
+
<pre class="header-style">The Notification trigger fires when a notification is received or cleared. You can add filters based on the application the notification came from and the content of the notification text. This is a powerful trigger that can be used to react to notifications from any app, enabling automation based on incoming alerts, messages, and other notification content.</pre>
  
By using this trigger in conjunction with the Speak Text action you can speak the incoming notification text.
+
''' Options '''
 +
 
 +
''' Trigger Event '''
 +
 
 +
* '''Notification Received''' - Fires when a new notification is posted
 +
* '''Notification Cleared''' - Fires when a notification is dismissed or cleared
 +
 
 +
''' Application Selection '''
 +
 
 +
* '''Select Applications''' - Choose specific applications to monitor
 +
* '''Any Application''' - React to notifications from all installed apps
 +
 
 +
When selecting specific applications, you can also choose to:
 +
* '''Include''' - Only trigger for the selected apps
 +
* '''Exclude''' - Trigger for all apps EXCEPT the selected ones
 +
 
 +
''' Text Filtering '''
 +
 
 +
You can filter notifications based on their text content:
 +
 
 +
''Single Field Mode:''
 +
* '''Any text''' - Match any notification regardless of content
 +
* '''Matches''' - The notification text must exactly match the specified text (supports regex)
 +
* '''Contains''' - The notification text must contain the specified text
 +
* '''Excludes''' - The notification text must NOT contain the specified text
 +
 
 +
''Separate Title and Message Mode:''
 +
Enable "Separate title and message" to filter on title and message independently with the same options above.
 +
 
 +
''' Advanced Options '''
 +
 
 +
* '''Enable regular expression matching''' - Use regex syntax for pattern matching
 +
* '''Ignore case''' - Perform case-insensitive matching (disabled when regex is enabled)
 +
* '''Ignore ongoing/persistent notifications''' - Do not trigger for persistent notifications (like media players or ongoing calls)
 +
* '''Prevent multiple triggers''' - Prevents the trigger from firing multiple times when apps post rapid notification updates within fractions of a second
 +
 
 +
''' Sound Options '''
 +
 
 +
Filter by notification sound:
 +
* '''Any value''' - Ignore sound status
 +
* '''Has sound''' - Only trigger for notifications that have a sound
 +
* '''Has no sound''' - Only trigger for silent notifications
 +
 
 +
''' Examples '''
 +
 
 +
''Example 1: Speak incoming text messages''
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Notification Received: Messages app</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Speak Text: New message from {not_title}. {notification}</pre>
 +
  <pre class="constraint-style">Constraints
 +
 
 +
Headphones: Connected</pre>
 +
 
 +
''Example 2: Log error notifications''
 +
 
 +
  <pre class="trigger-style">Triggers
 +
 
 +
Notification Received: Any Application (contains "error")</pre>
 +
  <pre class="action-style">Actions
 +
 
 +
Write to File: error_log.txt - {not_app_name}: {notification}</pre>
 +
 
 +
''' Available Magic Text '''
 +
 
 +
When using this trigger, the following magic text values are available:
 +
* {notification} - The full notification text
 +
* {not_title} - The notification title
 +
* {not_app_name} - The name of the app that posted the notification
 +
* {not_app_package} - The package name of the app
 +
* {not_text_big} - Extended notification text (if available)
 +
* {not_channel} - The notification channel ID (Android 8.0+)
 +
 
 +
''' Notes '''
 +
 
 +
* This trigger requires Notification Access permission to be granted to MacroDroid
 +
* On Android 15+, there may be restrictions on accessing notification content
 +
* The "Prevent multiple triggers" option is useful for apps that update notifications frequently (like download progress notifications)
 +
* Magic text allows you to use notification content in your actions
 +
* Both the notification title and body text are searched when using text filters
 +
 
 +
''' See Also '''
 +
 
 +
* [[Action: Clear Notifications]]
 +
* [[Action: Display Notification]]
 +
* [[Constraint: Notification Present]]

Latest revision as of 21:07, 6 January 2026

The Notification trigger fires when a notification is received or cleared. You can add filters based on the application the notification came from and the content of the notification text. This is a powerful trigger that can be used to react to notifications from any app, enabling automation based on incoming alerts, messages, and other notification content.

Options

Trigger Event

  • Notification Received - Fires when a new notification is posted
  • Notification Cleared - Fires when a notification is dismissed or cleared

Application Selection

  • Select Applications - Choose specific applications to monitor
  • Any Application - React to notifications from all installed apps

When selecting specific applications, you can also choose to:

  • Include - Only trigger for the selected apps
  • Exclude - Trigger for all apps EXCEPT the selected ones

Text Filtering

You can filter notifications based on their text content:

Single Field Mode:

  • Any text - Match any notification regardless of content
  • Matches - The notification text must exactly match the specified text (supports regex)
  • Contains - The notification text must contain the specified text
  • Excludes - The notification text must NOT contain the specified text

Separate Title and Message Mode: Enable "Separate title and message" to filter on title and message independently with the same options above.

Advanced Options

  • Enable regular expression matching - Use regex syntax for pattern matching
  • Ignore case - Perform case-insensitive matching (disabled when regex is enabled)
  • Ignore ongoing/persistent notifications - Do not trigger for persistent notifications (like media players or ongoing calls)
  • Prevent multiple triggers - Prevents the trigger from firing multiple times when apps post rapid notification updates within fractions of a second

Sound Options

Filter by notification sound:

  • Any value - Ignore sound status
  • Has sound - Only trigger for notifications that have a sound
  • Has no sound - Only trigger for silent notifications

Examples

Example 1: Speak incoming text messages

Triggers

Notification Received: Messages app
Actions

Speak Text: New message from {not_title}. {notification}
Constraints

Headphones: Connected

Example 2: Log error notifications

Triggers

Notification Received: Any Application (contains "error")
Actions

Write to File: error_log.txt - {not_app_name}: {notification}

Available Magic Text

When using this trigger, the following magic text values are available:

  • {notification} - The full notification text
  • {not_title} - The notification title
  • {not_app_name} - The name of the app that posted the notification
  • {not_app_package} - The package name of the app
  • {not_text_big} - Extended notification text (if available)
  • {not_channel} - The notification channel ID (Android 8.0+)

Notes

  • This trigger requires Notification Access permission to be granted to MacroDroid
  • On Android 15+, there may be restrictions on accessing notification content
  • The "Prevent multiple triggers" option is useful for apps that update notifications frequently (like download progress notifications)
  • Magic text allows you to use notification content in your actions
  • Both the notification title and body text are searched when using text filters

See Also