Skip to content

fix: update Microsoft Teams message structure and theme color handling#5363

Open
SteKoe wants to merge 1 commit into
masterfrom
fix/5321-ms-teams-webhooks
Open

fix: update Microsoft Teams message structure and theme color handling#5363
SteKoe wants to merge 1 commit into
masterfrom
fix/5321-ms-teams-webhooks

Conversation

@SteKoe
Copy link
Copy Markdown
Contributor

@SteKoe SteKoe commented May 15, 2026

This pull request refactors the Microsoft Teams notifier implementation in the Spring Boot Admin server to use Adaptive Cards instead of the legacy message format, improving compatibility with Microsoft Teams and enhancing message structure and flexibility. It also updates the tests to validate the new message format and color handling.

Migration to Adaptive Card format for Microsoft Teams notifications:

  • Refactored the message-building logic in MicrosoftTeamsNotifier to construct Adaptive Card messages, replacing the legacy Section-based format with a new structure using Message, Attachment, AdaptiveCard, and CardElement classes. The new format organizes message content into a card body with title, service name, subtitle, and a fact set, improving Teams compatibility and presentation. [1] [2]
  • Changed the color handling in notifications to use Teams' named colors ("Good", "Attention", "Accent") instead of hex codes, updating both the default color expression and all references in code and tests. [1] [2]

Enhancements and code quality improvements:

  • Added a helper method addFactIfNotNull to only include non-null facts in the notification payload, ensuring cleaner messages.
  • Updated the Fact record to use title instead of name to match the Adaptive Card schema.

Test suite updates:

  • Refactored all notifier tests to validate the new Adaptive Card message structure, including JSON structure assertions and new helper methods for extracting and verifying card content and colors. [1] [2] [3] [4] [5] [6] [7] [8] [9]
  • Added a comprehensive test to verify that the serialized message matches the expected Adaptive Card JSON structure.

These changes modernize Microsoft Teams integration, improve maintainability, and ensure robust test coverage for the new notification format.

Example

image

fixes #5321

@SteKoe SteKoe requested a review from a team as a code owner May 15, 2026 13:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

MicrosoftTeamsNotifier does not appear to work with Workflows Webhooks

1 participant