Azure Bot Service SDK

MSDN Docs

Overview

The Azure Bot Service SDK provides a set of libraries, tools, and templates that help you build, test, and publish intelligent bots on Azure. It supports Bot Framework, Language Understanding (LUIS), and integration with Azure Cognitive Services.

Whether you are creating a simple echo bot or a sophisticated AI-driven conversational agent, the SDK streamlines development with robust abstractions and ready‑to‑use connectors.

Get Started

  1. Create a new bot project using the dotnet new or yo botbuilder generator.
  2. Configure your bot’s appsettings.json with the Azure app registration credentials.
  3. Run the bot locally with dotnet run or npm start and test using the Bot Framework Emulator.
  4. Deploy to Azure via the deployment guide.
dotnet new -i Microsoft.Bot.Framework.CSharp.EchoBot
dotnet new echobot -n MyFirstBot
cd MyFirstBot
dotnet run

Installation

Choose the language runtime you prefer:

.NET (C#)

dotnet add package Microsoft.Bot.Builder
dotnet add package Microsoft.Bot.Builder.Integration.AspNet.Core
dotnet add package Microsoft.Bot.Schema

Node.js (JavaScript/TypeScript)

npm i botbuilder botbuilder-dialogs botbuilder-ai

Python

pip install botbuilder-core botbuilder-dialogs botbuilder-ai

Code Samples

Below are common patterns you may need while developing bots.

Echo Bot (C#)

public class EchoBot : ActivityHandler
{
    protected override async Task OnMessageActivityAsync(ITurnContext<IMessageActivity> turnContext,
                                                          CancellationToken cancellationToken)
    {
        var reply = MessageFactory.Text($"You said: {turnContext.Activity.Text}");
        await turnContext.SendActivityAsync(reply, cancellationToken);
    }
}

Echo Bot (Node.js)

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

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

module.exports.EchoBot = EchoBot;

API Reference

Explore the full SDK reference:

Resources