Setup notification from multiple groups

I have 3 groups which are door, window and garage. I am able to get notifications when I add a single group but not when I use multiple groups.

Please review code below rather not setup separate notifications for each group.

service: notify.mobile_app_my_iphone
data:
  title: Door or Window was opened
  message: >-
    This was opened: {{ expand('binary_sensor.door_group',
    'binary_sensor.windows_group', 'cover.garage_doors')
       | selectattr('state', 'eq', 'on') 
       | map(attribute='name') 
       | list 
       | join (', ')
    }}