Seq.App.Teams.AdaptiveCard
2.2.0
dotnet add package Seq.App.Teams.AdaptiveCard --version 2.2.0
NuGet\Install-Package Seq.App.Teams.AdaptiveCard -Version 2.2.0
<PackageReference Include="Seq.App.Teams.AdaptiveCard" Version="2.2.0" />
paket add Seq.App.Teams.AdaptiveCard --version 2.2.0
#r "nuget: Seq.App.Teams.AdaptiveCard, 2.2.0"
// Install Seq.App.Teams.AdaptiveCard as a Cake Addin #addin nuget:?package=Seq.App.Teams.AdaptiveCard&version=2.2.0 // Install Seq.App.Teams.AdaptiveCard as a Cake Tool #tool nuget:?package=Seq.App.Teams.AdaptiveCard&version=2.2.0
Seq.App.Teams.AdaptiveCard
Seq alerting application for Microsoft Teams with AdaptiveCard support. Based on Seq.App.Teams application.
Notes
To connect application instance to Teams you need to provide Teams Webhook url. You can find required instructions here.
Alternatively you can setup integration using Workflows feature. It has it's own limitations, but potentially it will be the only way to connect in future based on this article. Setup is similar to Webhook setup. You need to add Post to a channel when a webhook request is received
workflow, which will give you webhook URL. You need to put this URL to Seq.App.Teams.AdaptiveCard
application settings. Note that:
- custom template schema version should be 1.3
- you cannot setup workflow for private channel (or maybe you can but I don't have this sacred knowledge yet)
Because Teams currently doesn't support AdaptiveCard templating, it is done on application side using AdaptiveCards.Templating library.
Custom Templates
If you design your custom templates, you should use AdaptiveCard
schema version 1.3. While Teams itself supports version 1.5, when connected using Power Automate workflow, it cap maximum supported version to 1.3 (wonder what the word Power
in it's name means in this case).
Context
Default template source: default-template.json. Used when no template specified.
Payload Examples
Those examples could be used with AdaptiveCard
designer.
Event Payload
{
"Id": "event-4f3bb930732008db0733010000000000",
"TimeStamp": "2023-06-22T12:58:00.8518960Z",
"Level": "Warning",
"MessageTemplate": "Some event {@data}",
"Message": "Some event 123",
"Exception": null,
"Properties": {
"#ProcessID": 11860,
"#ThreadID": 88
},
"EventType": 2739387145,
"AppTitle": "teams app",
"InstanceName": "",
"BaseUri": "http://localhost:80"
}
Alert Payload
{
"Id": "event-988d8be0732108db0000000000000000",
"TimeStamp": "2023-06-22T13:07:13.3585376Z",
"Level": "Warning",
"MessageTemplate": "Alert condition triggered by {NamespacedAlertTitle}",
"Message": "Alert condition triggered by \"admin/New Alert\"",
"Exception": null,
"Properties": {
"NamespacedAlertTitle": "admin/New Alert",
"Alert": {
"Id": "alert-463",
"Title": "New Alert",
"Url": "http://localhost:80/#/alerts/alert-463",
"OwnerUsername": "admin",
"SignalExpressionDescription": null,
"Query": "select count(*) as count from stream group by time(1m) having count > 0 limit 100 for background",
"HavingClause": "count > 0",
"TimeGrouping": "1 minute"
},
"Source": {
"RangeStart": "2023-06-22T13:05:43.3585376Z",
"RangeEnd": "2023-06-22T13:06:43.3585376Z",
"ResultsUrl": "http://localhost:80/#/events?q=select%20count%28%2A%29%20as%20count%20from%20stream%20group%20by%20time%281m%29%20having%20count%20%3E%200%20limit%20100%20for%20background&from=2023-06-22T13:05:43.3585376Z&to=2023-06-22T13:06:43.3585376Z",
"Results": [
[ "time", "count" ],
[ "2023-06-22T13:05:43.3585376Z", 19 ]
],
"ContributingEvents": [
[ "id", "timestamp", "message" ],
[ "event-6d291458732108db9333010000000000", "2023-06-22T13:06:00.5580888Z", "event message 1" ],
[ "event-6d291458732108db9433010000000000", "2023-06-22T13:06:00.5580888Z", "event message 2" ]
]
},
"SuppressedUntil": "2023-06-22T13:08:13.3585376Z",
"Failures": null
},
"EventType": 2716299265,
"AppTitle": "teams app",
"InstanceName": "",
"BaseUri": "http://localhost:80"
}
Custom Functions
In addition to standard AdaptiveTemplate functions, application implements several custom functions:
_nomd(param)
: this function takes single parameter of any type and in case of string escapes all supported markdown control sequences. Function is useful when rendered text could contain markdown-like character sequences as AdaptiveCard doesn't provide option to disable markdown from template._jsonPrettify(param)
: same as built-in jsonStringify(), butJSON
rendered indented andnull
values are omitted_colorUri(hex_rgb)
: generates data uri with one-pixel image of specified color. Parameter must be string with hex color inRRGGBB
form. BecauseAdaptiveCard
doesn't support background color but supports background image, this function could be used to emulate background color using background image.
Extra Links
Configuration
- Teams: Create Incoming Webhooks. Provides instructions on Teams webhook creation
Additional repositories
- AdaptiveCards.Templating: Templating engine implementation
- AdaptiveExpressions: AdaptiveCard expressions evaluation engine
- Teams Developer Documentation: Teams-specific documentation
Templating language
- AdaptiveCard visual designer
- Templating language reference
- List of built-in functions
- Client-side templating. Additional templating features (those are supported by Teams)
- Teams extensions. Teams-specific AdaptiveCard extensions
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 was computed. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.