# webcon-bps/bpsext-teams architecture

> Architecture diagram of the GitHub repository webcon-bps/bpsext-teams, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-03). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/webcon-bps/bpsext-teams
- Repository: https://github.com/webcon-bps/bpsext-teams

## Overview

##### Project Type & Purpose
- This is an integration plugin that extends WEBCON BPS functionality by leveraging Microsoft Teams capabilities.
- Its primary actions are:
- CreateTeamsChannel – to automatically create a team’s channel and add users.
- AddAttachmentsToChannel – to add workflow attachments to a Microsoft Teams channel.
- The integration relies on Microsoft Graph API calls, as indicated by the presence of helper classes like GraphApiProvider, GraphApiTeamHelper, and GraphApiAttachmentsHelper.

##### Main Components
a. WEBCON BPS Platform:
- This as the originating system or client that triggers these custom actions.
b. Plugin Core:
- The central integration module (WebCon.BpsExt.Teams) which contains two submodules:
- CreateTeamsChannel
- AddAttachmentsToChannel
- Each submodule includes configuration files, helper logic, and custom action implementations.
c. Microsoft Graph API:
- A critical external dependency used for carrying out tasks in Teams.
- A component to represent the Graph API interactions (GraphApi, GraphApiProvider, etc.).
d. Supporting Components:
- Models: A component for shared data models.
- Common Utilities: Helper classes (e.g., AttachmentsHelper, BpsApiHelper) that assist in data handling and integration with external services.
- Configuration/Metadata: Represent any configuration (e.g., CreateTeamsChannelConfig.cs, AddAttachmentToChannelConfig.cs and the JSON file) that drives custom action behavior.

##### Relationships & Interactions
- Workflow Instance in WEBCON BPS triggers one of the two plugin actions.
- Each action communicates with the Microsoft Graph API to perform operations on Teams (either channel creation or attachment action).
- The Graph API component acts as an intermediary between the plugin’s custom actions and Microsoft Teams.
- Utility/helper classes support these processes by preparing and formatting data.
- Flow from the input (a workflow request from WEBCON BPS) through the custom action modules and then out to Microsoft Teams via Graph API calls.

##### Architectural Patterns & Design Principles
- The project is modularized by separating each custom action into its own directory structure, following a principle of separation of concerns.
- Utilize a layered approach:
- UI/Workflow trigger layer (WEBCON BPS)
- Service layer (CustomActions like CreateTeamsChannel and AddAttachmentsToChannel)
- Integration layer (GraphApi and related helpers)
- This setup not only organizes code but also clarifies the responsibilities and data flow between components.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% External System
    A["WEBCON BPS Platform"]:::external

    %% Plugin Core
    subgraph "Plugin Core"
        B["CreateTeamsChannel Module"]:::module
        C["AddAttachmentsToChannel Module"]:::module
        D["Supporting Models"]:::models
        EU1["Bps API Helper"]:::utility
        EU2["Attachments Helper"]:::utility
    end

    %% Configuration/Metadata
    subgraph "Configuration Files"
        F1["CreateTeamsChannelConfig"]:::configItem
        F2["AddAttachmentToChannelConfig"]:::configItem
        F3["Project-level Configuration"]:::configItem
    end

    %% Microsoft Graph API Integration Layer
    subgraph "Microsoft Graph API Integration"
        G["Graph API Provider"]:::api
        H["GraphApiTeamHelper"]:::apiHelper
        I["GraphApiAttachmentsHelper"]:::apiHelper
    end

    %% External Service: Microsoft Teams
    MS["Microsoft Teams"]:::external

    %% Flow Connections
    A -->|"triggers"| B
    A -->|"triggers"| C

    %% Plugin Modules using Configuration and Models
    B -->|"configuredBy"| F1
    C -->|"configuredBy"| F2
    B -->|"uses"| D
    C -->|"uses"| D

    %% Plugin Modules using Utilities
    B -->|"utilizes"| EU1
    C -->|"utilizes"| EU2

    %% Plugin Modules interfacing with Graph API Integration
    B -->|"calls"| G
    C -->|"calls"| G
    B -->|"assists"| H
    C -->|"assists"| I

    %% Graph API Provider making calls to Microsoft Teams
    G -->|"APIcalls"| MS

    %% Project-level configuration applies to the plugin core overall
    B ---|"globalConfig"| F3
    C ---|"globalConfig"| F3

    %% Click Events for Component Mappings
    click B "https://github.com/webcon-bps/bpsext-teams/tree/main/WebCon.BpsExt.Teams/CustomActions/CreateTeamsChannel"
    click C "https://github.com/webcon-bps/bpsext-teams/tree/main/WebCon.BpsExt.Teams/CustomActions/AddAtachmentsToChannel"
    click G "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/GraphApi/GraphApiProvider.cs"
    click H "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/CreateTeamsChannel/GraphApiTeamHelper.cs"
    click I "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/AddAtachmentsToChannel/GraphApiAttachmentsHelper.cs"
    click D "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/Models/Models.cs"
    click EU1 "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/CreateTeamsChannel/BpsApiHelper.cs"
    click EU2 "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/AddAtachmentsToChannel/AttachmentsHelper.cs"
    click F1 "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/CreateTeamsChannel/CreateTeamsChannelConfig.cs"
    click F2 "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/CustomActions/AddAtachmentsToChannel/AddAttachmentToChannelConfig.cs"
    click F3 "https://github.com/webcon-bps/bpsext-teams/blob/main/WebCon.BpsExt.Teams/WebCon.BpsExt.Teams.json"

    %% Styles
    classDef external fill:#ffcc00,stroke:#000,stroke-width:2px;
    classDef module fill:#ccf,stroke:#333,stroke-width:2px;
    classDef models fill:#cfc,stroke:#333,stroke-width:2px;
    classDef utility fill:#fc9,stroke:#333,stroke-width:2px;
    classDef api fill:#fcc,stroke:#333,stroke-width:2px;
    classDef apiHelper fill:#f99,stroke:#333,stroke-width:2px;
    classDef configItem fill:#99f,stroke:#333,stroke-width:2px;
```
