How to build a voice-enabled grocery chatbot with Azure AI

Published Jan 25 2021 04:25 PM 3,107 Views
Microsoft

Chatbots have become increasingly popular in providing useful and engaging experiences for customers and employees. Azure services allow you to quickly create bots, add intelligence to them using AI, and customize them for complex scenarios.

In this blog, we’ll walk through an exercise which you can complete in under two hours, to get started using Azure AI Services. This intelligent grocery bot app can help you manage your shopping list using voice commands. We’ll provide high level guidance and sample code to get you started, and we encourage you to play around with the code and get creative with your solution!

Features of the application:

iPhoneview.png

  • Add or delete grocery items by dictating them to Alexa.
  • Easily access the grocery list through an app.
  • Check off items using voice commands; for example, “Alexa, remove Apples from my grocery list."
  • Ask Alexa to read the items you have in your grocery list.
  • Automatically organize items by category to help save time at the store.
  • Use any laptop or Web Apps to access the app and sync changes across laptop and phone.

Prerequisites:

 

Key components:

Solution Architecture

App Ref Architecture.png

App Architecture Description: 

  • The user accesses the chatbot by invoking it as an Alexa skill.
  • User is authenticated with Azure Active Directory.
  • User interacts with the chatbot powered by Azure Bot Service; for example, user requests bot to add grocery items to a list.
  • Azure Cognitive Services process the natural language request to understand what the user wants to do. (Note: If you wanted to give your bot its own voice, you can choose from over 200 voices and 54 languages/locales. Try the demo to hear the different natural sounding voices.)
  • The bot adds or removes content in the database.

Another visual of the flow of data within the solution architecture is shown below.

App flow.png

 

 

 

 

 

 

Implementation

High level overview of steps involved in creating the app along with some sample code snippets for illustration:

We’ll start by creating an Azure Bot Service instance, and adding speech capabilities to the bot using the Microsoft Bot Framework and the Alexa skill. Bot Framework, along with Azure Bot Service, provides the tools required to build, test, deploy, and manage the end-to-end bot development workflow. In this example, we are integrating Azure Bot Service with Alexa, which can process speech inputs for our voice-based chatbot. However, for chatbots deployed across multiple channels, and for more advanced scenarios, we recommend using Azure’s Speech service to enable voice-based scenarios. Try the demo to listen to the over 200 high quality voices available across 54 languages and locales.

  1. The first step in the process is to login into Azure portal and follow the steps here to create an Azure Bot Service resource and a web app bot. To add voice capability to the bot, click on channels to add Alexa (see the below snapshot) and note the Alexa Service Endpoint URI.

 Azure Bot Service ChannelsAzure Bot Service Channels

  1. Next, we need to log into the Alexa Developer Console and create an Amazon Alexa skill. After creating the skill, we are presented with the interaction model. Replace the JSON Editor with the below example phrases.

 

 

 

{

  "interactionModel": {

    "languageModel": {

      "invocationName": "Get grocery list",

      "intents": [

        {

          "name": "AMAZON.FallbackIntent",

          "samples": []

        },

        {

          "name": "AMAZON.CancelIntent",

          "samples": []

        },

        {   

          "name": "AMAZON.HelpIntent",

          "samples": []

        },

        {

          "name": "AMAZON.StopIntent",

          "samples": []

        },

        {

          "name": "AMAZON.NavigateHomeIntent",

          "samples": []

        },

        {

          "name": "Get items in the grocery",

          "slots": [

            {

              "name": "name",

              "type": "AMAZON.US_FIRST_NAME"

            }

          ],

          "samples": [

            "Get grocery items in the list",

            "Do I have bread in my list",

           ]

        }

      ],

      "types": []

    }

  }

}

 

 

 

 

  1. Next, we’ll integrate the Alexa Skill with our Azure bot. We’ll need two pieces of information to do this: the Alexa Skill ID and the Alexa Service Endpoint URI. First, get the Skill ID either from the URl in the Alexa portal, or by going to the Alexa Developer Console and clicking “view Skill ID”. The skill ID should be a value like ‘amzn1.ask.skil.A GUID’. Then, get the Alexa Service Endpoint URI from the Azure portal, by going to the channels page of our Azure Web App Bot in the Azure portal, and clicking on Alexa to copy the Alexa Service Endpoint URI. Then integrate as shown:

 

  • Amazon Developer Console: After building the Alexa Skill, click on Endpoint and paste the Alexa Service Endpoint URI that we copied from the Azure portal and save the Endpoints.
    Amazon Developer Console.jpg
  • Azure Portal: Go to the channels page of the Azure Bot, click on Alexa, and paste the Alexa Skill ID that we copied from the Alexa Developer Console.
    Alexa config settings in Azure bot service.jpg

 

  1. Now, we’ll download and the bot locally for testing using the Bot Framework Emulator. Click on “Build” in the Azure Web Bot app to download the source code locally with Bot Framework Emulator. Modify app.py as below:
    # Copyright (c) Microsoft Corporation. All rights reserved.
    # Licensed under the MIT License.
    
    from http import HTTPStatus
    
    from aiohttp import web
    from aiohttp.web import Request, Response, json_response
    from botbuilder.core import (
        BotFrameworkAdapterSettings,
        ConversationState,
        MemoryStorage,
        UserState,
    )
    from botbuilder.core.integration import aiohttp_error_middleware
    from botbuilder.schema import Activity
    
    from config import DefaultConfig
    from dialogs import MainDialog, groceryDialog
    from bots import DialogAndWelcomeBot
    
    from adapter_with_error_handler import AdapterWithErrorHandler
    
    CONFIG = DefaultConfig()
    
    # Create adapter.
    # See https://aka.ms/about-bot-adapter to learn more about how bots work.
    SETTINGS = BotFrameworkAdapterSettings(CONFIG.APP_ID, CONFIG.APP_PASSWORD)
    
    # Create MemoryStorage, UserState and ConversationState
    MEMORY = MemoryStorage()
    USER_STATE = UserState(MEMORY)
    CONVERSATION_STATE = ConversationState(MEMORY)
    
    # Create adapter.
    # See https://aka.ms/about-bot-adapter to learn more about how bots work.
    ADAPTER = AdapterWithErrorHandler(SETTINGS, CONVERSATION_STATE)
    
    # Create dialogs and Bot
    RECOGNIZER = IntelligentGrocery(CONFIG)
    grocery_DIALOG = groceryDialog()
    DIALOG = MainDialog(RECOGNIZER, grocery_DIALOG)
    BOT = DialogAndWelcomeBot(CONVERSATION_STATE, USER_STATE, DIALOG)
    
    # Listen for incoming requests on /api/messages.
    async def messages(req: Request) -> Response:
        # Main bot message handler.
        if "application/json" in req.headers["Content-Type"]:
            body = await req.json()
        else:
            return Response(status=HTTPStatus.UNSUPPORTED_MEDIA_TYPE)
    
        activity = Activity().deserialize(body)
        auth_header = req.headers["Authorization"] if "Authorization" in req.headers else ""
    
        response = await ADAPTER.process_activity(activity, auth_header, BOT.on_turn)
        if response:
            return json_response(data=response.body, status=response.status)
        return Response(status=HTTPStatus.OK)
    
    APP = web.Application(middlewares=[aiohttp_error_middleware])
    APP.router.add_post("/api/messages", messages)
    
    if __name__ == "__main__":
        try:
            web.run_app(APP, host="localhost", port=CONFIG.PORT)
        except Exception as error:
            raise error
    ​
  2. Next, we’ll run and test the bot with Bot Framework Emulator. From the terminal, navigate to the code folder and run pip install -r requirements.txt to install the required packages to run the bot. Once the packages are installed, run python app.py to start the bot. The bot is ready to test as shown below:
    BF Emulator test.jpg}

    Open the bot and add the below port number into the following URL.
    Bot Framework Emulator viewBot Framework Emulator view

 

  1. Now we’re ready to add natural language understanding so the bot can understand user intent. Here, we’ll use Azure’s Language Understanding Cognitive Service (LUIS), to map user input to an “intent” and extract “entities” from the sentence. In the below illustration, the sentence “add milk and eggs to the list” is sent as a text string to the LUIS endpoint. LUIS returns the JSON seen on the right.
    Language Understanding utterances diagramLanguage Understanding utterances diagram

 

  1. Use the below template to create a LUIS JSON model file where we specify intents and entities manually. After the “IntelligentGrocery” app is created in the LUIS portal under “Import New App”, upload the JSON file with the below intents and entities.

 

 

 

