托管我自己的服务 (.NET) - Alexa 的有效响应是什么?
Hosting my own service (.NET) - what is a valid response for Alexa?
我在 Azure 上托管我自己的服务 (HTTPS) - 我选择了 'my endpoint is a subdomain with a wildcard cert'
我正在使用 Alexa.NET 来制作回复。
我可以验证模拟器是否命中我的端点(我进行了远程调试并看到断点被命中)并且我知道我的端点正在返回这个(我在 Postman 中试过了)
{
"Version": "1.0",
"SessionAttributes": null,
"Response": {
"OutputSpeech": {
"Type": "PlainText",
"Text": "test successful"
},
"Card": null,
"Reprompt": null,
"ShouldEndSession": true,
"Directives": []
}
}
我找不到任何关于响应应该是什么样子的文档。我想我可以尝试使用 lambda 函数创建相同的东西...
有人对我可以尝试什么有什么建议吗?托管我自己的服务的整个过程非常令人沮丧...
{
"version": "string",
"sessionAttributes": {
"string": "<object>"
},
"response": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
},
"card": {
"type": "string",
"title": "string",
"content": "string",
"text": "string",
"image": {
"smallImageUrl": "string",
"largeImageUrl": "string"
}
},
"reprompt": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
}
},
"directives": [
{
"type": "Display.RenderTemplate",
"template": {
"type": "string"
...
}
},
{
"type": "AudioPlayer",
"playBehavior": "string",
"audioItem": {
"stream": {
"token": "string",
"url": "string",
"offsetInMilliseconds": 0
}
}
},
{
"general": {
"type": "VideoApp.Launch",
"videoItem": {
"source": "string",
"metadata": {
"title": "string",
"subtitle": "string"
}
}
}
}
],
"shouldEndSession": boolean
}
}
这是因为我的名字以大写字母开头。 Friggin Javascript 序列化器....
但感谢 Vijay 对文档的指导。
在 .NET mvc 中,这是使 属性 名称小写的方法:
return JsonConvert.SerializeObject(alexaSkillResponse, new JsonSerializerSettings {
ContractResolver = new CamelCasePropertyNamesContractResolver()
});
我在 Azure 上托管我自己的服务 (HTTPS) - 我选择了 'my endpoint is a subdomain with a wildcard cert'
我正在使用 Alexa.NET 来制作回复。
我可以验证模拟器是否命中我的端点(我进行了远程调试并看到断点被命中)并且我知道我的端点正在返回这个(我在 Postman 中试过了)
{
"Version": "1.0",
"SessionAttributes": null,
"Response": {
"OutputSpeech": {
"Type": "PlainText",
"Text": "test successful"
},
"Card": null,
"Reprompt": null,
"ShouldEndSession": true,
"Directives": []
}
}
我找不到任何关于响应应该是什么样子的文档。我想我可以尝试使用 lambda 函数创建相同的东西...
有人对我可以尝试什么有什么建议吗?托管我自己的服务的整个过程非常令人沮丧...
{
"version": "string",
"sessionAttributes": {
"string": "<object>"
},
"response": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
},
"card": {
"type": "string",
"title": "string",
"content": "string",
"text": "string",
"image": {
"smallImageUrl": "string",
"largeImageUrl": "string"
}
},
"reprompt": {
"outputSpeech": {
"type": "string",
"text": "string",
"ssml": "string"
}
},
"directives": [
{
"type": "Display.RenderTemplate",
"template": {
"type": "string"
...
}
},
{
"type": "AudioPlayer",
"playBehavior": "string",
"audioItem": {
"stream": {
"token": "string",
"url": "string",
"offsetInMilliseconds": 0
}
}
},
{
"general": {
"type": "VideoApp.Launch",
"videoItem": {
"source": "string",
"metadata": {
"title": "string",
"subtitle": "string"
}
}
}
}
],
"shouldEndSession": boolean
}
}
这是因为我的名字以大写字母开头。 Friggin Javascript 序列化器....
但感谢 Vijay 对文档的指导。
在 .NET mvc 中,这是使 属性 名称小写的方法:
return JsonConvert.SerializeObject(alexaSkillResponse, new JsonSerializerSettings {
ContractResolver = new CamelCasePropertyNamesContractResolver()
});