Skip to content

dervink/Whetstone.Alexa.AdventureSample

 
 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

52 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Whetstone.Alexa.AdventureSample

This sample project shows how to develop and test an Alexa Skill using .NET Core.

Introduction

Alexa skills can be developed using either Alexa Lambda functions or a REST API endpoint. Lambda function are are Amazon's implementation of serverless functions available in AWS. We, at Whetstone Technologies, deploy our production Alexa Skills backed by Lambda functions; however, they are not ease to debug. You can send log messages to CloudWatch, but you can't step into a breakpoint of a .NET Core Lambda function. While there are services, like RookOut, for Node and Python, that allow for live debugging of Lambda functions, I am not aware of any similar services for .NET Core as of this writing.

This makes live debugging of Alexa requests a challenge. The solution we have applied is to wrap meaningful logic in a .NET Standard class library and stand up both a REST API project for debugging and development and a Lambda function project for production deployment.

Local Environment Configuration for Azure

Audio, image, and configuration files are used in this sample. To use the files locally in preparation for deployment to Azure, use the Azure blob storage emulator. This section illustrates how to create the storage containers and upload files for local testing.

Download and install the Azure Storage Emulator and the Azure Powershell. Also, download nGrok and sign up for a free account. This will be used to capture requests from Alexa directly on the development machine.

Installing the Microsoft Azure Storage Emulator

  1. Launch the Microsoft Azure Storage Emulator by searching for it in the Windows search bar.

  1. Initialize the Microsoft Azure Storage Emulator by opening a DOS command prompt. Execute the following to initialize the emulator:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator> AzureStorageEmulator.exe init
  1. Start the Microsoft Azure Storage Emulator:
C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator> AzureStorageEmulator.exe start
  1. Optionally, configure the Microsoft Azure Storage Emulator to begin on login.

    • Use the Windows search bar to find and launch Task Scheduler.

    • Create a new Azure Storage Emulator task by selecting Create Task.

    • Select the Tiggers tab and create a new trigger. Select the dropdown combo box next to "Begin the task:" and select "At log on"

    • Select the Actions tab and create a new action. Leave the default entry, "Start a program", in the Action selection.

      Enter the following in the Program/Script box:

      "C:\Program Files (x86)\Microsoft SDKs\Azure\Storage Emulator\AzureStorageEmulator.exe"
      

      Enter start in the Add Arguments text box.

    • Click Ok.

Installing Azure Powershell

Open a Powershell command prompt with admin rights and execute:

Install-Module -Name Az -AllowClobber

If you have the a prior version of Azure Powershell installed, uninstall the AzureRm module:

Uninstall-AzureRm

This next step assumes you have singed up for an Azure account. If you have not done so, please go to the Azure Portal before taking the next step.

Run Connect-AzAccount and log in with the same account used to connect to the Azure portal.

Connect-AzAccount

Installing nGrok

Navigate to nGrok and sign up for a free account. This entitles you to create a public-facing endpoint that routes to your development machine. Download the nGrok executable for Windows, extract it and place it in your path so it can be referenced easily while debugging.

Verify that it is installed by opening a command prompt and launching it:

ngrok http 54768

This should launch a temporary server.

For more references about using nGrok, please see How To Debug An Alexa .NET Core Skill

About

Sample Choose Your Own Adventure Alexa Skill Developed on .NET

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • C# 89.1%
  • PowerShell 9.0%
  • JavaScript 1.9%