Data-Dependent SMTP alert with Topics

I am interested in customizing CPU utilization alerts (e.g.) in two ways:

(1) There are different messages for transitions to CRITICAL and OK
(2) The to field is derived from a user tag my TICKscript is grouping by

Is it possible to do both?

I can get (1) using alert topics, but AFAIK I have to hard-code the to field in the yaml specification. I can get (2) using an inlined smtp alert handler, but then I lose the message customization on the type of transition.

I’m open to any/all solutions.