Convert Figma logo to code with AI

microsoft logobotframework-sdk

Bot Framework provides the most comprehensive experience for building conversation applications.

7,473
2,437
7,473
110

Top Related Projects

Welcome to the Bot Framework samples repository. Here you will find task-focused samples in C#, JavaScript/TypeScript, and Python to help you get started with the Bot Framework SDK!

12,494

The open-source hub to build & deploy GPT/LLM Agents ⚡️

11,445

Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.

18,602

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants

VS Code in the browser

Quick Overview

The Microsoft Bot Framework SDK is a comprehensive toolkit for building conversational AI applications, chatbots, and virtual assistants. It provides developers with a set of libraries, tools, and services to create, test, and deploy bots across multiple channels and platforms.

Pros

  • Cross-platform compatibility: Supports multiple programming languages and can be deployed on various platforms.
  • Rich set of tools: Includes Bot Framework Composer for visual bot design and Bot Framework Emulator for testing.
  • Integration with Azure services: Seamlessly integrates with Azure Cognitive Services for enhanced AI capabilities.
  • Extensible architecture: Allows for easy customization and extension of bot functionality.

Cons

  • Learning curve: Can be complex for beginners due to the wide range of features and concepts.
  • Documentation challenges: Some parts of the documentation may be outdated or lack detailed examples.
  • Dependency on Microsoft ecosystem: Heavy reliance on Microsoft technologies may limit flexibility for some developers.

Code Examples

  1. Creating a simple echo bot in C#:
[Route("api/messages")]
[ApiController]
public class BotController : ControllerBase
{
    private readonly IBot _bot;

    public BotController(IBot bot)
    {
        _bot = bot;
    }

    [HttpPost]
    public async Task PostAsync()
    {
        await _bot.OnTurnAsync(TurnContext.Create(Activity.CreateMessageActivity(), (StreamingHttpAdapter)HttpContext.RequestServices.GetService<IAdapterIntegration>()));
    }
}
  1. Implementing a dialog in JavaScript:
const { ComponentDialog, WaterfallDialog, TextPrompt } = require('botbuilder-dialogs');

class GreetingDialog extends ComponentDialog {
    constructor(id) {
        super(id);
        
        this.addDialog(new TextPrompt('textPrompt'))
            .addDialog(new WaterfallDialog('waterfall', [
                this.nameStep.bind(this),
                this.greetStep.bind(this)
            ]));

        this.initialDialogId = 'waterfall';
    }

    async nameStep(step) {
        return await step.prompt('textPrompt', 'What is your name?');
    }

    async greetStep(step) {
        const name = step.result;
        await step.context.sendActivity(`Hello, ${name}!`);
        return await step.endDialog();
    }
}
  1. Using LUIS for natural language understanding in Python:
from botbuilder.ai.luis import LuisApplication, LuisRecognizer
from botbuilder.core import TurnContext

luis_app = LuisApplication(
    "YOUR_LUIS_APP_ID",
    "YOUR_LUIS_API_KEY",
    "YOUR_LUIS_API_HOST_NAME"
)
recognizer = LuisRecognizer(luis_app)

async def on_message_activity(turn_context: TurnContext):
    luis_result = await recognizer.recognize(turn_context)
    intent = luis_result.get_top_scoring_intent().intent
    await turn_context.send_activity(f"Recognized intent: {intent}")

Getting Started

  1. Install the Bot Framework SDK:

    npm install botbuilder
    

    or

    dotnet add package Microsoft.Bot.Builder
    
  2. Create a new bot project using the Bot Framework template:

    dotnet new bot -n MyBot
    
  3. Implement your bot logic in the main bot class.

  4. Test your bot using the Bot Framework Emulator.

  5. Deploy your bot to Azure or your preferred hosting platform.

Competitor Comparisons

Welcome to the Bot Framework samples repository. Here you will find task-focused samples in C#, JavaScript/TypeScript, and Python to help you get started with the Bot Framework SDK!

Pros of BotBuilder-Samples

  • Extensive collection of practical examples and templates
  • Easier for beginners to get started with bot development
  • Regularly updated with new features and best practices

Cons of BotBuilder-Samples

  • Less comprehensive documentation compared to botframework-sdk
  • May not cover all advanced scenarios or customizations
  • Focused on specific use cases rather than providing a complete SDK

Code Comparison

BotBuilder-Samples:

const { ActivityHandler, MessageFactory } = require('botbuilder');

