Email body - Mustache template with conditions

I need to adapt the content of my watcher email based on a variable. In other words, I need to do a 'IF ELSE" statement in the email template. Is-it possible ?

The definition of the watcher :

{
...
"trigger": {
"schedule": {
"interval": "1m"
}
},
"input": {
...
},
"transform": {
"script": {
"lang": "groovy",
"stored": "my_stored_script"
}
},
"actions": {
"notify": {
"condition": {
"compare": {
"ctx.payload.notify": {
"eq": true
}
}
},
"email": {
"profile": "outlook",
"account": "exchange_account",
"to": "{{ctx.payload.destinataire}}",
"subject": "Subject",
"body": {
"html": "{{#ctx.payload.endOfProblem}}End of problem{{/ctx.payload.endOfProblem}} {{#ctx.payload.newProblem}}New problem has been detected{{/ctx.payload.newProblem}}"
},
"priority": "high"
}
}
}
}

Version of Elasticsearch : 5.1.2

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