Notification when users add items to shopping list via Siri

Issue: I cannot get automation to notify which user adds item to Shopping List via Siri.

Working: Automation which notifies when item added, to which list and by who - for manual entries only.
Working: iOS Shortcut to add items to Home Assistant Shopping List via Siri.
Working: Automation which notifies when item added via Siri or manually - not who added it.

Request: Please help me refine either Automation so I get notified of item, list and who added it. One notification whether it is manually added or via Siri.

I currently get what I need for manual item entry only.

I found a blueprint for notification in iOS HA Companion app when items are manually added to my ToDo Lists. This works great, notifying the list, item and user who added it. I added a condition so it only notifies for Shopping List items (Automation 1 below).

alias: Shopping List - new item
description: New items added
triggers:
  - event_type: call_service
    event_data:
      domain: todo
      service: add_item
    trigger: event
conditions:
  - condition: template
    value_template: "{{ list_name == 'Shopping List' }}"
actions:
  - data:
      title: List Updated
      message: "{{ item }} was just added to the {{ list_name }} by {{ user_name }}."
    action: notify.mobile_app_sams_iphone
  - data:
      title: List Updated
      message: "{{ item }} was just added to the {{ list_name }} by {{ user_name }}."
    action: notify.mobile_app_felices_iphone
variables:
  list_name: >
    {{ state_attr((trigger.event.data.service_data.entity_id)[0],
    'friendly_name') }}
  item: "{{ trigger.event.data.service_data.item | title }}"
  user_name: >
    {% set uid = trigger.event.context.user_id %} {% set user = None %} {% set
    matching_users = states.person | selectattr('attributes.user_id', '==', uid)
    | list %} {% set user = matching_users | first if matching_users | length >
    0 else 'System' %} {{ user if user == 'System' else
    state_attr(user.entity_id, 'friendly_name') }}
mode: single

I am using an iOS shortcut to add items to my Shopping List via Siri. The solution provided by SeanM here Add item to shopping list using Siri on AppleWatch - Mobile Apps / Home Assistant Companion for Apple - Home Assistant Community worked for me.

I simplified the shortcut using Text:Call Service with data:Speak text This adds item to list via Siri and gives verbal and text prompt and notification of completion.

I have managed to cobble together an automation to notify in HA Companion app when Siri adds something to Shopping List but I can’t get it to state which user added the item (Automation 2 below).

alias: Siri or Manual Shopping List Update - Last try
description: Notify when an item is added to the shopping list via Siri or manually
triggers:
  - event_type: shopping_list_updated
    trigger: event
conditions:
  - condition: template
    value_template: "{{ trigger.event.data.action == 'add' }}"
actions:
  - data:
      title: Shopping List News!
      message: "{{ item }} was just added to the {{ list_name }} by {{ user_name }}."
    action: notify.mobile_app_sams_iphone
  - data:
      title: Shopping List News!
      message: "{{ item }} was just added to the {{ list_name }} by {{ user_name }}."
    action: notify.mobile_app_felices_iphone
variables:
  list_name: Shopping List
  item: "{{ trigger.event.data.item.name | title }}"
  user_name: >
    {% set uid = trigger.event.context.user_id %} {% set user = None %} {% set
    matching_users = states.person | selectattr('attributes.user_id', '==', uid)
    | list %} {% set user = matching_users | first if matching_users | length >
    0 else 'System' %} {{ user if user == 'System' else
    state_attr(user.entity_id, 'friendly_name') }}
mode: single

I spent hours going in circles with Copilot failing to resolve User_id. For every iteration of the Yaml, result was user defaulted to “System”, “None” or “Unknown”. There are only two users, it shouldn’t be so hard to work out which one added an item! This is probably more a reflection of my competence and what I get for asking Copilot before the HA community.