Customize Notification Payloads

Custom JSON payloads in Metricly support FreeMarker writeup. This page contains a list of examples for you to reference when creating your own notification payloads for emails, SNS, and webhooks.

JSON Variables Available in Metricly

Variable Description
${} The description of the event as a policy violation.
${} The ID of the event
${} The event category ( (Info), (Warning), or (Critical)).
${elementFqn} The Fully Qualified Name (FQN) of the element.
${elementId} The type of element (e.g., SERVER, ELB, EC2, RDS, etc.).
${elementType} The type of element (e.g, SERVER, ELB, RUBY, etc.)
${elementLocation} The location of the element.
${elementName} The friendly name for the element.
${policyId} The policy identification number.
${policyName} The name of the policy.
${eventTimestamp} The time (in UTC) the event occurred.
${policyDescription} The description of the policy that generated the event.

Escaping JSON With Freemarker

Use the official FreeMarker documentation on escaping for an in-depth look on various escaping rules. Note that escaping does not work for ', only " and >. If you do not properly escape your FreeMarker, you may not receive notifications. Remember to test any custom payloads that you create.


  "icon": "",
  "activity": "Metricly Alerts",
  "title": "${policyName}",
  "body": "Category: ${}\nElement: ${elementName}\nDescription: ${policyDescription?json_string}\nEventData: <#if><#if><#assign results =><#if results.conditions??><#list results.conditions as condition><#if condition?counter <= 5>${condition.expression}</#if></#list></#if></#if></#if>"