From 1585d38351d4a2f513b70f96cc284d9236730b0e Mon Sep 17 00:00:00 2001 From: Tim Heuer Date: Wed, 8 Mar 2017 07:06:36 -0800 Subject: [PATCH 1/2] Added samples about reprompt in readme --- README.md | 68 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 68 insertions(+) diff --git a/README.md b/README.md index 76cf089..54a91e3 100644 --- a/README.md +++ b/README.md @@ -66,3 +66,71 @@ var finalResponse = ResponseBuilder.TellWithCard(speech, "Your Card Title", "You return finalResponse; ``` + +## Build a simple response with a reprompt +If you want to reprompt the user, use the Ask helpers +```csharp +// create the speech response +var speech = new Alexa.NET.Response.SsmlOutputSpeech(); +speech.Ssml = "Today is ????0922."; + +// create the speech reprompt +var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); +repromptMessage.Text = "Would you like to know what tomorrow is?"; + +// create the reprompt +var repromptBody = new Alexa.NET.Response.Reprompt(); +repromptBody.OutputSpeech = repromptMessage; + +// create the response +var finalResponse = ResponseBuilder.Ask(speech, repromptBody); +return finalResponse; +``` + +## Build a response without using helpers +If you do not want to use the helper Tell/Ask functions for the simple structure you +can build up the response manually using the ```Response``` and some ```IOutputSpeech``` objects. +```csharp +// create the speech response - you most likely will still have this +var speech = new Alexa.NET.Response.SsmlOutputSpeech(); +speech.Ssml = "Today is ????0922."; + +// create the response +var responseBody = new Alexa.NET.Response.ResponseBody(); +responseBody.OutputSpeech = speech; +responseBody.ShouldEndSession = true; + +var skillResponse = new Alexa.NET.Response.SkillResponse(); +skillResponse.Response = responseBody; +skillResponse.Version = "1.0"; + +return skillResponse; +``` + +## Build a reprompt without using helpers +To add reprompt to the response you just need to include that as well. +```csharp +// create the speech response - you most likely will still have this +var speech = new Alexa.NET.Response.SsmlOutputSpeech(); +speech.Ssml = "Today is ????0922."; + +// create the reprompt speech +var repromptMessage = new Alexa.NET.Response.PlainTextOutputSpeech(); +repromptMessage.Text = "Would you like to know what tomorrow is?"; + +// create the reprompt object +var repromptBody = new Alexa.NET.Response.Reprompt(); +repromptBody.OutputSpeech = repromptMessage; + +// create the response +var responseBody = new Alexa.NET.Response.ResponseBody(); +responseBody.OutputSpeech = speech; +responseBody.ShouldEndSession = false; // this triggers the reprompt +responseBody.Reprompt = repromptBody; + +var skillResponse = new Alexa.NET.Response.SkillResponse(); +skillResponse.Response = responseBody; +skillResponse.Version = "1.0"; + +return skillResponse; +``` \ No newline at end of file From 9724020cd3e1b67d29f8f09cf900e9a106624055 Mon Sep 17 00:00:00 2001 From: Tim Heuer Date: Wed, 8 Mar 2017 21:26:23 -0800 Subject: [PATCH 2/2] Update project.json --- Alexa.NET/project.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Alexa.NET/project.json b/Alexa.NET/project.json index e0f5843..3c25fc1 100644 --- a/Alexa.NET/project.json +++ b/Alexa.NET/project.json @@ -1,7 +1,7 @@ { "name": "Alexa.NET", "title": "Alexa.NET", - "version": "1.0.0-beta-2", + "version": "1.0.0-beta-3", "authors": [ "Tim Heuer" ], "description": "A simple .NET Core library for handling Alexa Skill request/responses.", @@ -27,6 +27,6 @@ "repository": { "url": "https://github.com/timheuer/alexa-skills-dotnet" }, "requireLicenseAcceptance": false, "tags": [ "amazon", "alexa", "echo", "dot", "echo dot", "skills" ], - "releaseNotes": "Updated to include Locale" + "releaseNotes": "Updated to include Locale and Audio request support." } }