How satishgunjal/botbuilder-samples works
Project Type and Purpose
• This is a monorepo of Bot Framework “task-focused” sample bots, implemented in two language stacks (C# and Node.js).
• Each sample is a standalone, web-hosted bot application that demonstrates a specific feature or integration (e.g., channels, attachments, LUIS, Cognitive Services, DirectLine, etc.).
• The README groups them into four categories—Core, Cards, Intelligence, Demo—making the repository more of a “catalog” of micro-services (individual bots) than a single cohesive product.
File-Structure Analysis
• Top level: two primary folders, “CSharp” and “Node”, each containing many subfolders named by sample (e.g., core-SendAttachment, cards-RichCards, intelligence-LUIS, demo-ContosoFlowers).
• Under each sample:
• A web-server project (ASP.NET Web API for C#; Express or similar for Node).
• Configuration files (Web.config/Web.Debug/Web.Release.json, .env, package.json, csproj/sln files).
• Controllers (MessagesController or app.js routes) that expose the /api/messages endpoint.
• Dialog or service modules (Dialogs folder in C#, dialogs/*.js in Node) to orchestrate conversation flows.
• Models, Helpers or Services folders for domain or Cognitive-services integration.
• Azure deployment templates (azuredeploy.json) for provisioning resources.
• Common cross-cutting concerns: authentication middleware, state storage (Bot state API or custom provider), telemetry (AppInsights), channel-specific payloads (ChannelData), and custom connectors (DirectLine, Skype Calling).
Insights from README
• Confirms the samples are independent deployments, each illustrating a Bot Framework SDK feature.
• Reinforces the pattern: Channel → Bot Framework Connector → Sample Bot App → Dialog Stack → External Services/Storage.
a. Main Components (template for any single sample):
• User/Channel (e.g., Web Chat, Facebook Messenger, Skype)
• Bot Framework Connector (Azure Bot Service runtime)
• Sample Bot Web App:
• HTTP Listener (ASP.NET Web API or Node.js Express)
• MessagesController / Route Handler
• Bot Adapter / Middleware (authentication, telemetry)
• Dialog Stack Module
• Service Integrations (LUIS, Bing Speech, Computer Vision, Azure Search, etc.)
• State Storage (in-memory, Azure Blob/Table, or custom)
• Azure Resources (App Service, Cognitive Services, Application Insights)
b. Relationships and Interactions:
1. User sends a message via Channel UI
2. Channel forwards message through Bot Connector to the Bot App’s HTTP endpoint
3. Middleware processes/authenticates the incoming activity
4. Controller hands off to Bot Adapter which invokes the root Dialog
5. Dialogs coordinate conversational logic, optionally calling out to:
– LUIS for NLP intent resolution
– Cognitive APIs for vision, speech, search
– Custom services (e.g., OrderService, Repository)
6. Bot App updates or reads state storage as needed
7. Bot App sends an Activity response back through Bot Connector to the Channel
c. Architectural Patterns and Principles:
• MVC/Web API for request routing (Controller → Adapter)
• Dialog-centric pipeline (Chain of Responsibility + Middleware)
• Dependency Injection (services and LUIS models are injected or resolved by factories)
• Layered separation: transport layer (HTTP → Controller), application logic (Dialogs/Services), infrastructure (Storage, External APIs)
d. Key Technologies, Frameworks, Libraries:
• C#: ASP.NET Web API, Bot Builder SDK v3 or v4, Newtonsoft.Json, Application Insights SDK
• Node.js: Express, Bot Builder SDK for Node, dotenv for config, package.json dependencies
• External: LUIS.ai, Bing Speech/Cognitive Services, Azure Search Client, DirectLine API
Final Recommendations
• Follow with a “generic bot architecture” template.