class EchoBot extends ActivityHandler {
    constructor() {
        super();
        this.onMessage(async (context, next) => {
            await context.sendActivity(MessageFactory.text(`Echo: ${context.activity.text}`));
            await next();
        });
    }
}

botframework-sdk:

const { BotFrameworkAdapter } = require('botbuilder');

const adapter = new BotFrameworkAdapter({
    appId: process.env.MicrosoftAppId,
    appPassword: process.env.MicrosoftAppPassword
});

adapter.onTurnError = async (context, error) => {
    console.error(`\n [onTurnError] unhandled error: ${error}`);
    await context.sendTraceActivity('OnTurnError Trace', `${error}`, 'https://www.botframework.com/schemas/error', 'TurnError');
};

The BotBuilder-Samples code showcases a simple echo bot implementation, while the botframework-sdk code demonstrates the setup of a BotFrameworkAdapter with error handling. BotBuilder-Samples focuses on practical examples, while botframework-sdk provides core functionality and configuration options.

12,494

The open-source hub to build & deploy GPT/LLM Agents ⚡️

Pros of Botpress

  • Open-source with a strong community-driven development approach
  • More user-friendly interface for non-technical users
  • Offers a visual flow editor for easier bot design

Cons of Botpress

  • Less extensive documentation compared to Bot Framework SDK
  • Smaller ecosystem of integrations and connectors
  • May require more setup and configuration for enterprise-level deployments

Code Comparison

