How to send a telegram notification when a window is open, for all windows?

i have a simple automation. if front window is open, send message: “front window is open”
i have 10+ windows in the house: back/basement/attic/balcony/etc… how can i write just 1 automation instead of all 10 separate automation?
i believe this is the method, but it’s not english.

Change it to English with Google translate. Changing the text is not going to affect the structure of the template.

ok. will do. thanks!

so i got it working for open. it will let me know which window is opened as seen here:

alias: alert doors or windows open
description: ''
trigger:
  - platform: state
    entity_id: group.doors
    to: 'on'
condition: []
action:
  - service: notify.telegram
    data:
      message: >-
        The following door or window are opened! "{{ states |
        selectattr('entity_id', 'in', state_attr('group.doors','entity_id')) |
        selectattr('state','in',['on','open']) | list | map(attribute='name') |
        join(', ') }}"
mode: single

the reverse for closed, does not work. after the same window closes, i get an alert for status of all the windows. how do i get status just for the window or door that just closed?

alias: alert doors or windows close
description: ''
trigger:
  - platform: state
    entity_id: group.doors
    to: 'off'
condition: []
action:
  - service: notify.telegram
    data:
      message: >-
        The following door or window are closed! "{{ states |
        selectattr('entity_id', 'in', state_attr('group.doors','entity_id')) |
        selectattr('state','in',['off','closed']) | list | map(attribute='name')
        | join(', ') }}"
mode: single