Difference between revisions of "Trigger: Notification"
| Line 1: | Line 1: | ||
| − | = | + | <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> |
| − | + | ''' 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 | ||
| − | <pre | + | 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 | |
| − | <pre | + | 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_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+) | ||
| − | ''' | + | ''' Notes ''' |
| − | + | * 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 | ||
| − | ''' | + | ''' See Also ''' |
| + | |||
| + | * [[Action: Clear Notifications]] | ||
| + | * [[Action: Post Notification]] | ||
| + | * [[Constraint: Notification on Screen]] | ||
Revision as of 21:03, 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_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+)
Notes
- 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
See Also