Alexa:无法更新DynamoDB表

时间:2018-12-18 19:44:10

标签: node.js aws-lambda amazon-dynamodb alexa alexa-skills-kit

我有一个Alexa技能,询问您的名字,然后在整个技能中使用您的名字。但是,当它完成启动请求时,我得到了。我给它起了我的名字,它直接指向未处理的意图(输出语音为“我没有得到正确的响应”),而不是GetNameIntent。当我访问DynamoDB表时,得到以下内容

enter image description here enter image description here

'use strict';
const Alexa = require('alexa-sdk');

exports.handler = function(event, context, callback) {
  const alexa = Alexa.handler(event, context, callback);
  alexa.dynamoDBTableName = "my table name";
  alexa.APP_ID = "My ID";
  alexa.registerHandlers(handlers);
  alexa.execute();
};
 var handlers = {
  'LaunchRequest': function() {
    var userName = this.attributes['userName'];
     if (!userName) {
        this.emit('LaunchIntent');
     } else {
       this.emit('WelcomeBackIntent');
     }
  },

  'LaunchIntent': function() {
    const response =  "<audio src='soundbank://soundlibrary/ui/gameshow/amzn_ui_sfx_gameshow_bridge_01'/>" +
                      "My aim is to help you improve your flexibility. " +
                      "To get started what is your first name? ";

    const reprompt =  "Try saying your first name";



    this.emit(':askWithCard', response, reprompt, 'Hello  ', 'Good' + getWish() + ' ', ;

  },

  "GetNameIntent": function() {
    this.attributes['userName'] = this.event.request.intent.slots.FirstName.value;
    var FirstName = this.attributes['userName'];

    if(FirstName) {
      this.emit(':ask', `Hey ${FirstName}! You can ask me for instructions. Or you can start a session. Say instructions. Or say start a session.`);
    } else {
      this.emit(':ask', `Sorry, I didn\t get your name!`, `Tell me your name by saying, My name is, and then your name`);
    }

'Unhandled': function() {
     this.emit(':tell', "I did not get a proper response. Please open the skill again by saying open three minute meditation ");
   }

我已经设置了IAM并选择了完整的数据库访问权限。并已在交互模型中使用FirstName和AMAZON.FirstName作为插槽设置了GetNameIntent(使用英语),还使用了AMAZON.US_FIRSTNAME(使用美国语言)相同的问题

0 个答案:

没有答案