{
      "text": "access the groceries list",
      "intent": "Show",
      "entities": [
        {
          "entity": "ListType",
          "startPos": 11,
          "endPos": 19,
          "children": []
        }
      ]
    },
    {
      "text": "add bread to the grocery list",
      "intent": "Add",
      "entities": [
        {
          "entity": "ListType",
          "startPos": 23,
          "endPos": 29,
          "children": []

 

 

 

The above sample intents are for adding items and accessing the items in the grocery list. Now, it’s your turn to add additional intents to perform the below tasks, using the LUIS portal. Learn more about how to create the intents here.

Intents

Name

Description

CheckOff

Mark the grocery items as purchased.

Confirm

Confirm the previous action.

Delete

Delete items from the grocery list.

 

Once the intents and entities are added, we will need to train and publish the model so the LUIS app can recognize utterances pertaining to these grocery list actions.

Language Understanding (LUIS) PortalLanguage Understanding (LUIS) Portal

 

  1. After the model has been published in the LUIS portal, click ‘Access your endpoint Urls’ and copy the primary key, example query and endpoint URL for the prediction resource.
    Language Understanding endpointLanguage Understanding endpoint

    Language Understanding (LUIS) Prediction viewLanguage Understanding (LUIS) Prediction view

Navigate to the Settings page in the LUIS portal to retrieve the App ID.
Application settingsApplication settings

 

  1. Finally, test your Language Understanding model. The endpoint URL will be in the below format, with your own custom subdomain, and app ID and endpoint key replacing APP-ID, and KEY_ID. Go to the end of the URL and enter an intent; for example, “get me all the items from the grocery list”. The JSON result will identify the top scoring intent and prediction with a confidence score. This is a good test to see if LUIS can learn what should be predicted with the intent.

https://YOUR-CUSTOM-SUBDOMAIN.api.cognitive.microsoft.com/luis/prediction/v3.0/apps/APP-ID/slots/pro...

 

Additional Ideas

We’ve now seen how to build a voice bot leveraging Azure services to automate a common task. We hope it gives you a good starting point towards building bots for other scenarios as well. Try out some of the ideas below to continue building upon your bot and exploring additional Azure AI services.

  • Add Google Home assistant as an additional channel to receive voice commands.
  • Add a PictureBot extension to your bot and add pictures of your grocery items. You will need to create intents that trigger actions that the bot can take, and create entities that require these actions. For example, an intent for the PictureBot may be “SearchPics”. This could trigger Azure Cognitive Search to look for photos, using a “facet” entity to know what to search for. See what other functionality you can come up with!
  • Use Azure QnA maker to enable your bot to answer FAQs from a knowledge base. Add a bit of personality using the chit-chat feature.
  • Integrate Azure Personalizer with your voice chatbot to enables the bot to recommend a list of products to the user, providing a personalized experience.
  • Include Azure Speech service to give your bot a custom, high quality voice, with 200+ Text to Speech options across 54 different locales/languages, as well as customizable Speech to Text capabilities to process voice inputs.
  • Try building this bot using Bot Framework Composer, a visual authoring canvas.
1 Comment
Occasional Visitor

Seems issues JSON and also steps are not clear and errors in Alexa.  Can you please bit mension more steps, specially emulation part down load and modify code

%3CLINGO-SUB%20id%3D%22lingo-sub-2096079%22%20slang%3D%22en-US%22%3EHow%20to%20build%20a%20voice-enabled%20grocery%20chatbot%20with%20Azure%20AI%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2096079%22%20slang%3D%22en-US%22%3E%3CP%3EChatbots%20have%20become%20increasingly%20popular%20in%20providing%20useful%20and%20engaging%20experiences%20for%20customers%20and%20employees.%20Azure%20services%20allow%20you%20to%20quickly%20create%20bots%2C%20add%20intelligence%20to%20them%20using%20AI%2C%20and%20customize%20them%20for%20complex%20scenarios.%3C%2FP%3E%0A%3CP%3EIn%20this%20blog%2C%20we%E2%80%99ll%20walk%20through%20an%20exercise%20which%20you%20can%20complete%20in%20under%20two%20hours%2C%20to%20get%20started%20using%20Azure%20AI%20Services.%20This%20intelligent%20grocery%20bot%20app%20can%20help%20you%20manage%20your%20shopping%20list%20using%20voice%20commands.%20We%E2%80%99ll%20provide%20high%20level%20guidance%20and%20sample%20code%20to%20get%20you%20started%2C%20and%20we%20encourage%20you%20to%20play%20around%20with%20the%20code%20and%20get%20creative%20with%20your%20solution!%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EFeatures%20of%20the%20application%3A%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-center%22%20image-alt%3D%22iPhoneview.png%22%20style%3D%22width%3A%20201px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249349iBBA75F61572086FD%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22iPhoneview.png%22%20alt%3D%22iPhoneview.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAdd%20or%20delete%20grocery%20items%20by%20dictating%20them%20to%20Alexa.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CUL%3E%0A%3CLI%3EEasily%20access%20the%20grocery%20list%20through%20an%20app.%3C%2FLI%3E%0A%3CLI%3ECheck%20off%20items%20using%20voice%20commands%3B%20for%20example%2C%20%E2%80%9CAlexa%2C%20remove%20Apples%20from%20my%20grocery%20list.%22%3C%2FLI%3E%0A%3CLI%3EAsk%20Alexa%20to%20read%20the%20items%20you%20have%20in%20your%20grocery%20list.%3C%2FLI%3E%0A%3CLI%3EAutomatically%20organize%20items%20by%20category%20to%20help%20save%20time%20at%20the%20store.%3C%2FLI%3E%0A%3CLI%3EUse%20any%20laptop%20or%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fapp-service%2Fweb%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EWeb%20Apps%3C%2FA%3E%20to%20access%20the%20app%20and%20sync%20changes%20across%20laptop%20and%20phone.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EPrerequisites%3A%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EIf%20you%20don't%20have%20an%20Azure%20subscription%2C%20create%20a%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Ffree%2Fcognitive-services%2F%3FOCID%3DAID3024570%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Efree%20account%3C%2FA%3E%20before%20you%20begin.%20If%20you%20have%20a%20subscription%2C%20log%20in%20to%20the%20%3CA%20href%3D%22https%3A%2F%2Fms.portal.azure.com%2F%23home%3FOCID%3DAID3024570%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20Portal%3C%2FA%3E%3CSPAN%3E.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.developer.amazon.com%2Fen-US%2Falexa%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAmazon%20Alexa%20account%3C%2FA%3E%3C%2FLI%3E%0A%3CLI%3EPython%203.6%20or%20above%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EKey%20components%3A%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fbot-service%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Bot%20Service%3C%2FA%3E%20to%20develop%20bot%20and%20publish%20to%20Alexa%20channel.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fdev.botframework.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EMicrosoft%20Bot%20Framework%20Emulator%3C%2FA%3E%20to%20test%20and%20debug%20bots%20using%20Bot%20Framework%20SDK.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fwww.developer.amazon.com%2Fen-US%2Falexa%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAlexa%20skills%3C%2FA%3E%20to%20interact%20with%20the%20bot%20using%20voice%20commands%20via%20Amazon%20Alexa.%3C%2FLI%3E%0A%3CLI%3E%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Flanguage-understanding-intelligent-service%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ELanguage%20Understanding%3C%2FA%3E%20to%20help%20users%20interact%20with%20the%20bot%20with%20natural%20language%2C%20by%20enabling%20the%20bot%20to%20understand%20user%20intent.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CH2%20id%3D%22toc-hId--549099493%22%20id%3D%22toc-hId--549100174%22%3E%3CSTRONG%3ESolution%20Architecture%20%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3E%3CU%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22App%20Ref%20Architecture.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249350i5120341D7F826E08%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22App%20Ref%20Architecture.png%22%20alt%3D%22App%20Ref%20Architecture.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSPAN%3E%3CSTRONG%3E%3CU%3EApp%20Architecture%20Description%3A%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FSPAN%3E%3CSPAN%3E%3CSTRONG%3E%26nbsp%3B%3C%2FSTRONG%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EThe%20user%20accesses%20the%20chatbot%20by%20invoking%20it%20as%20an%20Alexa%20skill.%3C%2FLI%3E%0A%3CLI%3EUser%20is%20authenticated%20with%20Azure%20Active%20Directory.%3C%2FLI%3E%0A%3CLI%3EUser%20interacts%20with%20the%20chatbot%20powered%20by%20Azure%20Bot%20Service%3B%20for%20example%2C%20user%20requests%20bot%20to%20add%20grocery%20items%20to%20a%20list.%3C%2FLI%3E%0A%3CLI%3EAzure%20Cognitive%20Services%20process%20the%20natural%20language%20request%20to%20understand%20what%20the%20user%20wants%20to%20do.%20(Note%3A%20If%20you%20wanted%20to%20give%20your%20bot%20its%20own%20voice%2C%20you%20can%20choose%20from%20over%20200%20voices%20and%2054%20languages%2Flocales.%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Ftext-to-speech%2F%23features%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETry%20the%20demo%3C%2FA%3E%20to%20hear%20the%20different%20natural%20sounding%20voices.)%3C%2FLI%3E%0A%3CLI%3EThe%20bot%20adds%20or%20removes%20content%20in%20the%20database.%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%3CSPAN%3EAnother%20visual%20of%20the%20flow%20of%20data%20within%20the%20solution%20architecture%20is%20shown%20below.%3C%2FSPAN%3E%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-1938413340%22%20id%3D%22toc-hId-1938412659%22%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-left%22%20image-alt%3D%22App%20flow.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249351i658B09F9C4B31CCA%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22App%20flow.png%22%20alt%3D%22App%20flow.png%22%20%2F%3E%3C%2FSPAN%3E%3C%2FH2%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EImplementation%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CU%3EHigh%20level%20overview%20of%20steps%20involved%20in%20creating%20the%20app%20along%20with%20some%20sample%20code%20snippets%20for%20illustration%3A%3C%2FU%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CP%3EWe%E2%80%99ll%20start%20by%20creating%20an%20Azure%20Bot%20Service%20instance%2C%20and%20adding%20speech%20capabilities%20to%20the%20bot%20using%20the%20Microsoft%20Bot%20Framework%20and%20the%20Alexa%20skill.%20Bot%20Framework%2C%20along%20with%20Azure%20Bot%20Service%2C%20provides%20the%20tools%20required%20to%20build%2C%20test%2C%20deploy%2C%20and%20manage%20the%20end-to-end%20bot%20development%20workflow.%20In%20this%20example%2C%20we%20are%20integrating%20Azure%20Bot%20Service%20with%20Alexa%2C%20which%20can%20process%20speech%20inputs%20for%20our%20voice-based%20chatbot.%20However%2C%20for%20chatbots%20deployed%20across%20multiple%20channels%2C%20and%20for%20more%20advanced%20scenarios%2C%20we%20recommend%20using%20Azure%E2%80%99s%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fspeech-service%2Foverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ESpeech%20service%3C%2FA%3E%20to%20enable%20voice-based%20scenarios.%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Ftext-to-speech%2F%23features%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3ETry%20the%20demo%3C%2FA%3E%20to%20listen%20to%20the%20over%20200%20high%20quality%20voices%20available%20across%2054%20languages%20and%20locales.%3C%2FP%3E%0A%3COL%3E%0A%3CLI%3EThe%20first%20step%20in%20the%20process%20is%20to%20login%20into%20Azure%20portal%20and%20follow%20the%20steps%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fbot-service%2F%23pricing%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E%20to%20create%20an%20Azure%20Bot%20Service%20resource%20and%20a%20web%20app%20bot.%20To%20add%20voice%20capability%20to%20the%20bot%2C%20click%20on%20channels%20to%20add%20Alexa%20(see%20the%20below%20snapshot)%20and%20note%20the%20Alexa%20Service%20Endpoint%20URI.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%3CSTRONG%3E%26nbsp%3B%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Azure%20Bot%20Service%20Channels.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249353iBED4C224680F9538%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Azure%20Bot%20Service%20Channels.png%22%20alt%3D%22Azure%20Bot%20Service%20Channels%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EAzure%20Bot%20Service%20Channels%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%20start%3D%222%22%3E%0A%3CLI%3ENext%2C%20we%20need%20to%20log%20into%20the%20Alexa%20Developer%20Console%20and%20create%20an%20Amazon%20Alexa%20skill.%20After%20creating%20the%20skill%2C%20we%20are%20presented%20with%20the%20interaction%20model.%26nbsp%3B%3CSPAN%3EReplace%20the%20JSON%20Editor%20with%20the%20below%20example%20phrases.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%0A%26nbsp%3B%20%22interactionModel%22%3A%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22languageModel%22%3A%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22invocationName%22%3A%20%22Get%20grocery%20list%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22intents%22%3A%20%5B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22AMAZON.FallbackIntent%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22AMAZON.CancelIntent%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%26nbsp%3B%26nbsp%3B%26nbsp%3B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22AMAZON.HelpIntent%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22AMAZON.StopIntent%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22AMAZON.NavigateHomeIntent%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22Get%20items%20in%20the%20grocery%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22slots%22%3A%20%5B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22name%22%3A%20%22name%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22type%22%3A%20%22AMAZON.US_FIRST_NAME%22%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22samples%22%3A%20%5B%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%22Get%20grocery%20items%20in%20the%20list%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22Do%20I%20have%20bread%20in%20my%20list%22%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%5D%2C%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%22types%22%3A%20%5B%5D%0A%0A%26nbsp%3B%26nbsp%3B%26nbsp%3B%20%7D%0A%0A%26nbsp%3B%20%7D%0A%0A%7D%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%223%22%3E%0A%3CLI%3ENext%2C%20we%E2%80%99ll%20integrate%20the%20Alexa%20Skill%20with%20our%20Azure%20bot.%20We%E2%80%99ll%20need%20two%20pieces%20of%20information%20to%20do%20this%3A%20the%20Alexa%20Skill%20ID%20and%20the%20Alexa%20Service%20Endpoint%20URI.%20First%2C%20get%20the%20Skill%20ID%20either%20from%20the%20URl%20in%20the%20Alexa%20portal%2C%20or%20by%20going%20to%20the%20Alexa%20Developer%20Console%20and%20clicking%20%E2%80%9Cview%20Skill%20ID%E2%80%9D.%20The%20skill%20ID%20should%20be%20a%20value%20like%20%E2%80%98amzn1.ask.skil.A%20GUID%E2%80%99.%20Then%2C%20get%20the%20Alexa%20Service%20Endpoint%20URI%20from%20the%20Azure%20portal%2C%20by%20going%20to%20the%20channels%20page%20of%20our%20Azure%20Web%20App%20Bot%20in%20the%20Azure%20portal%2C%20and%20clicking%20on%20Alexa%20to%20copy%20the%20Alexa%20Service%20Endpoint%20URI.%20Then%20integrate%20as%20shown%3A%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3E%3CSTRONG%3EAmazon%20Developer%20Console%3C%2FSTRONG%3E%3A%20After%20building%20the%20Alexa%20Skill%2C%20click%20on%20Endpoint%20and%20paste%20the%20Alexa%20Service%20Endpoint%20URI%20that%20we%20copied%20from%20the%20Azure%20portal%20and%20save%20the%20Endpoints.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Amazon%20Developer%20Console.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249354i6D082908ABD21583%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Amazon%20Developer%20Console.jpg%22%20alt%3D%22Amazon%20Developer%20Console.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3CLI%3E%3CSTRONG%3EAzure%20Portal%3A%3C%2FSTRONG%3E%20Go%20to%20the%20channels%20page%20of%20the%20Azure%20Bot%2C%20click%20on%20Alexa%2C%20and%20paste%20the%20Alexa%20Skill%20ID%20that%20we%20copied%20from%20the%20Alexa%20Developer%20Console.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22Alexa%20config%20settings%20in%20Azure%20bot%20service.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249355i9D0AAD3055C69612%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22Alexa%20config%20settings%20in%20Azure%20bot%20service.jpg%22%20alt%3D%22Alexa%20config%20settings%20in%20Azure%20bot%20service.jpg%22%20%2F%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%224%22%3E%0A%3CLI%3ENow%2C%20we%E2%80%99ll%20download%20and%20the%20bot%20locally%20for%20testing%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdev.botframework.com%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EBot%20Framework%20Emulator%3C%2FA%3E.%20Click%20on%20%E2%80%9CBuild%E2%80%9D%20in%20the%20Azure%20Web%20Bot%20app%20to%20download%20the%20source%20code%20locally%20with%20Bot%20Framework%20Emulator.%20Modify%20app.py%20as%20below%3A%3CBR%20%2F%3E%3CPRE%20class%3D%22lia-code-sample%20language-python%22%3E%3CCODE%3E%23%20Copyright%20(c)%20Microsoft%20Corporation.%20All%20rights%20reserved.%0A%23%20Licensed%20under%20the%20MIT%20License.%0A%0Afrom%20http%20import%20HTTPStatus%0A%0Afrom%20aiohttp%20import%20web%0Afrom%20aiohttp.web%20import%20Request%2C%20Response%2C%20json_response%0Afrom%20botbuilder.core%20import%20(%0A%20%20%20%20BotFrameworkAdapterSettings%2C%0A%20%20%20%20ConversationState%2C%0A%20%20%20%20MemoryStorage%2C%0A%20%20%20%20UserState%2C%0A)%0Afrom%20botbuilder.core.integration%20import%20aiohttp_error_middleware%0Afrom%20botbuilder.schema%20import%20Activity%0A%0Afrom%20config%20import%20DefaultConfig%0Afrom%20dialogs%20import%20MainDialog%2C%20groceryDialog%0Afrom%20bots%20import%20DialogAndWelcomeBot%0A%0Afrom%20adapter_with_error_handler%20import%20AdapterWithErrorHandler%0A%0ACONFIG%20%3D%20DefaultConfig()%0A%0A%23%20Create%20adapter.%0A%23%20See%20https%3A%2F%2Faka.ms%2Fabout-bot-adapter%20to%20learn%20more%20about%20how%20bots%20work.%0ASETTINGS%20%3D%20BotFrameworkAdapterSettings(CONFIG.APP_ID%2C%20CONFIG.APP_PASSWORD)%0A%0A%23%20Create%20MemoryStorage%2C%20UserState%20and%20ConversationState%0AMEMORY%20%3D%20MemoryStorage()%0AUSER_STATE%20%3D%20UserState(MEMORY)%0ACONVERSATION_STATE%20%3D%20ConversationState(MEMORY)%0A%0A%23%20Create%20adapter.%0A%23%20See%20https%3A%2F%2Faka.ms%2Fabout-bot-adapter%20to%20learn%20more%20about%20how%20bots%20work.%0AADAPTER%20%3D%20AdapterWithErrorHandler(SETTINGS%2C%20CONVERSATION_STATE)%0A%0A%23%20Create%20dialogs%20and%20Bot%0ARECOGNIZER%20%3D%20IntelligentGrocery(CONFIG)%0Agrocery_DIALOG%20%3D%20groceryDialog()%0ADIALOG%20%3D%20MainDialog(RECOGNIZER%2C%20grocery_DIALOG)%0ABOT%20%3D%20DialogAndWelcomeBot(CONVERSATION_STATE%2C%20USER_STATE%2C%20DIALOG)%0A%0A%23%20Listen%20for%20incoming%20requests%20on%20%2Fapi%2Fmessages.%0Aasync%20def%20messages(req%3A%20Request)%20-%26gt%3B%20Response%3A%0A%20%20%20%20%23%20Main%20bot%20message%20handler.%0A%20%20%20%20if%20%22application%2Fjson%22%20in%20req.headers%5B%22Content-Type%22%5D%3A%0A%20%20%20%20%20%20%20%20body%20%3D%20await%20req.json()%0A%20%20%20%20else%3A%0A%20%20%20%20%20%20%20%20return%20Response(status%3DHTTPStatus.UNSUPPORTED_MEDIA_TYPE)%0A%0A%20%20%20%20activity%20%3D%20Activity().deserialize(body)%0A%20%20%20%20auth_header%20%3D%20req.headers%5B%22Authorization%22%5D%20if%20%22Authorization%22%20in%20req.headers%20else%20%22%22%0A%0A%20%20%20%20response%20%3D%20await%20ADAPTER.process_activity(activity%2C%20auth_header%2C%20BOT.on_turn)%0A%20%20%20%20if%20response%3A%0A%20%20%20%20%20%20%20%20return%20json_response(data%3Dresponse.body%2C%20status%3Dresponse.status)%0A%20%20%20%20return%20Response(status%3DHTTPStatus.OK)%0A%0AAPP%20%3D%20web.Application(middlewares%3D%5Baiohttp_error_middleware%5D)%0AAPP.router.add_post(%22%2Fapi%2Fmessages%22%2C%20messages)%0A%0Aif%20__name__%20%3D%3D%20%22__main__%22%3A%0A%20%20%20%20try%3A%0A%20%20%20%20%20%20%20%20web.run_app(APP%2C%20host%3D%22localhost%22%2C%20port%3DCONFIG.PORT)%0A%20%20%20%20except%20Exception%20as%20error%3A%0A%20%20%20%20%20%20%20%20raise%20error%0A%E2%80%8B%3C%2FCODE%3E%3C%2FPRE%3E%3C%2FLI%3E%0A%3CLI%3ENext%2C%20we%E2%80%99ll%20run%20and%20test%20the%20bot%20with%20Bot%20Framework%20Emulator.%20From%20the%20terminal%2C%20navigate%20to%20the%20code%20folder%20and%20run%20pip%20install%20-r%20requirements.txt%20to%20install%20the%20required%20packages%20to%20run%20the%20bot.%20Once%20the%20packages%20are%20installed%2C%20run%20python%20app.py%20to%20start%20the%20bot.%20The%20bot%20is%20ready%20to%20test%20as%20shown%20below%3A%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22BF%20Emulator%20test.jpg%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249358i96872251C2ACD3CA%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22BF%20Emulator%20test.jpg%22%20alt%3D%22BF%20Emulator%20test.jpg%22%20%2F%3E%3C%2FSPAN%3E%7D%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3EOpen%20the%20bot%20and%20add%20the%20below%20port%20number%20into%20the%20following%20URL.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22BF%20Emulator%20screenshot.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249359i544E91ECBB7FE80D%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22BF%20Emulator%20screenshot.png%22%20alt%3D%22Bot%20Framework%20Emulator%20view%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EBot%20Framework%20Emulator%20view%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%226%22%3E%0A%3CLI%3ENow%20we%E2%80%99re%20ready%20to%20add%20natural%20language%20understanding%20so%20the%20bot%20can%20understand%20user%20intent.%20Here%2C%20we%E2%80%99ll%20use%20Azure%E2%80%99s%20Language%20Understanding%20Cognitive%20Service%20(LUIS)%2C%20to%20map%20user%20input%20to%20an%20%E2%80%9C%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fluis%2Fluis-concept-intent%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eintent%3C%2FA%3E%E2%80%9D%20and%20extract%20%E2%80%9C%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fluis%2Fluis-concept-entity-types%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Eentities%3C%2FA%3E%E2%80%9D%20from%20the%20sentence.%20In%20the%20below%20illustration%2C%20the%20sentence%20%E2%80%9Cadd%20milk%20and%20eggs%20to%20the%20list%E2%80%9D%20is%20sent%20as%20a%20text%20string%20to%20the%20LUIS%20endpoint.%20LUIS%20returns%20the%20JSON%20seen%20on%20the%20right.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LUIS%20diagram.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249360i41B0A2780827D409%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LUIS%20diagram.png%22%20alt%3D%22Language%20Understanding%20utterances%20diagram%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ELanguage%20Understanding%20utterances%20diagram%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3COL%20start%3D%227%22%3E%0A%3CLI%3EUse%20the%20below%20template%20to%20create%20a%20LUIS%20JSON%20model%20file%20where%20we%20specify%20intents%20and%20entities%20manually.%20After%20the%20%E2%80%9CIntelligentGrocery%E2%80%9D%20app%20is%20created%20in%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.luis.ai%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ELUIS%20portal%3C%2FA%3E%20under%20%E2%80%9CImport%20New%20App%E2%80%9D%2C%20upload%20the%20JSON%20file%20with%20the%20below%20intents%20and%20entities.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CPRE%20class%3D%22lia-code-sample%20language-json%22%3E%3CCODE%3E%7B%0A%20%20%20%20%20%20%22text%22%3A%20%22access%20the%20groceries%20list%22%2C%0A%20%20%20%20%20%20%22intent%22%3A%20%22Show%22%2C%0A%20%20%20%20%20%20%22entities%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22entity%22%3A%20%22ListType%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22startPos%22%3A%2011%2C%0A%20%20%20%20%20%20%20%20%20%20%22endPos%22%3A%2019%2C%0A%20%20%20%20%20%20%20%20%20%20%22children%22%3A%20%5B%5D%0A%20%20%20%20%20%20%20%20%7D%0A%20%20%20%20%20%20%5D%0A%20%20%20%20%7D%2C%0A%20%20%20%20%7B%0A%20%20%20%20%20%20%22text%22%3A%20%22add%20bread%20to%20the%20grocery%20list%22%2C%0A%20%20%20%20%20%20%22intent%22%3A%20%22Add%22%2C%0A%20%20%20%20%20%20%22entities%22%3A%20%5B%0A%20%20%20%20%20%20%20%20%7B%0A%20%20%20%20%20%20%20%20%20%20%22entity%22%3A%20%22ListType%22%2C%0A%20%20%20%20%20%20%20%20%20%20%22startPos%22%3A%2023%2C%0A%20%20%20%20%20%20%20%20%20%20%22endPos%22%3A%2029%2C%0A%20%20%20%20%20%20%20%20%20%20%22children%22%3A%20%5B%5D%0A%3C%2FCODE%3E%3C%2FPRE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EThe%20above%20sample%20intents%20are%20for%20adding%20items%20and%20accessing%20the%20items%20in%20the%20grocery%20list.%20Now%2C%20it%E2%80%99s%20your%20turn%20to%20add%20additional%20intents%20to%20perform%20the%20below%20tasks%2C%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fwww.luis.ai%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3ELUIS%20portal%3C%2FA%3E.%20Learn%20more%20about%20how%20to%20create%20the%20intents%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fluis%2Fget-started-portal-build-app%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehere%3C%2FA%3E.%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3EIntents%3C%2FSTRONG%3E%3C%2FP%3E%0A%3CTABLE%20width%3D%22624%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22110%22%3E%3CP%3E%3CSTRONG%3EName%20%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22514%22%3E%3CP%3E%3CSTRONG%3EDescription%3C%2FSTRONG%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22110%22%3E%3CP%3ECheckOff%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22514%22%3E%3CP%3EMark%20the%20grocery%20items%20as%20purchased.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22110%22%3E%3CP%3EConfirm%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22514%22%3E%3CP%3EConfirm%20the%20previous%20action.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22110%22%3E%3CP%3EDelete%3C%2FP%3E%0A%3C%2FTD%3E%0A%3CTD%20width%3D%22514%22%3E%3CP%3EDelete%20items%20from%20the%20grocery%20list.%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CP%3EOnce%20the%20intents%20and%20entities%20are%20added%2C%20we%20will%20need%20to%20train%20and%20publish%20the%20model%20so%20the%20LUIS%20app%20can%20recognize%20utterances%20pertaining%20to%20these%20grocery%20list%20actions.%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LUIS%20Portal.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249361i33AF87C4EED5EBA9%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LUIS%20Portal.png%22%20alt%3D%22Language%20Understanding%20(LUIS)%20Portal%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ELanguage%20Understanding%20(LUIS)%20Portal%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FP%3E%0A%3COL%20start%3D%228%22%3E%0A%3CLI%3EAfter%20the%20model%20has%20been%20published%20in%20the%20LUIS%20portal%2C%20click%20%E2%80%98Access%20your%20endpoint%20Urls%E2%80%99%20and%20copy%20the%20primary%20key%2C%20example%20query%20and%20endpoint%20URL%20for%20the%20prediction%20resource.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LUIS%20Build%20endpoint.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249363i329D39E3A396449C%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LUIS%20Build%20endpoint.png%22%20alt%3D%22Language%20Understanding%20endpoint%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ELanguage%20Understanding%20endpoint%3C%2FSPAN%3E%3C%2FSPAN%3E%3CBR%20%2F%3E%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LUIS%20prediction%20resource.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249366i3EFD563A9B93CDBF%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LUIS%20prediction%20resource.png%22%20alt%3D%22Language%20Understanding%20(LUIS)%20Prediction%20view%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3ELanguage%20Understanding%20(LUIS)%20Prediction%20view%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CP%3ENavigate%20to%20the%20Settings%20page%20in%20the%20LUIS%20portal%20to%20retrieve%20the%20App%20ID.%3CBR%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22LUIS%20Settings%20APP%20ID.png%22%20style%3D%22width%3A%20400px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249367iCEEE2DCF7CCB339A%2Fimage-size%2Fmedium%3Fv%3D1.0%26amp%3Bpx%3D400%22%20role%3D%22button%22%20title%3D%22LUIS%20Settings%20APP%20ID.png%22%20alt%3D%22Application%20settings%22%20%2F%3E%3CSPAN%20class%3D%22lia-inline-image-caption%22%20onclick%3D%22event.preventDefault()%3B%22%3EApplication%20settings%3C%2FSPAN%3E%3C%2FSPAN%3E%3C%2FP%3E%0A%3CP%3E%3CSTRONG%3E%3CEM%3E%26nbsp%3B%3C%2FEM%3E%3C%2FSTRONG%3E%3C%2FP%3E%0A%3COL%20start%3D%229%22%3E%0A%3CLI%3EFinally%2C%20test%20your%20Language%20Understanding%20model.%20The%20endpoint%20URL%20will%20be%20in%20the%20below%20format%2C%20with%20your%20own%20custom%20subdomain%2C%20and%20app%20ID%20and%20endpoint%20key%20replacing%20APP-ID%2C%20and%20KEY_ID.%20Go%20to%20the%20end%20of%20the%20URL%20and%20enter%20an%20intent%3B%20for%20example%2C%20%E2%80%9Cget%20me%20all%20the%20items%20from%20the%20grocery%20list%E2%80%9D.%20The%20JSON%20result%20will%20identify%20the%20top%20scoring%20intent%20and%20prediction%20with%20a%20confidence%20score.%20This%20is%20a%20good%20test%20to%20see%20if%20LUIS%20can%20learn%20what%20should%20be%20predicted%20with%20the%20intent.%3C%2FLI%3E%0A%3C%2FOL%3E%0A%3CTABLE%20width%3D%22625%22%3E%0A%3CTBODY%3E%0A%3CTR%3E%0A%3CTD%20width%3D%22625%22%3E%3CP%3E%3CA%20href%3D%22https%3A%2F%2FYOUR-CUSTOM-SUBDOMAIN.api.cognitive.microsoft.com%2Fluis%2Fprediction%2Fv3.0%2Fapps%2FAPP-ID%2Fslots%2Fproduction%2Fpredict%3Fsubscription-key%3DKEY-ID%26amp%3Bverbose%3Dtrue%26amp%3Bshow-all-intents%3Dtrue%26amp%3Blog%3Dtrue%26amp%3Bquery%3DYOUR_QUERY_HERE%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Ehttps%3A%2F%2FYOUR-CUSTOM-SUBDOMAIN.api.cognitive.microsoft.com%2Fluis%2Fprediction%2Fv3.0%2Fapps%2FAPP-ID%2Fslots%2Fproduction%2Fpredict%3Fsubscription-key%3DKEY-ID%26amp%3Bverbose%3Dtrue%26amp%3Bshow-all-intents%3Dtrue%26amp%3Blog%3Dtrue%26amp%3Bquery%3DYOUR_QUERY_HERE%3C%2FA%3E%3C%2FP%3E%0A%3C%2FTD%3E%0A%3C%2FTR%3E%0A%3C%2FTBODY%3E%0A%3C%2FTABLE%3E%0A%3CP%3E%26nbsp%3B%3C%2FP%3E%0A%3CH2%20id%3D%22toc-hId-130958877%22%20id%3D%22toc-hId-130958196%22%3E%3CSTRONG%3EAdditional%20Ideas%3C%2FSTRONG%3E%3C%2FH2%3E%0A%3CP%3EWe%E2%80%99ve%20now%20seen%20how%20to%20build%20a%20voice%20bot%20leveraging%20Azure%20services%20to%20automate%20a%20common%20task.%20We%20hope%20it%20gives%20you%20a%20good%20starting%20point%20towards%20building%20bots%20for%20other%20scenarios%20as%20well.%20Try%20out%20some%20of%20the%20ideas%20below%20to%20continue%20building%20upon%20your%20bot%20and%20exploring%20additional%20Azure%20AI%20services.%3C%2FP%3E%0A%3CUL%3E%0A%3CLI%3EAdd%20Google%20Home%20assistant%20as%20an%20additional%20channel%20to%20receive%20voice%20commands.%3C%2FLI%3E%0A%3CLI%3EAdd%20a%20PictureBot%20extension%20to%20your%20bot%20and%20add%20pictures%20of%20your%20grocery%20items.%20You%20will%20need%20to%20create%20intents%20that%20trigger%20actions%20that%20the%20bot%20can%20take%2C%20and%20create%20entities%20that%20require%20these%20actions.%20For%20example%2C%20an%20intent%20for%20the%20PictureBot%20may%20be%20%E2%80%9CSearchPics%E2%80%9D.%20This%20could%20trigger%20Azure%20Cognitive%20Search%20to%20look%20for%20photos%2C%20using%20a%20%E2%80%9Cfacet%E2%80%9D%20entity%20to%20know%20what%20to%20search%20for.%20See%20what%20other%20functionality%20you%20can%20come%20up%20with!%3C%2FLI%3E%0A%3CLI%3EUse%20%3CA%20href%3D%22https%3A%2F%2Fwww.qnamaker.ai%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20nofollow%20noreferrer%22%3EAzure%20QnA%20maker%3C%2FA%3E%20to%20enable%20your%20bot%20to%20answer%20FAQs%20from%20a%20knowledge%20base.%20Add%20a%20bit%20of%20personality%20using%20the%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fqnamaker%2Fhow-to%2Fchit-chat-knowledge-base%3Ftabs%3Dv1%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3Echit-chat%3C%2FA%3E%20feature.%3C%2FLI%3E%0A%3CLI%3EIntegrate%20%3CA%20href%3D%22https%3A%2F%2Fazure.microsoft.com%2Fen-us%2Fservices%2Fcognitive-services%2Fpersonalizer%2F%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Personalizer%3C%2FA%3E%20with%20your%20voice%20chatbot%20to%20enables%20the%20bot%20to%20recommend%20a%20list%20of%20products%20to%20the%20user%2C%20providing%20a%20personalized%20experience.%3C%2FLI%3E%0A%3CLI%3EInclude%20%3CA%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fazure%2Fcognitive-services%2Fspeech-service%2Foverview%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EAzure%20Speech%20service%3C%2FA%3E%20to%20give%20your%20bot%20a%20custom%2C%20high%20quality%20voice%2C%20with%20200%2B%20Text%20to%20Speech%20options%20across%2054%20different%20locales%2Flanguages%2C%20as%20well%20as%20customizable%20Speech%20to%20Text%20capabilities%20to%20process%20voice%20inputs.%3C%2FLI%3E%0A%3CLI%3ETry%20building%20this%20bot%20using%20%3CA%20style%3D%22font-family%3A%20inherit%3B%20background-color%3A%20%23ffffff%3B%22%20href%3D%22https%3A%2F%2Fdocs.microsoft.com%2Fen-us%2Fcomposer%2Fintroduction%22%20target%3D%22_blank%22%20rel%3D%22noopener%20noreferrer%22%3EBot%20Framework%20Composer%3C%2FA%3E%3CSPAN%20style%3D%22font-family%3A%20inherit%3B%22%3E%2C%20a%20visual%20authoring%20canvas.%3C%2FSPAN%3E%3C%2FLI%3E%0A%3C%2FUL%3E%3C%2FLINGO-BODY%3E%3CLINGO-TEASER%20id%3D%22lingo-teaser-2096079%22%20slang%3D%22en-US%22%3E%3CP%3E%3CSPAN%20class%3D%22lia-inline-image-display-wrapper%20lia-image-align-inline%22%20image-alt%3D%22grocery%20chatbot%20image.png%22%20style%3D%22width%3A%20740px%3B%22%3E%3CIMG%20src%3D%22https%3A%2F%2Ftechcommunity.microsoft.com%2Ft5%2Fimage%2Fserverpage%2Fimage-id%2F249385iA33F9D1CDC9014A4%2Fimage-size%2Flarge%3Fv%3D1.0%26amp%3Bpx%3D999%22%20role%3D%22button%22%20title%3D%22grocery%20chatbot%20image.png%22%20alt%3D%22grocery%20chatbot%20image.png%22%20%2F%3E%3C%2FSPAN%3ELearn%20how%20to%20build%20an%20app%20to%20help%20you%20easily%20manage%20your%20grocery%20list%2C%20with%20Azure%20AI.%3C%2FP%3E%3C%2FLINGO-TEASER%3E%3CLINGO-LABS%20id%3D%22lingo-labs-2096079%22%20slang%3D%22en-US%22%3E%3CLINGO-LABEL%3EAzure%20Bot%20Service%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EBot%20Framework%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ECognitive%20Services%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3EConversational%20AI%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ELanguage%20Understanding%20(LUIS)%3C%2FLINGO-LABEL%3E%3CLINGO-LABEL%3ESpeech%3C%2FLINGO-LABEL%3E%3C%2FLINGO-LABS%3E
Version history
Last update:
‎Jan 25 2021 04:30 PM
Updated by: