Search code examples
botframeworkasp.net-apicontroller

Where is MessagesController : ApiController in the SDK 4 bot framework template


I am not able to find Api Controllers in my bot template that I downloaded fomr my Web app bot. Where should "public class MessagesController : ApiController" reside?

Thank you


Solution

  • The programming model in V4 is new and doesn't use controllers. Instead you create a class that implements IBot which you then register using idiomatic .NET Core configuration APIs during startup. Specifically you call services.AddBot<YourBot>(…) in ConfigureServices and then appBuilder.UseBotFramework() in Configure.

    You can take a look at Startup.cs from the "empty" bot in the samples to see an example of this.

    From there I suggest reading the "How Bots Work" documentation for V4 to get a good high level overview of the core concepts, such as turns and the turn context, in V4.