Hey everyone. I appear to be having a problem with actionable notifications on Android. I have a set of automations set up to help track work interruptions. The flow is pretty much toggling of input_boolean states and then logging some information to a google sheet.
My notification includes two buttons on Android, see below:
- action: notify.mobile_app_xxxx
metadata: {}
data:
title: Log Interruption
message: ""
data:
actions:
- action: Interrupted
title: Interrupt
behavior: textInput
- action: Task
title: Task
behavior: textInput
When I send the result back, I have another automation that picks up on the response and appends to the google sheet. However, I am finding that when referencing “trigger.event.data.action”, I always receive “task” regardless of which action I select.
state: "{{ trigger.event.data.action }}"
start_time: >-
{{
as_local(states.input_boolean.xxxx_work_interrupted.last_changed).strftime('%H:%M:%S')}}
end_time: "{{ now().strftime('%H:%M:%S') }}"
comment: "{{ trigger.event.data.reply_text }}"
When I forced the code to fail by appending trigger.event.data to the sheet instead, I was able to see what data I receive in the request based on the error response (This is from when I selected interrupted):
gspread.exceptions.APIError: {'code': 400, 'message': 'Invalid values[25][1]: struct_value {\n fields {\n key: "action"\n value {\n string_value: "Task"\n }\n }\n fields {\n key: "action_1_behavior"\n value {\n string_value: "textInput"\n }\n }\n fields {\n key: "action_1_key"\n value {\n string_value: "Interrupted"\n }\n }\n fields {\n key: "action_1_title"\n value {\n string_value: "Interrupt"\n }\n }\n fields {\n key: "action_2_behavior"\n value {\n string_value: "textInput"\n }\n }\n fields {\n key: "action_2_key"\n value {\n string_value: "Task"\n }\n }\n fields {\n key: "action_2_title"\n value {\n string_value: "Task"\n }\n }\n fields {\n key: "device_id"\n value {\n string_value: "218b1ce8ef45c648"\n }\n }\n fields {\n key: "reply_text"\n value {\n string_value: "Fff"\n }\n }\n fields {\n key: "server_id"\n value {\n string_value: "2"\n }\n }\n fields {\n key: "title"\n value {\n string_value: "Log Interruption"\n }\n }\n fields {\n key: "webhook_id"\n value {\n string_value: "946de070348686ce222d9d93f73e10ff4f31fdf8d0fd66d38e38a8c5130b5019"\n }\n }\n}\n', 'status': 'INVALID_ARGUMENT'}
Any thoughts would be greatly appreciated. I’m not sure what I am doing wrong, but the documentation describes using action as a reference for determining how to process a returned request when using textInput as a behavior, so I am quite lost on how this is happening.