Dimiss all persisted notifications script format?

HI,

found this Add "dismiss_all" function to persistent_notification service but the syntax won’t run like that in a script?

would this be a valid syntax for it?
dismissing all persistent notifications (that were made because of an error not yet found, but rendering the frontend unreachable…):

dismiss_all:
  sequence: 
    - service: persistent_notification.dismiss
      data_template:
        notification_id: >
          {%- for item in states.persistent_notification %}
          {{ item.entity_id|replace("persistent_notification.","") }}
          {% endfor %}