Learn to create a simple flight booking chatbot using Microsoft Bot Framework SDK in C#. Enhance your skills with step-by-step guidance on building efficient and interactive bots.
Introduction
Creating a flight booking chatbot can significantly enhance user experience by providing quick and efficient service. In this blog, we will walk you through the process of building a simple flight booking chatbot using the Microsoft Bot Framework SDK in C#. This powerful framework allows developers to create and deploy sophisticated bots with ease. Whether you’re a seasoned developer or new to bot development, our step-by-step guide will help you master the essential techniques and best practices for creating a responsive and user-friendly chatbot. Get ready to streamline flight bookings and improve customer satisfaction with your very own chatbot!
You can find all the parts for this series atย WhatsApp ChatGPT using .NET C# | Beginner Friendly Series.
Complete Video
Prerequisites
Before you start building your flight booking chatbot with the Microsoft Bot Framework SDK in C#, ensure you have the following:
- Basic Knowledge of C# and .NET: Familiarity with C# programming and the .NET framework is essential.
- Visual Studio: Install the latest version of Visual Studio with the ASP.NET and web development workload.
- Microsoft Bot Framework SDK Templates: Get it from Downloads Page
- Bot Framework Emulator: Download and install the Bot Framework Emulator to test your bot locally.
With these prerequisites in place, you are ready to start developing your flight booking chatbot.
Step 1: Create a new Project on Visual Studio
Open Visual Studio 2022 or 2019 and create a new project. Under project types, select AI Bots. Choose the project type Core Bot (Bot Framework v4 – .NET Core 3.1). Note that this will actually create the project in .NET 6, which we will upgrade to .NET 8 after the project is created.

Name the project and choose a location for it. Then click on Create.

If you installed the ASP.NET Web Development workload in Visual Studio with only .NET 8 installed, you might see a warning message in the Solution Explorer indicating that the targeted version of .NET is not installed. No worries, we will upgrade this in the next step.

Step 2: Upgrade the Project to .NET 8
Right-click on the project and select Properties. Alternatively, you can press Alt+Enter on your keyboard.

Change the target framework to .NET 8 and save the project.

Step 3: Upgrade Dependencies to Support target framework .NET 8
In the Solution Explorer, right-click on Dependencies and select Manage NuGet Packages.

Navigate to the Updates tab, select all packages, and then click on Update.

Your dependencies may still display a warning icon. Don’t worry; simply save all changes, close Visual Studio, and reopen the project. This should resolve the dependencies.
Step 4: Run the project and Test in Emulator
Start the project by running it without debugging. Alternatively, press Ctrl+F5 on the keyboard to run the project.

Launch the Bot Framework Emulator and click on “Open Bot.”

Enter the bot URL as “http://localhost:3978/api/messages”. Verify that the port number matches the one your project is running on (typically 3978). Click “Connect” to proceed.

Go ahead and start interacting with the bot.

Conclusion
We’ve successfully created our first flight booking bot using Microsoft Bot Framework SDK in C# and tested it using the Bot Framework Emulator.


Leave a Reply