Watcher email html body passed as a stored script


I'd like to have my email action to retrieve the email body stored as a mustache script. Currently the email get sent with "mem-watch-warning" as a text instead of the html content stored in _scripts/mem-watch-warning.

Thanks for your help!

"actions": {
"send_mem_warning": {
"transform": {
"script": {
"lang": "painless",
"source": "def latest = ctx.payload.aggregations.minutes.buckets[-1]; return -> item.memory.value >= ctx.metadata.threshold).collect(Collectors.toList());"
"email": {
"profile": "standard",
"from": "",
"to": [
"subject": "Watcher Notification - HIGH MEMORY USAGE",
"body": {
"html": {
"id": "mem-watch-warning"

POST _scripts/mem-watch-warning
"script": {
"lang": "mustache",
"source": "

Nodes with HIGH MEMORY

Usage (above 60%):
  • "{{key}}" - Memory Usage is at {{memory.value}}
  • {{/ctx.payload._value}}


this is not possible currently, as the body is a TextTemplate object, but not a script, see

Feel free to open an enhancement issue in github for this though!


Hi Alex,

I appreciate you took the time to look at my request.
Thanks for your answer,


This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.