Help me to streamline this script/automation

I use SMTP notification service to send emails to an email address that ultimately ends up sending me a SMS/text message. Like many mobile companies my phone has an email address. Easiest way to get text messages. It works well, and I use it in a lot of my automations. I’m a fan of notifications.

I also added an input boolean for my wife and for myself that I can use to turn notifications on/off when I dont want to get notified.

At the end of the day I feel like I’m not really optimizing this process, and would to see if there are ways to reduce the amount of repeated yaml.

So here is the script I use

sms_notify_with_images:
  alias: SMS Notify with Images
  sequence:
  - condition: template
    value_template: "{{ condition }}"
  - service_template: "{{ service }}"
    data_template:
      title: "{{ title }}"
      message: "{{ message }}"
      data:
        images:
          - "{{ imagename }}"

An here is an example of the automation where I notify both my wife and myself

  - service: script.sms_notify_with_images
    data_template:
      service: notify.sms_paul
      condition: "{{ is_state('input_boolean.notify_paul','on') }}"
      title: "Front Door Motion"
      message: "{{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }} on {{ now().strftime('%d %b %Y') }}"
      imagename: "/tmp/frontdoor.jpg"
  - service: script.sms_notify_with_images
    data_template:
      service: notify.sms_tracy
      condition: "{{ is_state('input_boolean.notify_tracy','on') }}"
      title: "Front Door Motion"
      message: "{{ as_timestamp (now()) | timestamp_custom('%I:%M %p') }} on {{ now().strftime('%d %b %Y') }}"
      imagename: "/tmp/frontdoor.jpg"

It’s all working now, just seems like it should be able to be streamlined.

Any tips?

Looks pretty good to me - I don’t think you can do much to get it more condensed. I would have set it up just like you did.