| Line 1: |
Line 1: |
| − | ===<p><b>About</b></p>=== | + | <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> |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''' Options ''' |
| − | This trigger will be activated when a notification is received or deleted.
| |
| − | You can add additional filters based on the application the notification came from and the content of the notification text.
| |
| | | | |
| − | The prevent multiple triggers option can be used in situations where multiple rapid notification updates occur (more than one in a fraction of a second). For example an app may receive a push notification (which is an incoming notification and will cause a trigger) and then immediately do something in the app to refresh that notification causing another trigger. By enabling this option on a single trigger will fire which in most situations is the desired behavior.
| + | ''' Trigger Event ''' |
| − | </pre>
| |
| | | | |
| − | ==<p><b>Supported configurations</b></p>==
| + | * '''Notification Received''' - Fires when a new notification is posted |
| | + | * '''Notification Cleared''' - Fires when a notification is dismissed or cleared |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''' Application Selection ''' |
| − | Both options (Received and cleared) share the same settings.
| |
| − | </pre>
| |
| | | | |
| − | === Application(s) ===
| + | * '''Select Applications''' - Choose specific applications to monitor |
| | + | * '''Any Application''' - React to notifications from all installed apps |
| | | | |
| − | * ''''' Select Application(s) ''''' | + | When selecting specific applications, you can also choose to: |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | * '''Include''' - Only trigger for the selected apps |
| − | Select one or more applications that will activate the trigger.
| + | * '''Exclude''' - Trigger for all apps EXCEPT the selected ones |
| − | </pre>
| |
| | | | |
| − | * ''''' Any Application '''''
| + | ''' Text Filtering ''' |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| |
| − | It will react to any installed application.
| |
| − | </pre>
| |
| | | | |
| − | === Filter ===
| + | You can filter notifications based on their text content: |
| | | | |
| − | * ''''' Any Application ''''' | + | ''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 |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''Separate Title and Message Mode:'' |
| − | It reacts to any content.
| + | Enable "Separate title and message" to filter on title and message independently with the same options above. |
| − | </pre>
| |
| | | | |
| − | * ''''' Matches '''''
| + | ''' Advanced Options ''' |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | * '''Enable regular expression matching''' - Use regex syntax for pattern matching |
| − | The text of the notification must match a regular expression (you must enable the "Enable regular expression matching" checkbox).
| + | * '''Ignore case''' - Perform case-insensitive matching (disabled when regex is enabled) |
| − | </pre>
| + | * '''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 |
| | | | |
| − | * ''''' Contains '''''
| + | ''' Sound Options ''' |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | Filter by notification sound: |
| − | The notification text must contain the text defined in the trigger or the content of a variable (only if I use magic text).
| + | * '''Any value''' - Ignore sound status |
| − | </pre>
| + | * '''Has sound''' - Only trigger for notifications that have a sound |
| | + | * '''Has no sound''' - Only trigger for silent notifications |
| | | | |
| − | * ''''' Excludes '''''
| + | ''' Examples ''' |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''Example 1: Speak incoming text messages'' |
| − | The notification text must not contain the text that is defined in the trigger or the content of a variable (only if I use magic text).
| |
| − | </pre>
| |
| | | | |
| − | === Checkbox === | + | <pre class="trigger-style">Triggers |
| | | | |
| − | * '''Enable regular expression matching'''
| + | Notification Received: Messages app</pre> |
| | + | <pre class="action-style">Actions |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | Speak Text: New message from {not_title}. {notification}</pre> |
| − | Regular expression matching (or regex matching) is a technique for finding patterns within text using a specialized syntax known as regular expressions. It's a powerful tool for text processing and pattern recognition.
| + | <pre class="constraint-style">Constraints |
| − | </pre>
| |
| | | | |
| − | * '''''Case insensitive'''''
| + | Headphones: Connected</pre> |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''Example 2: Log error notifications'' |
| − | It will ignore the use of upper and lower case in title and detail.
| |
| − | </pre>
| |
| | | | |
| − | * '''''Ignore ongoing notifications'''''
| + | <pre class="trigger-style">Triggers |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;"> | + | Notification Received: Any Application (contains "error")</pre> |
| − | Ignore all persistent notifications.
| + | <pre class="action-style">Actions |
| − | </pre>
| |
| | | | |
| − | * '''''Prevent multiple triggers'''''
| + | Write to File: error_log.txt - {not_app_name}: {notification}</pre> |
| | | | |
| − | <pre style="background-color: #ACC8E5; color: #112A46; border-radius: 10px; padding: 10px;">
| + | ''' Available Magic Text ''' |
| − | Can be used in situations where multiple rapid notification updates occur (more than one in a fraction of a second). For example an app may receive a push notification (which is an incoming notification and will cause a trigger) and then immediately do something in the app to refresh that notification causing another trigger. By enabling this option on a single trigger will fire which in most situations is the desired behavior.
| |
| − | </pre>
| |
| | | | |
| − | * '''''Notification Sound''''' | + | When using this trigger, the following magic text values are available: |
| | + | * [notification_text] - The full notification text |
| | + | * [notification_title] - The notification title |
| | + | * [notification_app] - The name of the app that posted the notification |
| | + | * [notification_package] - The package name of the app |
| | + | * [notification_big_text] - Extended notification text (if available) |
| | + | * [notification_channel] - The notification channel ID (Android 8.0+) |
| | | | |
| − | '''''- Any value''''' | + | ''' Notes ''' |
| | | | |
| − | '''''- Has sound'''''
| + | * This trigger requires Notification Access permission to be granted to MacroDroid |
| | + | * Minimum Android version: 4.1 (API 16) |
| | + | * 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 |
| | | | |
| − | '''''- Has no sound ''''' | + | ''' See Also ''' |
| | + | |
| | + | * [[Action: Clear Notifications]] |
| | + | * [[Action: Post Notification]] |
| | + | * [[Constraint: Notification on Screen]] |