Skip to main content

Generic HTTPS message configuration in Notification Center

Supported payload types​

Each destination type has specific schema structures tailored to its supported payload types. For generic HTTPS, a default output type exists.

Payload typepayload_type API valueDescription
DefaultdefaultDefault payload type.

Default payload type​

UI labelAPI field nameTypeRequiredDescription
HeadersheadersKeyValuePairsfalseHTTP header to include in the request. Represents a JSON object where each key maps to a string value.
BodybodyJSONObjectfalseJSON object representing the body of the request.
Note

The message configuration should include only the notification content and details related to the event. Authentication and connection settings, such as API keys, should be defined in the connector configuration.

List each alert group on its own line​

An alert that groups by labels triggers one alert group per combination of values, for example one group per certificate, or per ECS cluster and service. Each group exposes its values in keyValues, a map from the group-by label name to its value. Printing alert.groups directly sends every group as a single compact value.

To send one line per group, build the text first, then place it in the body with json_encode:

{%- set NL = "
" -%}
{%- set_global groupsText = "" -%}
{%- for g in alert.groups -%}
{%- if groupsText -%}{%- set_global groupsText = groupsText ~ NL -%}{%- endif -%}
{%- for key, value in g.keyValues -%}
{%- set_global groupsText = groupsText ~ key ~ ": " ~ value -%}
{%- if not loop.last -%}{%- set_global groupsText = groupsText ~ ", " -%}{%- endif -%}
{%- endfor -%}
{%- endfor -%}
{
"alert": {{ alertDef.name | json_encode }},
"status": {{ alert.status | json_encode }},
"groups": {{ groupsText | json_encode }}
}

For an alert grouped by ClusterName and ServiceName, groups renders one line per group, such as ClusterName: prod, ServiceName: checkout.

Three details in that template affect the output:

  • NL holds a literal newline, because Tera string literals do not interpret \n.
  • The loops use set_global rather than set. A plain set inside a loop is scoped to the iteration, so the accumulated text would reset on every pass.
  • json_encode escapes the newlines as \n and adds the surrounding quotation marks, so the body stays valid JSON. Whether the receiving tool displays \n as a line break depends on that tool.

To print only specific labels, read them by name instead of looping over keyValues:

{%- set_global groupsText = groupsText ~ "Cluster: " ~ g.keyValues["ClusterName"] ~ ", Service: " ~ g.keyValues["ServiceName"] -%}

Label names must match the alert's group-by keys exactly. For other ways to read label values, see Dynamic templating.

Next steps​

Configure the Generic HTTPS destination type for OpsGenie or Jira Service Management in OpsGenie and JSM configuration via HTTPS.

Last updated on