Notification special variable empty after action

Yogi

Member
Hi,
Just one week at MacroDroid solving little problems by reading the forum.
Now there is a problem I can't understand, so please help.

Trigger:
  • SMS
  • Notification Received (Macrodroid)
There a more triggers, but to keep it short:
Incoming SMS, getting the info number and text and put it into an notification with action button.
After pressing the action button of the notification with "action for the same macro"
I try to get the info from the notification which triggered.

All special variables are empty:

Screenshot_20231205-125101_sm.png

I gave the permissions via ADB for MD. Did I miss something important?

Thanks a lot,
Regards
Fritz
 

Dm114

Well-known member
Hi,
Just one week at MacroDroid solving little problems by reading the forum.
Now there is a problem I can't understand, so please help.

Trigger:
  • SMS
  • Notification Received (Macrodroid)
There a more triggers, but to keep it short:
Incoming SMS, getting the info number and text and put it into an notification with action button.
After pressing the action button of the notification with "action for the same macro"
I try to get the info from the notification which triggered.

All special variables are empty:

View attachment 7786

I gave the permissions via ADB for MD. Did I miss something important?

Thanks a lot,
Regards
Fritz
What do you really want to do? Would you like to send a Notification on SMS reception? If so, what for?

Anyway your test macro is wrong. Use Trigger Fired instead of Macro Invoked by in your If statement.
 

Yogi

Member
What do you really want to do? Would you like to send a Notification on SMS reception? If so, what for?

Anyway your test macro is wrong. Use Trigger Fired instead of Macro Invoked by in your If statement.
Yes, show a notification with the content of an SMS including time.

If the sms is worthy to keep I take the action on the notification which
calls the Macro where the SMS triggered and there it should write to
a log file.
else I swipe the notification so its gone.

The trigger "Macro invoked" was for the action button in the notification - otherwise
I don't see a possibility to know that the notification action has triggered. Am I wrong?
If the notification action is shown, it gets also triggerd in the "Trigger fired event with notification".

I don't get the point...

Edit:
If I get a notification initially the variables are filled as estimated via trigger notification received fired.
So my question is:
How to get the info of an macrodroid notification which has an action button?
Also could be of interest to get info of an notification without trigger received.
 
Last edited:

RSF

Well-known member
The problem is that those special notification variables (notification title/text/etc.) are set only for notification triggers. When your macro is triggered by your notification's button, those notification-specific variables aren't set...

What you might want to do is create a separate Action Block, and execute it from the button. You can pass parameters to an action block, so you could pass in the notification information and then log it in your Action Block.
  1. Create the Action Block first:
    1701889753291.png
  2. Then in your macro, configure your notification's button to pass the notification information to the Action Block:
    Screenshot 2023-12-06 11.15.40 AM.png

    1701890234323.png
 

Yogi

Member
The problem is that those special notification variables (notification title/text/etc.) are set only for notification triggers. When your macro is triggered by your notification's button, those notification-specific variables aren't set...

What you might want to do is create a separate Action Block, and execute it from the button. You can pass parameters to an action block, so you could pass in the notification information and then log it in your Action Block.
  1. Create the Action Block first:
    View attachment 7801
  2. Then in your macro, configure your notification's button to pass the notification information to the Action Block:
    View attachment 7802

    View attachment 7804
Thank you for your detailed response, very much appreciated.

Now that I know about the trigger we can do a workaround like you described.

Another question about MD notification and action buttons:
If I am right there is only one way to find out which action button has been pressed in the notification:
the macro name to put in the action notification. If so then if there are multiple actions in an notification
there have to be one macro for each action, right?

Thanks a lot,
Regards
Fritz
 

RSF

Well-known member
Not necessarily -- you could add an additional parameter to the action block, and set it to different values in the notification action's button specifications:

Action Block:
Screenshot 2023-12-07 10.14.51 AM.png

Notification action:
1701973020384.png
... with parameters...
Screenshot 2023-12-07 10.17.27 AM.png
 

Attachments

  • 1701972929988.png
    1701972929988.png
    34.8 KB · Views: 0
  • 1701973057869.png
    1701973057869.png
    25.3 KB · Views: 0

Yogi

Member
Not necessarily -- you could add an additional parameter to the action block, and set it to different values in the notification action's button specifications:

Action Block:
View attachment 7823

Notification action:
View attachment 7821
... with parameters...
View attachment 7824
Thanks, that helps.

If I see it correctly, it would be beneficial to assign a category to the "action blocks" (like the macros), the more "action blocks" the more confusing the selection becomes...

Regards
Fritz
 
  • Like
Reactions: RSF

Dm114

Well-known member
Thanks, that helps.

If I see it correctly, it would be beneficial to assign a category to the "action blocks" (like the macros), the more "action blocks" the more confusing the selection becomes...

Regards
Fritz
Not sure Dev will add the feature. I has been ask for a long time ago and I'm afraid it'll be a bit too complex to implement this feature now.

As a workaround, if you really have a great number of Action blocks, you could name each of them with a prefix such as 010-MyAB1, 020-AnotherAB2... or TIME-MyAB1, LOG-AnotherAB2... where numerical prefixes could represent a category (with subcategories like 011-..., 012-...) or self-explanatory alphabetical ones.
 

Yogi

Member
Not sure Dev will add the feature. I has been ask for a long time ago and I'm afraid it'll be a bit too complex to implement this feature now.

As a workaround, if you really have a great number of Action blocks, you could name each of them with a prefix such as 010-MyAB1, 020-AnotherAB2... or TIME-MyAB1, LOG-AnotherAB2... where numerical prefixes could represent a category (with subcategories like 011-..., 012-...) or self-explanatory alphabetical ones.
Nice idea!
Thanks
 
Top