feat: Implement backend for Microsoft Teams integration #471

Closed
opened 2026-04-05 16:19:57 +02:00 by MrUnknownDE · 0 comments
Owner

Originally created by @simlarsen on 5/26/2025

This commit introduces the foundational backend components for Microsoft Teams integration.

Key changes:

  • Added a Microsoft Teams App Manifest template (manifest_template.json) to guide Azure registration.
  • Implemented OAuth 2.0 flow for both project (bot) and user authentication with Microsoft Teams in Common/Server/API/MicrosoftTeamsAPI.ts. This includes token exchange and preparation for token storage.
  • Created an API endpoint (/msteams/events) in MicrosoftTeamsAPI.ts to receive incoming messages and interactions from Teams.
  • Implemented MicrosoftTeamsAuthorization.ts middleware to validate JWTs from the Bot Framework, securing the /msteams/events endpoint.
  • Developed initial action handling for Adaptive Card interactions, focusing on alerts:
    • Created Common/Server/Utils/Workspace/MicrosoftTeams/Actions/MicrosoftTeamsAlertActions.ts.
    • Updated /msteams/events to dispatch card actions to the relevant handlers.
    • Ensured Common/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.ts configures buttons with necessary data.
    • Implemented getButtonBlock in Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts to correctly generate Adaptive Card Action.Execute and Action.OpenUrl buttons, ensuring proper data payload handling for interactive messages.

The backend is now set up to handle authentication and basic interactive messages from Microsoft Teams. Next steps would involve UI changes for integration setup and expanding action handlers.

Title of this pull request?

Small Description?

Pull Request Checklist:

  • Please make sure all jobs pass before requesting a review.
  • Put closes #XXXX in your comment to auto-close the issue that your PR fixes (if such).
  • Have you lint your code locally before submission?
  • Did you write tests where appropriate?

Screenshots (if appropriate):

*Originally created by @simlarsen on 5/26/2025* This commit introduces the foundational backend components for Microsoft Teams integration. Key changes: - Added a Microsoft Teams App Manifest template (`manifest_template.json`) to guide Azure registration. - Implemented OAuth 2.0 flow for both project (bot) and user authentication with Microsoft Teams in `Common/Server/API/MicrosoftTeamsAPI.ts`. This includes token exchange and preparation for token storage. - Created an API endpoint (`/msteams/events`) in `MicrosoftTeamsAPI.ts` to receive incoming messages and interactions from Teams. - Implemented `MicrosoftTeamsAuthorization.ts` middleware to validate JWTs from the Bot Framework, securing the `/msteams/events` endpoint. - Developed initial action handling for Adaptive Card interactions, focusing on alerts: - Created `Common/Server/Utils/Workspace/MicrosoftTeams/Actions/MicrosoftTeamsAlertActions.ts`. - Updated `/msteams/events` to dispatch card actions to the relevant handlers. - Ensured `Common/Server/Utils/Workspace/MicrosoftTeams/Messages/Alert.ts` configures buttons with necessary data. - Implemented `getButtonBlock` in `Common/Server/Utils/Workspace/MicrosoftTeams/MicrosoftTeams.ts` to correctly generate Adaptive Card `Action.Execute` and `Action.OpenUrl` buttons, ensuring proper data payload handling for interactive messages. The backend is now set up to handle authentication and basic interactive messages from Microsoft Teams. Next steps would involve UI changes for integration setup and expanding action handlers. ### Title of this pull request? ### Small Description? ### Pull Request Checklist: - [ ] Please make sure all jobs pass before requesting a review. - [ ] Put `closes #XXXX` in your comment to auto-close the issue that your PR fixes (if such). - [ ] Have you lint your code locally before submission? - [ ] Did you write tests where appropriate? ### Related Issue? ### Screenshots (if appropriate):
Sign in to join this conversation.
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: github/oneuptime#471