Automation door alarm use template

Hi, I created an automation that if door is open, there will be a notification to the app that repeats until the door is closed or outside the set time, but I am getting an error which I don’t understand.
This is my automation:

alias: alarm door
description: alarm door
trigger:
  - platform: state
    entity_id: binary_sensor.group_door_sensor_at_night
    from: 'off'
    to: 'on'
  - platform: time
    at: '23:45:00'
condition: []
action:
  - repeat:
      while:
        - condition: state
          entity_id: binary_sensor.group_door_sensor_at_night
          state: 'on'
        - condition: time
          before: '05:00:00'
          after: '23:30:00'
sequence:
  - service: notify.mobile_app_iphone
    data_template:
      title: Doors Open!
      message: >
        {% set open_doors = states | selectattr('entity_id', 'in',
        state_attr('binary_sensor.group_door_sensor_at_night','entity_id')) |
        selectattr('state','in',['on','open']) | map(attribute='name') | list %}
        {% if open_doors | length == 1 %}
          The {{ open_doors[0] }} door is open.
        {% else %}
          The {{ open_doors[:-1] | join(' door, ') }}{{' door,' if open_doors | length > 2 else ' door'}} and {{ open_doors[-1]}} door are open.
        {% endif %}
  - delay:
            hours: 0
            minutes: 0
            seconds: 10
            milliseconds: 0
mode: single

This is the error:
-Message malformed: required key not provided @ data[‘action’][0][‘repeat’][‘sequence’]
Can anyone please advise on where my automation has gone wrong?

This tells you to look at the first action (starts at zero) in your automation. At the repeat and then what’s in the sequence.

The repeat must have a squence. So if you want to repeat those notifications, they need to be part of the repeat. Notice the indentitions in mine vs yours.

alias: alarm door
description: alarm door
trigger:
  - platform: state
    entity_id: binary_sensor.group_door_sensor_at_night
    from: 'off'
    to: 'on'
  - platform: time
    at: '23:45:00'
condition: []
action:
  - repeat:
      while:
        - condition: state
          entity_id: binary_sensor.group_door_sensor_at_night
          state: 'on'
        - condition: time
          before: '05:00:00'
          after: '23:30:00'
      sequence:
        - service: notify.mobile_app_iphone
          data_template:
            title: Doors Open!
            message: >
              {% set open_doors = states | selectattr('entity_id', 'in',
              state_attr('binary_sensor.group_door_sensor_at_night','entity_id')) |
              selectattr('state','in',['on','open']) | map(attribute='name') | list %}
              {% if open_doors | length == 1 %}
                The {{ open_doors[0] }} door is open.
              {% else %}
                The {{ open_doors[:-1] | join(' door, ') }}{{' door,' if open_doors | length > 2 else ' door'}} and {{ open_doors[-1]}} door are open.
              {% endif %}
        - delay:
            hours: 0
            minutes: 0
            seconds: 10
            milliseconds: 0
mode: single

Thank calisro Rob, now i understand