question

Jiggybyte avatar image
Jiggybyte asked

Amazon Echo in .Net

Hello fellow .Net developers! I am wondering if anyone has taken the time thus far to post a working "hello world" .Net example for Echo? I have some code that I feel is very close to working and I am sure I can stumble along and find it eventually, but it would be incredibly useful to have a working (very simple) proof of concept app to compare to, if anyone has one to share. MVC/Web API/WebForms...whatever would be awesome. If we can get some good examples here, I really feel like there's a lot we can do with Echo. Thanks in advance if anyone has code to share. ps - not sure if it is against the NDA or not to set up a TFS or Git repo for this Echo code? Anyone official reps have any thoughts? Just easier than posting a bunch of classes here. Maybe someone at Amazon could post a zip file of an example equivalent to the Java sample?
alexa skills kitdebugging
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jiggybyte avatar image
Jiggybyte answered
In case anyone is actually looking, and feel like helping. I don't see what else I can do to diagnose my issue without some technical insight here. Here is my response header as viewed through Chrome dev tools, when requesting my appliction... Cache-Control:private Content-Encoding:gzip Content-Length:293 Content-Type:application/json; charset=utf-8 Date:Tue, 21 Apr 2015 00:59:44 GMT Server:Microsoft-IIS/8.0 Vary:Accept-Encoding X-AspNet-Version:4.0.30319 X-AspNetMvc-Version:4.0 X-Powered-By: ASP.NET And here is my actual response... {"version":"1.0","response":{"outputSpeech":{"type":"PlainText","text":"Amazon, please help."},"card":{"type":"Simple","title":"Testing Sub","subtitle":"The truth is...","content":"This will never be seen."},"shouldEndSession":"true"}} And my card... Content-Length Error Request Identifier: amzn1.echo-api.request.677435da-e7d4-442b-8f33-0365f08129c6 Application response did not provide a Content-Length header
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Capron avatar image
Jeff Capron answered
I don't have a .NET example, but I can show you a PHP endpoint response: header('Content-Type: application/json;charset=UTF-8'); $text = '{ "version" : "1.0", "response" : { "outputSpeech" : { "type" : "PlainText", "text" : "Hello World!" }, "shouldEndSession" : false } }'; header('Content-Length: ' . strlen($text)); echo $text;
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Kruse avatar image
Matt Kruse answered
Jeff, do you have that hosted anywhere with https? Have you tested it with the Echo? I'd like to hit it and see the exact output. There isn't any magic here. I'm not sure why it wouldn't be working exactly the same in .Net or, in my case, Node.js.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Joshua Babcock avatar image
Joshua Babcock answered
I also had problem, and here are the things I did to resolve it (not sure which if just one was needed since I did them together): 1. I'm using MVC, and initially I was using a JsonResult as my return value, but instead I moved to a string and am using the Newtonsoft.Json library to serialize my object to JSON. 2. Thinking that maybe GZIP was messing with the content length and causing it not to match my response, I disabled compression for my project using a web.config setting: Hope that helps.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jeff Capron avatar image
Jeff Capron answered
> Jeff, do you have that hosted anywhere with https? > Have you tested it with the Echo? I'd like to hit it > and see the exact output. There isn't any magic here. > I'm not sure why it wouldn't be working exactly the > same in .Net or, in my case, Node.js. Nowhere that I can really post about it publicly. Here is a video demonstration: http://www.echoforum.com/threads/amazon-echo-sdk-private-beta-released.12/ You can PM me there (the poster of that thread) and I will see if I can set up something for you.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

aholmes0 avatar image
aholmes0 answered
Hi elrumpo, Do you have a Microsoft account? I can grant you access to my repository on Visual Studio Online. I've written an application in ASP.NET WebApi 2 that serves a variety of platforms, including the Echo. Message was edited by: aholmes0
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Ron Dunlevy avatar image
Ron Dunlevy answered
Hi All, I made a fun little echo app called "Chuck Norris Facts" in .NET (VB). You can get the code here: http://www.rondu.com/chucknorrisfacts.7z. It contains the intent and utterences. If you'd like to hook up your Echo, point the URL to https://www.rondu.com/Amazon/Echo/ChuckNorrisFacts/Endpoint.ashx. I usually use "Alexa open Chuck Norris Facts" to get a response. Let me know what you think. Thanks
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jiggybyte avatar image
Jiggybyte answered
I do have a microsoft account! That would be awesome to see some working code with intents. Aaron, how can I contact you for info? I FINALLY have a very simple hello world endpoint working. Much thanks to the VB code here as well as the tip to turn off the compression. I think the compression was what did it in the end, but the VB code led me down another path that will probably make my life easier in the end. So, thanks to all. I will happily post a stripped down simple example soon if anyone needs it.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Jiggybyte avatar image
Jiggybyte answered
Thanks to the VB code and the compression tip here in the comments, I have a C# app working. I can post a stripped down version if anyone needs it for reference.
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.

Matt Kruse avatar image
Matt Kruse answered
If you re-enable compression, does it stop working? I'm trying to serve from Node.js, and I can't see anything about it bring compressed by default, nor any way to disable compression. Shouldn't it show up in a header or something if it is compressed?
10 |5000

Up to 2 attachments (including images) can be used with a maximum of 512.0 KiB each and 1.0 MiB total.