Message configuration
A custom Microsoft Teams preset controls the layout of Case notifications in your Teams channels. You write a template that renders an Adaptive Card, and Coralogix posts the result to the channel set on the connector.
What you need
- A Microsoft Teams connector. See Install and set up Microsoft Teams.
- Case notifications routed to that connector.
Payload field
Microsoft Teams supports a single payload type, so every Teams preset defines the full message.
| UI label | API field name | Rendered output type | Required | Description |
|---|---|---|---|---|
| Payload | payload | JSONObject | true | The message activity sent to Microsoft Teams, with an Adaptive Card as its first attachment. |
Create a Microsoft Teams preset
- Select Integrations, then Notification Center, then Presets, and open the Cases tab.
- Under Add new case preset, select Microsoft Teams.
- Enter a name and a description.
- In Message, use the full Coralogix layout or paste the template below into Payload, then adjust the card and variables to suit your Cases.
- Check the rendered card in Preview. To see it in Teams, select a test connector, then select Send test notification.
- Select Create preset.
Case notification template
This template renders a header colored by Case status, the Case description, a fact list with the status, assignee, and timestamps, the first four Case labels, and a footer with the Case ID.
{%- if case.status == "ACTIVE" or case.status == "PENDING_ACTIVATION" -%}
{%- set statusIcon = "🚨" -%}
{%- set headerStyle = "attention" -%}
{%- elif case.status == "ACKNOWLEDGED" -%}
{%- set statusIcon = "👀" -%}
{%- set headerStyle = "warning" -%}
{%- else -%}
{%- set statusIcon = "✅" -%}
{%- set headerStyle = "good" -%}
{%- endif -%}
{%- set title = case.title | truncate(length=100, end="…") -%}
{%- set headerText = statusIcon ~ " " ~ case.priority ~ " • " ~ title -%}
{%- set statusText = case.status | replace(from="_", to=" ") | title -%}
{%- if case.assignee.coralogixUser.userEmail -%}
{%- set assignee = case.assignee.coralogixUser.userEmail -%}
{%- else -%}
{%- set assignee = "Unassigned" -%}
{%- endif -%}
{%- set startedAt = case.createdAt | date(format="%Y-%m-%d %H:%M UTC") -%}
{#- set_global is required here: a plain `set` inside a loop resets every iteration. -#}
{%- set_global labelsText = "" -%}
{%- for key, values in case.labels -%}
{%- if loop.index <= 4 -%}
{%- if loop.index > 1 -%}{%- set_global labelsText = labelsText ~ ", " -%}{%- endif -%}
{%- set_global labelsText = labelsText ~ "**" ~ key ~ ":** " ~ values[0] -%}
{%- endif -%}
{%- endfor -%}
{%- if case.labels | length > 4 -%}
{%- set remainder = case.labels | length - 4 -%}
{%- set labelsText = labelsText ~ ", _+" ~ remainder ~ " more_" -%}
{%- endif -%}
{%- set footerText = "Coralogix Cases • Case ID " ~ case.id -%}
{
"type": "message",
"attachments": [
{
"contentType": "application/vnd.microsoft.card.adaptive",
"content": {
"$schema": "http://adaptivecards.io/schemas/adaptive-card.json",
"type": "AdaptiveCard",
"version": "1.5",
"msteams": { "width": "Full" },
"body": [
{
"type": "Container",
"style": {{ headerStyle | json_encode }},
"items": [
{
"type": "TextBlock",
"size": "Large",
"weight": "Bolder",
"wrap": true,
"text": {{ headerText | json_encode }}
}
]
},
{% if case.description %}
{
"type": "TextBlock",
"wrap": true,
"text": {{ case.description | truncate(length=1000, end="…") | json_encode }}
},
{% endif %}
{
"type": "FactSet",
"facts": [
{ "title": "Status", "value": {{ statusText | json_encode }} },
{ "title": "Assignee", "value": {{ assignee | json_encode }} },
{ "title": "Started", "value": {{ startedAt | json_encode }} }
{%- if case.updatedAt %},
{ "title": "Last updated", "value": {{ case.updatedAt | date(format="%Y-%m-%d %H:%M UTC") | json_encode }} }
{%- endif %}
]
},
{% if labelsText %}
{
"type": "TextBlock",
"wrap": true,
"separator": true,
"text": {{ "🏷️ **Labels:** " ~ labelsText | json_encode }}
},
{% endif %}
{
"type": "TextBlock",
"size": "Small",
"isSubtle": true,
"wrap": true,
"text": {{ footerText | json_encode }}
}
]
}
}
]
}
The {%- set -%} block at the top assembles each piece of text first, then the payload places the finished values into the card. Building the text separately keeps truncation and JSON escaping in one place, and it keeps the card readable.
Three details in that block affect the output:
- The status branch picks both the icon and the
Containerstyle, so an active Case renders with a red header, an acknowledged one with an amber header, and a resolved or closed one with a green header. - The assignee fact reads only Coralogix users and falls back to
Unassigned. A Case can also be assigned through Slack, PagerDuty, Microsoft Teams, ServiceNow, or an API key, each under its own field. Add an{% elif %}branch per type you use, following Actor tagged unions. - The labels loop uses
set_globalrather thanset. A plainsetinside a loop is scoped to the iteration, so the accumulated text would reset on every pass.
Variables used
| Variable | Description |
|---|---|
case.id | Unique identifier of the Case. |
case.title | Title of the Case. |
case.description | Description of the Case. |
case.priority | Priority of the Case, P1 to P5. |
case.status | Current status: PENDING_ACTIVATION, ACTIVE, ACKNOWLEDGED, RESOLVED, or CLOSED. |
case.assignee.coralogixUser.userEmail | Email of the Coralogix user the Case is assigned to. |
case.createdAt | Time the Case was created. |
case.updatedAt | Time the Case was last updated. |
case.labels | Case labels as {key: [values]}. Read a value with [0]. |
For the full set of fields, see Cases. For syntax, see Dynamic templating.
Guidelines for Teams payloads
Escape every interpolated value. Pipe any value that can contain quotation marks or line breaks, such as a Case title or description, through json_encode, as the template above does for headerText. The filter adds the surrounding quotation marks, so omit them in the payload. An unescaped quotation mark in a Case title renders invalid JSON, and the notification fails.
Keep the message shape. Coralogix adds the Case action buttons, such as Acknowledge and Resolve, and the attachments to the card body. Render a message activity with a single Adaptive Card as the first entry in attachments, and keep body as an array. A card in any other shape is still delivered, but without the buttons and attachments.
Stay within the Teams message size limit. Microsoft Teams rejects messages larger than about 100 KB and recommends staying under 80 KB.
Use Adaptive Card version 1.6 or lower. Teams renders schema versions up to 1.6, and a card that declares a later version might not render, especially on mobile. The template above uses 1.5.
Use the Markdown that Teams supports. A TextBlock and the title and value of a FactSet fact accept bold, italic, lists, and links. Headers, tables, images, and HTML do not render. See Format cards in Microsoft Teams.
Validate before saving. Open the Adaptive Cards Designer, set the host app to Microsoft Teams, and paste the content object from the rendered Preview: the card itself, not the surrounding activity. Then select Send test notification to confirm the card reaches your channel.