通过实现 Web 服务将自定义技能托管到 Alexa [英] Hosting a custom skill to Alexa by implementing a web service

查看:21
本文介绍了通过实现 Web 服务将自定义技能托管到 Alexa的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发一个 Web 服务,用于处理 Alexa 发送的请求,并在 .net 框架中以特定响应进行响应.Alexa 以 JSON 格式发送到您的服务的请求正文,如下所示:

I am working on developing a web service which is used to Handling Requests Sent by Alexa and respond back with specific response in .net framework. The request body sent by Alexa to your service in JSON format like below :

{
  "version": "string",
  "session": {
    "new": true,
    "sessionId": "string",
    "application": {
      "applicationId": "string"
    },
    "attributes": {
      "string": {}
    },
    "user": {
      "userId": "string",
      "accessToken": "string"
    }
  },
  "context": {
    "System": {
      "application": {
        "applicationId": "string"
      },
      "user": {
        "userId": "string",
        "accessToken": "string"
      },
      "device": {
        "supportedInterfaces": {
          "AudioPlayer": {}
        }
      }
    },
    "AudioPlayer": {
      "token": "string",
      "offsetInMilliseconds": 0,
      "playerActivity": "string"
    }
  },
  "request": {}
}

响应正文语法如下Json格式:

{
  "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": "string",
        "playBehavior": "string",
        "audioItem": {
          "stream": {
            "token": "string",
            "url": "string",
            "offsetInMilliseconds": 0
          }
        }
      }
    ],
    "shouldEndSession": boolean
  }
}

我在亚马逊开发者论坛上进行了研究 将自定义技能托管为 Web 服务 , 处理 Alexa 发送的请求但我无法实现这一目标,还有一件事我没有使用 Lambda 功能我想制作自定义技能,但我的位置不在美国北部.

I researched on Amazon Developer Forum Hosting a Custom Skill as a Web Service , Handling Requests Sent by Alexabut i am not able to achieve this thing and one thing i am not using Lambda function i want to make a custom skill and my location is not in North US.

我得到了 Lib.来自 github 此处 并在我的网络服务中使用但无法与此库同步,任何人都可以给我一个方向,我该怎么做,或者我如何开始,提前致谢.

I got the Lib. from github here and used in my web service but not able to sync with this library, anyone here to give me a direction how can i do this or how can i started thanks in advance.

推荐答案

我刚刚发布了一个项目,该项目使用您提到的相同 AlexaSkillsKit.NET 包.目标是帮助每个人使用 .NET + Visual Studio 创建 Alexa 自定义技能,您可以轻松地将其部署到 Azure.

I've just published a project that uses the same AlexaSkillsKit.NET package that you mention. The goal is to help everyone create Alexa Custom Skills using .NET + Visual Studio that you can easily deploy to Azure.

https://github.com/tamhinsf/Azure4Alexa

有一个示例技能实现,您可以将其用作您自己的自定义技能的模式.它利用了 httpClient 和通常的异步模式.

There's a sample skill implementation that you can use as a pattern for your own Custom Skill. It makes use of httpClient and the usual async patterns.

只需下载并启动 Visual Studio 即可开始使用!

Just download and fire up Visual Studio to get started!

这篇关于通过实现 Web 服务将自定义技能托管到 Alexa的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