Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support behavior: textInput key on notification action for reply actions #4763

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jpelgrom
Copy link
Member

@jpelgrom jpelgrom commented Oct 29, 2024

Summary

Fix #3503 by supporting the use of behavior: textInput on a notification action to trigger the reply action. This allows you to use the action key to differentiate the different actions, which is already possible on iOS.

Screenshots

n/a

Link to pull request in Documentation repository

Documentation: home-assistant/companion.home-assistant#1130

Any other notes

FCM changes: home-assistant/mobile-apps-fcm-push#170

cc @bgoncal

@bgoncal
Copy link
Member

bgoncal commented Oct 30, 2024

I dropped you a message in discord about this, maybe we should use "identifier" like:

action: notify.mobile_app_iphone_11
data:
  data:
    actions:
      - action: REPLY
        identifier: action-1
        title: Action 1
      - action: REPLY
        identifier: action-2
        title: Action 2
  message: Testing action

In iOS I can't access the action title easily, I would need to cache it somewhere else and using identifier to me makes more sense, then the user can even change the title of the action freely without having to change their automations trigger for example (since the ID will not change if they dont want to)

@jpelgrom
Copy link
Member Author

I'll see if it is perhaps easier for Android to also support behavior: textInput. That way it stays aligned between apps with no changes required on the iOS side and users can use the action key as the identifier as suggested in the docs.

 - Instead of adding a new key, allow using the behavior: textInput key which already works on iOS to trigger the reply notification action
@jpelgrom jpelgrom changed the title Include notification action title in event data for reply actions Support behavior: textInput key on notification action for reply actions Oct 30, 2024
@jpelgrom
Copy link
Member Author

Changed it so you can use behavior: textInput like iOS for this and use the action as the identifier:

action: notify.mobile_app_pixel_7a_dev
data:
  message: Test UnifiedPush 3a
  data:
    actions:
      - action: ONE
        title: Reply 1
        behavior: textInput
      - action: TWO
        title: Reply 2
        behavior: textInput

will generate the event:

event_type: mobile_app_notification_action
data:
  action_1_key: ONE
  action_1_title: Reply 1
  action_1_behavior: textInput
  action_2_key: TWO
  action_2_title: Reply 2
  action_2_behavior: textInput
  message: Test UnifiedPush 3a
  webhook_id: ...
  server_id: "9"
  reply_text: Which one is it?
  action: TWO
  ...
origin: REMOTE
time_fired: "2024-10-30T19:05:20.917447+00:00"
context:
  ...

Please approve again if you agree with this as a better solution or reply with a comment otherwise :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

A way to differentiate multiple REPLY actions
3 participants