Key concepts in the Bot Builder SDK for .NET

Note

This topic applies to SDK v3 release. You can find the documentation for the latest version of the SDK v4 here.

This article introduces key concepts in the Bot Builder SDK for .NET.

Connector

The Bot Framework Connector provides a single REST API that enables a bot to communicate across multiple channels such as Skype, Email, Slack, and more. It facilitates communication between bot and user by relaying messages from bot to channel and from channel to bot.

In the Bot Builder SDK for .NET, the Connector library enables access to the Connector.

Activity

The Connector uses an Activity object to pass information back and forth between bot and channel (user). The most common type of activity is message, but there are other activity types that can be used to communicate various types of information to a bot or channel.

For details about Activities in the Bot Builder SDK for .NET, see Activities overview.

Dialog

When you create a bot using the Bot Builder SDK for .NET, you can use dialogs to model a conversation and manage conversation flow. A dialog can be composed of other dialogs to maximize reuse, and a dialog context maintains the stack of dialogs that are active in the conversation at any point in time. A conversation that comprises dialogs is portable across computers, which makes it possible for your bot implementation to scale.

In the Bot Builder SDK for .NET, the Builder library enables you to manage dialogs.

FormFlow

You can use FormFlow within the Bot Builder SDK for .NET to streamline of building a bot that collects information from the user. For example, a bot that takes sandwich orders must collect several pieces of information from the user such as type of bread, choice of toppings, size, and so on. Given basic guidelines, FormFlow can automatically generate the dialogs necessary to manage a guided conversation like this.

State

The Bot Builder Framework enables your bot to store and retrieve state data that is associated with a user, a conversation, or a specific user within the context of a specific conversation. State data can be used for many purposes, such as determining where the prior conversation left off or simply greeting a returning user by name. If you store a user's preferences, you can use that information to customize the conversation the next time you chat. For example, you might alert the user to a news article about a topic that interests them, or alert a user when an appointment becomes available.

For testing and prototyping purposes, you can use the Bot Builder Framework's in-memory data storage. For production bots, you can implement your own storage adapter or use one of Azure Extensions. The Azure Extensions allow you to store your bot's state data in either Table Storage, CosmosDB, or SQL. This article will show you how to use the in-memory storage adapter to store your bot's state data.

Important

The Bot Framework State Service API is not recommended for production environments, and may be deprecated in a future release. It is recommended that you update your bot code to use the in-memory storage adapter for testing purposes or use one of the Azure Extensions for production bots.

For details about managing state using the Bot Builder SDK for .NET, see Manage state data.

Naming conventions

The Bot Builder SDK for .NET library uses strongly-typed, Pascal-cased naming conventions. However, the JSON messages that are transported back and forth over the wire use camel-case naming conventions. For example, the C# property ReplyToId is serialized as replyToId in the JSON message that's transported over the wire.

Security

You should ensure that your bot's endpoint can only be called by the Bot Framework Connector service. For more information on this topic, see Secure your bot.

Next steps

Now you know the concepts behind every bot. You can quickly build a bot using Visual Studio using a template. Next, study each key concept in more detail, starting with dialogs.