Movatterモバイル変換


[0]ホーム

URL:


Skip to main content

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft EdgeMore info about Internet Explorer and Microsoft Edge
Table of contentsExit focus mode

Create a bot with the Bot Framework SDK

  • 2024-10-09
Feedback

In this article

APPLIES TO: SDK v4

This article describes how to build your first bot with the Bot Framework SDK for C#, Java, JavaScript or Python, and how to test your bot with the Bot Framework Emulator.

Creating your first bot doesn't require an Azure subscription or an Azure AI Bot Service resource. This quickstart focuses on creating your first bot locally. If you'd like to learn how to create a bot in Azure, seeCreate an Azure Bot resource.

Note

To build agents with your choice of AI services, orchestration, and knowledge, consider using the Microsoft 365 Agents SDK. The Agents SDK has support for C#, JavaScript or Python. You can learn more about the Agents SDK ataka.ms/agents. If you're looking for a SaaS-based agent platform, considerMicrosoft Copilot Studio. If you have an existing bot built with the Bot Framework SDK, you can update your bot to the Agents SDK. You can review the core changes and updates atBot Framework SDK to Agents SDK migration guidance. Support tickets for the Bot Framework SDK will no longer be serviced as of December 31, 2025.

Prerequisites

C# templates

The current bot samples use .NET Core 3.1 templates.

To add the bot templates to Visual Studio, download and install theBot Framework v4 SDK Templates for Visual Studio VSIX file.

Note

You can install the templates from within Visual Studio.

  1. In the menu, selectExtensions thenManage Extensions.
  2. In theManage Extensions dialog, search for and installBot Framework v4 SDK templates for Visual Studio.

For information about deploying .NET bots to Azure, see how toProvision and publish a bot.

Create a bot

In Visual Studio, create a new bot project and use theEcho Bot (Bot Framework v4 - .NET Core 3.1) template. To see only bot templates, choose theAI Bots project type.

Thanks to the template, your project contains all the necessary code to create the bot in this quickstart. You don't need any more code to test your bot.

Start your bot

In Visual Studio:

  1. Open your bot project.
  2. Run the project without debugging.
  3. Visual Studio builds the application, deploys it to localhost, and launches the web browser to display the application'sdefault.htm page.

At this point, your bot is running locally on port 3978.

Start the Emulator and connect your bot

  1. Start the Bot Framework Emulator.

  2. SelectOpen Bot on the Emulator'sWelcome tab.

  3. Enter your bot's URL, which is your local host and port, with/api/messages added to the path. The address is usually:http://localhost:3978/api/messages.

    open a bot

  4. Then selectConnect.

    Send a message to your bot, and the bot will respond back.

    echo message

Next steps

  • For information about how to debug using Visual Studio or Visual Studio Code and the Bot Framework Emulator, seeDebug a bot.
  • For information about devtunnel, seeTunneling (devtunnel).

In this article