Bot Framework SDK (C#):

[LuisIntent("Greeting")]
public async Task Greeting(IDialogContext context, LuisResult result)
{
    await context.PostAsync("Hello! How can I help you today?");
    context.Wait(MessageReceived);
}

Botpress (JavaScript):

const greeting = async (bp, event) => {
  await bp.cms.renderElement('builtin_text', { text: 'Hello! How can I help you today?' }, event)
}

bp.hear(/hello|hi|hey/i, greeting)

Both frameworks offer ways to handle intents and respond to user input, but Botpress uses a more modern JavaScript approach with async/await syntax and a built-in CMS for content management. Bot Framework SDK provides a more structured, attribute-based approach for intent handling, which may be preferred in larger, more complex projects.

11,445

Botkit is an open source developer tool for building chat bots, apps and custom integrations for major messaging platforms.

Pros of Botkit

  • Simpler and more lightweight, making it easier for beginners to get started
  • Supports a wider range of messaging platforms out-of-the-box
  • More community-driven with a larger ecosystem of plugins and extensions

Cons of Botkit

  • Less comprehensive documentation compared to Bot Framework SDK
  • Limited built-in natural language processing capabilities
  • Fewer enterprise-grade features and integrations

Code Comparison

Botkit:

const { Botkit } = require('botkit');

const controller = new Botkit({
  webhook_uri: '/api/messages',
});

controller.hears('hello', 'message', async(bot, message) => {
  await bot.reply(message, 'Hi there!');
});

Bot Framework SDK:

const { ActivityHandler, MessageFactory } = require('botbuilder');

class EchoBot extends ActivityHandler {
    constructor() {
        super();
        this.onMessage(async (context, next) => {
            await context.sendActivity(MessageFactory.text(`You said: ${context.activity.text}`));
            await next();
        });
    }
}

Both frameworks offer straightforward ways to create bots, but Bot Framework SDK provides a more structured approach with built-in activity handlers and message factories. Botkit's syntax is more concise and may be easier for beginners to understand quickly.

18,602

💬 Open source machine learning framework to automate text- and voice-based conversations: NLU, dialogue management, connect to Slack, Facebook, and more - Create chatbots and voice assistants

Pros of Rasa

  • Open-source and self-hosted, offering greater flexibility and customization
  • Strong natural language understanding (NLU) capabilities with machine learning
  • Active community and extensive documentation for support

Cons of Rasa

  • Steeper learning curve, especially for non-technical users
  • Requires more setup and infrastructure management
  • Limited out-of-the-box integrations compared to Bot Framework

Code Comparison

Rasa (Python):

from rasa_sdk import Action

class ActionGreet(Action):
    def name(self) -> str:
        return "action_greet"

    def run(self, dispatcher, tracker, domain):
        dispatcher.utter_message(text="Hello! How can I help you?")
        return []

Bot Framework SDK (C#):

[LuisIntent("Greeting")]
public async Task GreetingIntent(IDialogContext context, LuisResult result)
{
    await context.PostAsync("Hello! How can I help you?");
    context.Wait(MessageReceived);
}

Both frameworks offer ways to define custom actions or intents, but Rasa uses Python and focuses on machine learning, while Bot Framework SDK typically uses C# and integrates with Azure services.

VS Code in the browser

Pros of code-server

  • Enables running VS Code in a browser, providing a full IDE experience remotely
  • Supports collaborative coding and remote development workflows
  • Can be self-hosted for enhanced security and control

Cons of code-server

  • Requires more setup and infrastructure compared to local VS Code installation
  • May have performance limitations depending on network conditions
  • Limited to VS Code functionality, while Bot Framework SDK offers specialized bot development tools

Code Comparison

Bot Framework SDK (C#):

var bot = new ActivityHandler();
bot.OnMessageActivityAsync(async (context, cancellationToken) =>
{
    await context.SendActivityAsync("Hello, I'm a bot!");
});

code-server (JavaScript configuration):

module.exports = {
  bind: '0.0.0.0',
  auth: 'password',
  password: 'your-password-here',
  cert: false
};

While Bot Framework SDK focuses on bot development with specific APIs, code-server provides a configuration for running VS Code in a browser environment. The code examples highlight their different purposes and use cases.

Convert Figma logo designs to code with AI

Visual Copilot

Introducing Visual Copilot: A new AI model to turn Figma designs to high quality code using your components.

Try Visual Copilot

README

Bot Framework

What's new with Bot Framework?

Bot Framework provides the most comprehensive experience for building conversation applications.

With the Bot Framework SDK, developers can build bots that converse free-form or with guided interactions including using simple text or rich cards that contain text, images, and action buttons.

Developers can model and build sophisticated conversation using their favorite programming languages including C#, JS, and Python for developers and multi-disciplinary teams to design and build conversational experiences.

Checkout the Bot Framework ecosystem section to learn more about other tooling and services related to the Bot Framework SDK.

Quicklinks

| C# Repo | JS Repo | Python Repo | BF CLI |

Bot Framework SDK v4

The Bot Framework SDK v4 is an open source SDK that enable developers to model and build sophisticated conversation using their favorite programming language.

C#JSPython
Stable Releasepackagespackagespackages
Docsdocsdocsdocs
Samples.NET Core, WebAPINode.js , TypeScript, es6Python

Channels and Adapters

There are two ways to connect your bot to a client experience:

  • Azure Bot Service Channel - Language and SDK independent support via Azure Bot Service
  • Bot Framework SDK Adapter - A per language Adapter component
ClientAzure ChannelC# AdapterJS Adapter
Microsoft TeamsAzure
Direct LineAzure
Web ChatAzureBotkit
SkypeAzure
EmailAzure
FacebookAzureCommunityBotkit
SlackAzureCommunityBotkit
KikAzure
TelegramAzure
LineAzure
GroupMeAzure
Twilio (SMS)AzureCommunityBotkit
Alexa SkillsCommunityCommunity
Google ActionsCommunityCommunity
Google HangoutsBotkit
WebExCommunityBotkit
WhatsApp (Infobip)Community
ZoomCommunity
RingCentralCommunity
CortanaAzure
ConsoleCommunity

Community Open Source Projects

The following open source communities make various components available to extend your bot application, including adapters, recognizers, dialogs and middleware.

C#JavaScriptPython
Bot Framework CommunityC#JavaScriptPython
BotkitJavaScript

Questions and Help

If you have questions about Bot Framework SDK or using Azure Bot Service, we encourage you to reach out to the community and Azure Bot Service dev team for help.

See all of the available support options here.

Issues and feature requests

We track functional issues and features asks for the Bot Framework SDK, tools and Azure Bot Service in a variety of locations. If you have found an issue or have a feature request, please submit an issue to the below repositories.

ItemDescriptionLink
SDK v4 .NETcore bot runtime for .NET, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
SDK v4 JavaScriptcore bot runtime for Typescript/Javascript, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
SDK v4 Pythoncore bot runtime for Python, connectors, middleware, dialogs, prompts, LUIS and QnAFile an issue
Bot Framework CLIbot framework cli toolsFile an issue
Webchatbot framework web chat toolFile an issue

Prior releases

  • Bot Builder v3 SDK has been migrated to the Bot Framework SDK V3 repository. The V3 SDK is retired with final long-term support ending on December 31st, 2019

Bot Framework ecosystem

Azure Bot Service

Azure Bot Service enables you to host intelligent, enterprise-grade bots with complete ownership and control of your data. Developers can register and connect their bots to users on Skype, Microsoft Teams, Cortana, Web Chat, and more. [Docs]

  • Direct Line JS Client: If you want to use the Direct Line channel in Azure Bot Service and are not using the WebChat client, the Direct Line JS client can be used in your custom application. [Readme]

  • Direct Line Speech Channel: We are bringing together the Bot Framework and Microsoft's Speech Services to provide a channel that enables streamed speech and text bi-directionally from the client to the bot application. To sign up, add the 'Direct Line Speech' channel to your Azure Bot Service.
  • Better isolation for your Bot - Direct Line App Service Extension : The Direct Line App Service Extension can be deployed as part of a VNET, allowing IT administrators to have more control over conversation traffic and improved latency in conversations due to reduction in the number of hops. Get started with Direct Line App Service Extension here. A VNET lets you create your own private space in Azure and is crucial to your cloud network as it offers isolation, segmentation, and other key benefits.

Bot Framework Emulator

The Bot Framework Emulator is a cross-platform desktop application that allows bot developers to test and debug bots built using the Bot Framework SDK. You can use the Bot Framework Emulator to test bots running locally on your machine or to connect to bots running remotely. [Download latest | Docs]

Bot Framework Web Chat

The Bot Framework Web Chat is a highly customizable web-based client chat control for Azure Bot Service that provides the ability for users to interact with your bot directly in a web page. [Stable release | Docs | Samples]

Bot Framework CLI

The Bot Framework CLI Tools hosts the open source cross-platform Bot Framework CLI tool, designed to support building robust end-to-end development workflows. The Bot Framework CLI tool replaced the legacy standalone tools used to manage bots and related services. BF CLI aggregates the collection of cross-platform tools into one cohesive and consistent interface.

Bot Framework Composer

Bot Framework Composer is an integrated development tool for developers and multi-disciplinary teams to build bots and conversational experiences with the Microsoft Bot Framework. Within this tool, you'll find everything you need to build a sophisticated conversational experience.

Botkit

Botkit is a developer tool and SDK for building chat bots, apps and custom integrations for major messaging platforms. Botkit bots hear() triggers, ask() questions and say() replies. Developers can use this syntax to build dialogs - now cross compatible with the latest version of Bot Framework SDK.

In addition, Botkit brings with it 6 platform adapters allowing Javascript bot applications to communicate directly with messaging platforms: Slack, Webex Teams, Google Hangouts, Facebook Messenger, Twilio, and Web chat.

Botkit is part of Microsoft Bot Framework and is released under the MIT Open Source license

Related Services

Language Understanding

A machine learning-based service to build natural language experiences. Quickly create enterprise-ready, custom models that continuously improve. Language Understanding Service(LUIS) allows your application to understand what a person wants in their own words. [Docs | Add language understanding to your bot]

QnA Maker

QnA Maker is a cloud-based API service that creates a conversational, question-and-answer layer over your data. With QnA Maker, you can build, train and publish a simple question and answer bot based on FAQ URLs, structured documents, product manuals or editorial content in minutes. [Docs | Add qnamaker to your bot]

Dispatch

Dispatch tool lets you build language models that allow you to dispatch between disparate components (such as QnA, LUIS and custom code). [Readme]

Speech Services

Speech Services convert audio to text, perform speech translation and text-to-speech with the unified Speech services. With the speech services, you can integrate speech into your bot, create custom wake words, and author in multiple languages. [Docs]

Adaptive Cards

Adaptive Cards are an open standard for developers to exchange card content in a common and consistent way, and are used by Bot Framework developers to create great cross-channel conversatational experiences.

  • Open framework, native performance - A simple open card format enables an ecosystem of shared tooling, seamless integration between apps, and native cross-platform performance on any device.
  • Speech enabled from day one - We live in an exciting era where users can talk to their devices. Adaptive Cards embrace this new world and were designed from the ground up to support these new experiences.

Contributing

See our contributing guidelines.

Reporting Security Issues

Security issues and bugs should be reported privately, via email, to the Microsoft Security Response Center (MSRC) at secure@microsoft.com. You should receive a response within 24 hours. If for some reason you do not, please follow up via email to ensure we received your original message. Further information, including the MSRC PGP key, can be found in the Security TechCenter.

Copyright (c) Microsoft Corporation. All rights reserved.

NPM DownloadsLast 30 Days