Tutorial: Create and test a bot

APPLIES TO: Composer v1.x and v2.x

This tutorial shows you how to create a basic bot.

You will learn how to:

  • Create a basic bot using Bot Framework Composer
  • Run the bot locally and test it using the Bot Framework Emulator


Create the bot

The first step in creating a bot with Composer is to start a project from a template. This will create a new folder on your local computer with all the files necessary to build, test and run the bot.

  1. Start Composer.

  2. Select + Create new.

  3. Select the C# Empty Bot template. Then select Next.

    Select the C# Empty Bot template

    The Empty Bot template creates a bot with two triggers:

    • Greeting: when a user connects to the bot, sends the user a greeting.
    • Unknown intent: when the user sends a message the bot doesn't recognize, the bot sends a message telling the user it did not understand.
  4. Now fill in the following values on the Create your bot project window:

    1. Name: weather_bot
    2. Runtime type: Select Azure Web App
    3. Location: Select a location to store your bot.
  5. Select Submit to create a bot from the template. Note that this may take a few moments.

    After creating the bot, Composer will load the bot's main dialog.


    A dialog contains one or more triggers that define the actions available to the bot while the dialog is active. When you create a new bot, an Activities trigger of type Greeting (ConversationUpdate activity) is automatically provisioned. Triggers help your dialog capture events of interest and respond to them using actions.

  6. Select the Greeting trigger on the left. Scroll to the bottom and select the Send a response action.

  7. Select the text on the right (Welcome to your bot). Delete the text and replace it with the following:

     Welcome to the weather bot! Say "weather" to get started.

    Your screen should look like the following:

    Send a response updated with new message

Your bot is now ready to test.

Test the bot

Now that your new bot has its first simple feature, you can launch it in Web Chat and verify that it works.

  1. Select Start bot in the upper right corner of the screen. This tells Composer to launch the bot's runtime, which is powered by the Bot Framework SDK.

    Start bot button, top right of Composer


    After selecting Start bot, the button text changes to Starting bot. Once the bot's runtime is running, it switches to Restart bot.

  2. Once the bot's runtime has started, the Local bot runtime manager will open. You can also select the icon on the right of the text Restart bot, to open and close the Local bot runtime manager.

  3. Select Open Web Chat in the Local bot runtime manager.

    Local runtime manager

  4. The Web Chat pane will appear on the right, and you should be greeted with the message in the Greeting trigger. Try typing anything to activate the Unknown intent trigger.

  5. When you're done, you can stop the bot by selecting the Stop Bot button in the lower left of the Local bot runtime manager.

You now have a working bot, and you're ready to add more functionality!

Next steps