Expose esphome script to hass.io

what is the official way of exposing a script on esphome to hass.io UI, so that it can be triggered by a button?

Ran across this problem today. You should be using a “user-defined-service” instead of a script.