How to use custom trigger variables in the raised alert messages to know triggered condition details

I am raising an alert for my API having more than 2ms responseTime. This is my trigger condition :
for (int i = 0; i < ctx.results[0].hits.hits.length; i++) {
if(2 < ctx.results[0].hits.hits[i]._source.responseTime) {
score = true;
} else {
score = false;
return score;

I am trying to send the message with the specific details of my source with the API url and response time, something like below just for all raised alerts(how do we ensure that):

Monitor {{}} just entered alert status. Please investigate the issue.

  • API Url : {{ctx.results.0.hits.hits.0._source.msg}} and response time {{ctx.results.0.hits.hits.0._source.responseTime}}but i need details only for raised alerts - as this will work on whole extraction query response
  • Trigger: {{}}
  • Severity: {{ctx.trigger.severity}}

Someone please help.

Hi @kunalsingh,

Can you move this logic outside of the trigger and into the monitor itself?
i.e. the monitor query is the one that finds all hits with responeTime > 2 and then your trigger and action can just be “dumb” and rely on hits > 0 and show all.