# fnascimento-dev/rbm-api-examples architecture

> Architecture diagram of the GitHub repository fnascimento-dev/rbm-api-examples, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-04-02). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/fnascimento-dev/rbm-api-examples
- Repository: https://github.com/fnascimento-dev/rbm-api-examples

## Overview

##### Main Components
- API Integration Layer – This is represented by the common RBM API helper libraries in each language (for example, “csharp/rbm-api-helper”, “java/rbm-api-helper”, “nodejs/rbm-api-helper”, “python/rbm-api-helper”). These wrap the lower-level communication details with the RCS Business Messaging API.
- Language-Specific Agents – The repository groups sample agents by language. For instance, in each language directory you see several agents like “rbm-csharp-client-v1”, “rbm-java-client-v1”, “rbm-nodejs-…” variants (including two-factor, acme pizza, telco self-serve, etc.), and “rbm-python…” examples. These agents show how to use the helper libraries to build a working integration.
- Management/Ops/Integration Modules – There are additional components like “rbm-mgmt-api”, “rbm-ops-api”, “rbm-intro/…”, and the “dialogflow-integration” module. These illustrate aspects such as management flows, operational tasks (agent listing, launching, verification) and integration with Dialogflow.
- External Service – At the highest level is Google’s RCS Business Messaging API (the external service) that actually processes and routes messages. It is the “backend” target that all these sample agents are built to interface with.

##### Relationships and Data Flow
- Each sample agent (in its own language) uses its respective RBM API helper library. This library encapsulates the communication, message formatting, and error handling.
- The helper libraries then send requests (or receive callbacks) to/from Google’s RCS Business Messaging endpoints.
- In some examples (like mgmt- or ops-related modules), there are RESTful endpoints or scripts (e.g., shell scripts under the curl directory) that perform operations such as launching an agent or verifying its status.
- Integration components (e.g., Dialogflow module) may interact via a more specific adapter that transforms webhook calls or event triggers into API calls.

##### Architectural Patterns and Design Principles
- Clear Separation Between Logic, API Wrapping, and External Communication: Each layer has a well-defined responsibility.
- Configuration & Credential Handling is a cross-cutting concern.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Language-Specific Agents
    subgraph "C# Layer"
        csh_A("C# Sample Agents"):::agents
    end
    subgraph "Java Layer"
        jav_A("Java Sample Agents"):::agents
    end
    subgraph "Node.js Layer"
        ndjs_A("Node.js Sample Agents"):::agents
    end
    subgraph "Python Layer"
        py_A("Python Sample Agents"):::agents
    end

    %% API Helper Libraries
    subgraph "API Helpers"
        csh_H("C# RBM API Helper"):::helper
        jav_H("Java RBM API Helper"):::helper
        ndjs_H("Node.js RBM API Helper"):::helper
        py_H("Python RBM API Helper"):::helper
    end

    %% External Service
    External("Google RCS Business Messaging API"):::external

    %% Management/Ops & Integration Modules
    subgraph "Management/Ops & Integration Modules"
        curl_Ops1("Curl RBM Ops API"):::mgmt
        curl_Ops2("Curl RCS Messaging"):::mgmt
        jav_Mgmt("Java Management API"):::mgmt
        jav_Intro("Java Intro/Low-level Integration"):::mgmt
        jav_Cap("Java Capability Check"):::mgmt
        ndjs_Mgmt("Node.js Management API"):::mgmt
        ndjs_Ops("Node.js Ops API"):::mgmt
        ndjs_Dialog("Dialogflow Integration Module"):::mgmt
    end

    %% Relationships: Agents use Helper Libraries with configuration/credentials
    csh_A -->|"sendsMsg(withConfig)"| csh_H
    jav_A -->|"sendsMsg(withConfig)"| jav_H
    ndjs_A -->|"sendsMsg(withConfig)"| ndjs_H
    py_A -->|"sendsMsg(withConfig)"| py_H

    %% Helper Libraries call the External API
    csh_H -->|"APIcall"| External
    jav_H -->|"APIcall"| External
    ndjs_H -->|"APIcall"| External
    py_H -->|"APIcall"| External

    %% Management/Ops modules interactions with External API
    curl_Ops1 -->|"opsCmd"| External
    curl_Ops2 -->|"opsCmd"| External
    jav_Mgmt -->|"mgmtCmd"| External
    jav_Intro -->|"mgmtCmd"| External
    jav_Cap -->|"capCheck"| External
    ndjs_Mgmt -->|"mgmtCmd"| External
    ndjs_Ops -->|"opsCmd"| External
    ndjs_Dialog -->|"integrate"| External

    %% Click Events for API Helper Libraries
    click csh_H "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/csharp/rbm-api-helper"
    click jav_H "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/java/rbm-api-helper"
    click ndjs_H "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/nodejs/rbm-api-helper"
    click py_H "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/python/rbm-api-helper"

    %% Click Events for Language-Specific Agents
    click csh_A "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/csharp/agents"
    click jav_A "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/java/agents"
    click ndjs_A "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/nodejs/agents"
    click py_A "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/python/agents"

    %% Click Events for Management/Ops & Integration Modules
    click curl_Ops1 "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/curl/rbm-ops-api"
    click curl_Ops2 "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/curl/rcs-business-messaging"
    click jav_Mgmt "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/java/rbm-mgmt-api"
    click jav_Intro "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/java/rbm-intro"
    click jav_Cap "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/java/rbm-cap-check"
    click ndjs_Mgmt "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/nodejs/rbm-mgmt-api"
    click ndjs_Ops "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/nodejs/rbm-ops-api"
    click ndjs_Dialog "https://github.com/fnascimento-dev/rbm-api-examples/tree/master/nodejs/dialogflow-integration/rbm-integration-module"

    %% Styles
    classDef agents fill:#AED6F1,stroke:#1F618D,stroke-width:2px;
    classDef helper fill:#F9E79F,stroke:#B9770E,stroke-width:2px;
    classDef mgmt fill:#F5B7B1,stroke:#C0392B,stroke-width:2px;
    classDef external fill:#D5F5E3,stroke:#239B56,stroke-width:2px;
```
