【问题标题】:I want to save a users name我想保存用户名
【发布时间】:2017-09-07 02:32:07
【问题描述】:

我想为我正在制作的警报技能保存用户名。每当启动该技能时,它都会询问用户名。我将如何保存名称,以便在闹钟响起时显示“早上好!{在此处插入名称}”

【问题讨论】:

  • 您看过 DynamoDB(或其他一些商店,但 DynamoDB 往往很容易集成)吗?
  • 我已经研究过了,一直无法使用,你有好的教程吗?

标签: node.js amazon-web-services lambda alexa-skills-kit


【解决方案1】:

首先,您需要为用户名创建一个自定义槽(它也可以在没有自定义槽的情况下工作,但最好添加一个)。然后您可以在“事件”对象中捕获您的槽值(如果您使用 AWS Lambda 来执行您的代码)。如果您使用的是 http 端点,那么您将在那里获得插槽值。请找到示例代码。首先在 Launch 请求中(不使用 AWS Alexa SDK),

if (request.type === "LaunchRequest") {
        context.succeed(buildResponse({
            speechText: "Please tell you name?",
            repromptText: "You can say for example, Vijay",
            endSession: false
        }));} 

然后你的意图,

if (request.intent.name === "YourIntent") {
      if (request.intent.slots.name !== undefined)
      var name = request.intent.slots.name.value;
//Build your response here by appending name
}

你的示例话语是,

MyFortuneIntent {name}

其中 {name} 将是您的自定义插槽。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2018-03-27
    • 1970-01-01
    • 2021-07-21
    • 1970-01-01
    • 2019-06-11
    • 1970-01-01
    • 2020-10-27
    • 1970-01-01
    相关资源
    最近更新 更多