Best way to handle REPLY actions?

Hm. I think I figured it out.

For someone else wanting to do this. Apparently, you can send really any data attribute to the android app and on a reply, it will reply also with that data. Example:

service: notify.phone_notifications
data:
  title: Human Detected @ Door
  message: Someones at the door.
  data:
    image: '{{ lasturl }}'
    tag: Doorbell-general
    group: General
    timeout: 180
    channel: General
    ttl: 0
    priority: high
    id: front-door-motion-snooze
    actions:
      - action: URI
        title: Live
        uri: '{{ linkurl }}'
      - action: URI
        title: All Cameras
        uri: /my-home/cams
      - action: REPLY
        title: Snooze

If I send the ‘id: front-door-motion-snooze’, I can then listen for that in the event data on the reply. Easy.

  - platform: event
    event_type: mobile_app_notification_action
    event_data:
      action: REPLY
      id: front-door-motion-snooze

and an example event:

Event 15 fired 12:40 PM:
{
    "event_type": "mobile_app_notification_action",
    "data": {
        "image": "",
        "tag": "Doorbell-general",
        "group": "General",
        "timeout": "180",
        "channel": "General",
        "ttl": "0",
        "priority": "high",
        "id": "front-door-motion-snooze",
        "action_1_key": "URI",
        "action_1_title": "Live",
        "action_1_uri": "",
        "action_2_key": "URI",
        "action_2_title": "All Cameras",
        "action_2_uri": "/my-home/cams",
        "action_3_key": "REPLY",
        "action_3_title": "Snooze",
        "action_3_uri": "null",
        "message": "Someones at the door.",
        "title": "Human Detected @ Door",
        "reply_text": "6",
        "action": "REPLY",
        "device_id": "xxx"
    },
    "origin": "REMOTE",
    "time_fired": "2022-05-26T16:40:38.508916+00:00",
    "context": {
        "id": "xxx",
        "parent_id": null,
        "user_id": "xxx"
    }
}
1 Like