Automating Customer Interactions with Bots – Contoso Flowers, Part 1

If your organisation is seeking ways to lower the cost of its customer interactions, while simultaneously appearing to be innovative, fun and modern, then Bots should be your next new customer channel.  (Social media is sooo last year).

Microsoft’s Bot Framework is a great new toolkit that enables you to build human-like dialogs between your customers and your Bot, with the purpose of transacting a specific business scenario – for example, ordering a product.

In Part 1 of this walk-through, I’ll show you to set up the ‘Contoso Flowers’ Bot in Skype to demo a customer interacting with the Bot in order to buy some flowers.

In Part 2 (which I’ve not written yet), we’ll modify the Bot code to create an actual order record in Microsoft Dynamics 365.


Contoso Flowers

Contoso Flowers is a bot demo you can find in the Microsoft BotBuilder-Samples on GitHub, it makes a great demo because it showcases a whole bunch of cool Bot Framework features, including Carousels, Cards and Bing Maps integration.

BTW, I’m not taking credit for the fantastic Bot code (that credit goes to people far more clever than me!), all I’m doing is explaining how to string together the different elements involved.



For this walk-through, you will need:

  1. The C# “demo-ContosoFlowers” folder downloaded from BotBuilder-Samples
  2. Microsoft Visual Studio 2015
  3. The Bot Emulator installed from here
  4. An Azure subscription
  5. Visual Studio Tools for Azure installed


Step 1 – Create your Bot

  1. Go to the Bot Framework, sign in, then click Register a bot
  2. In the Bot Profile section, add a Name, Handle and DescriptionRegisterBot1
  3. Upload an Icon if you wish
  4. In the Configuration section, enter

    This URL is just a placeholder, we’ll update it later once we know the URL of the Azure Web App where we deploy our bot.
  5. Click Create Microsoft App ID and password
  6. Note these down
  7. Click Create an app password to continue
  8. IMPORTANT: note this down, you won’t get another chance!
  9. Click Finish and go back to bot framework
  10. Confirm the legal bits then click Register

Now you’ll see all the channels where we’ll later be able to deploy our Bot, cool huh?!


Step 2 – Bot Code

  1. Open the ContosoFlowers solution downloaded from Pre-Requisite 1 in Visual Studio 2015
  2. Open Web.config
  3. Under appSettings, enter your BotID (Bot Handle), Microsoft App ID and Microsoft App Password for the Bot you created in Step 1BotAppSettings
  4. Save
  5. Build Solution


Step 3 – Test in the Bot Emulator

At this point, the code should “just work” – but there’s no harm in testing anyway.

  1. In Visual Studio, select Debug, Any CPU, Microsoft Edge

  2. Start debugging by clicking Microsoft Edge
  3. A new browser window will pop up in Edge, copy the URL of this browser window (which should be http://localhost:xxxx)URLBot
  4. Append /api/messages to the end of the URL
  5. Open the Bot Emulator from Pre-Requisite 3
  6. Paste the whole, appended URL into the endpoint URL of the Bot EmulatorBotEmulator
  7. Enter your Bot’s Microsoft App ID and Microsoft App Password created in Step 1
  8. Click Connect
  9. If all’s running well, you’ll now be able to interact with your Bot in the emulatorContosoFlowersTest
  10. Stop Debugging


Step 4 – Deploy your Bot Code to Azure

Now we’re happy that our bot is working as expected, we can send him (or her) up to its new home in Azure.

  1. Log on to Azure:
  2. Click New, Web + Mobile, Web App, then click Create
  3. Give your Web App a name, then select a Subscription, Resource Group and LocationWebAppBot
  4. Click Create
  5. Once the deployment has completed, note down the URL of the Web App (this is what we’ll be replacing our placeholder with shortly)URLofWebApp
  6. Back in Visual Studio, right-mouse click on the ContosoFlowers solution in the Solution Explorer, click Publish


  7. In the Select a Publish Target dialog box, click Microsoft Azure App Service


  8. If you’ve got the Visual Studio Tools for Azure installed as per Pre-Requisite 5, and you’ve already signed into your Azure account within Visual Studio, then you’ll simply be presented with a list of your existing Azure Web Apps (in their resource groups). Select the Web App you created above and click OK


  9. Your connection settings will now be automatically populated in the next dialog, click Publish


Step 5 – Add your Bot to Skype

  1. Back in the Bot Framework, click on My bots then select your ContosoFlowers bot
  2. In the Details section, click Edit
  3. Take the URL of the Web App you created in Step 4
    1. add an “s” after “http”
    2. append /api/messages to the end of the URL
    3. use this amended URL to replace the placeholder in the messaging endpoint
  4. Click Save Changes
  5. Click Test to test the bot connection.  If all goes well you should see the “Endpoint authorization succeeded” message


  6. In the list of channels, click the Edit button next to Skype


  7. In the Settings dialog, ensure Enable the bot on Skype, Messages Types and Cards are all switched On


  8. Click I’m done configuring
  9. Click Add to Skype


  10. Then start chatting with your Bot!


Some final thoughts…

  1. I noticed the Bot doesn’t successfully add to Skype Preview (if you’re a Windows 10 user and have Skype Preview).  Best to add to ‘normal’ Skype first, then open in Skype Preview after, if this is your preferred client
  2. You’ll need to add the Bot to your Skype contacts before you can start interacting with it
  3. I assume, like me, you’re only building your bot to demo and play around with, therefore there’s no need to Publish your bot via the Bot Framework and make it publically accessible
  4. If you’re halfway through a bot conversation and want to start again, type stop
  5. In Part 2 of this post (not yet written), I’ll modify the Bot Code to integrate back to Dynamics 365



One thought on “Automating Customer Interactions with Bots – Contoso Flowers, Part 1

  1. Patiently looking forward to your Post 2 on this! Only blog about this advanced bot demo out there. Show how to turn it into a production tool and monetize your video.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s