2017-12-29 32 views
2

LaunchRequest를 통해 스킬을 열었을 때 사용자를 한 인 텐트로 리디렉션하려는 Alexa 스킬에서 작업하고 있습니다.LaunchRequest 내에서 다른 Alexa 인 텐트 호출하기

  • 사용자 LaunchRequest이를 받아 다른 의도에 요청을 전달 Open xyz skill
  • 말한다. this.emit('AnotherIntent')
  • AnotherIntent은 그 기능을 위해 필요한 SLOT를 갖는다.
  • 필자는 SLOT을 필요에 따라 설정했으며 AnotherIntent은 자체적으로 호출 할 때 완벽하게 작동합니다.

그러나 스킬을 시작하고 위의 2 단계에서 언급 한대로 AnotherIntent을 호출하려고하면 Alexa 기술이 시작되지 않습니다.

이 시나리오에 대한 기술 빌더 내에서 동일한 Alexa 스킬을 테스트하면 출력 json이 올바르게 SLOT을 추출한 것을 보여줍니다. Echo 장치에서 실행하려고 할 때 무슨 일이 일어나고 있는지 확실하지 않습니다.

저는 AlexJ 처리기를 배치하기 위해 NodeJS와 Lambda를 사용하고 있습니다.

도움을 주시면 감사하겠습니다.

핸들러 - - 주석에 기초

더 참조

var handlers = { 
'LaunchRequest': function() { 
    console.log("LaunchRequest::" + JSON.stringify(this.event.request)); 
    this.emit('fooIntent'); 
}, 
'SessionEndedRequest': function() { 
    console.log('session ended!'); 
}, 
'fooIntent': function() { 
    const intentObj = this.event.request.intent; 
    if (!intentObj || (intentObj && !intentObj.slots.WHEN.value)) { 
     console.log('fooIntent::UserId' + this.event.session.user.userId); 
     const slotToElicit = 'WHEN'; 
     const speechOutput = 'Ask a question here ?'; 
     const repromptSpeech = speechOutput; 
     console.log("emitting elict now"); 
     this.emit(':elicitSlot', slotToElicit, speechOutput, repromptSpeech); 
    } else { 
     // SLOT is filled, let's query the database to get the value for the slot. 
     console.log("fooIntent intent:something is requested for " + this.event.request.intent.slots.WHEN.value); 
     // All the slots are filled (And confirmed if you choose to confirm slot/intent) 
     fooIntentFunction(this,this.event.request.intent.slots.WHEN.value); 
    } 
}, 
'AMAZON.HelpIntent': function() { 
    var speechOutput = "Need to come up with one."; 
    var reprompt = "What can I help you with?"; 
    this.emit(':ask', speechOutput, reprompt); 
}, 
'AMAZON.CancelIntent': function() { 
    this.emit(':tell', 'Goodbye!'); 
}, 
'AMAZON.StopIntent': function() { 
    this.emit(':tell', 'Goodbye!'); 
} 

}; LaunchRequest에서 호출 할 때 LaunchRequest

에서 캡처

JSON 요청은

{ 
"type": "LaunchRequest", 
"requestId": "amzn1.echo-api.request.972bb705-d181-495e-bf60-991f2bd8fbb1", 
"timestamp": "2017-12-30T21:35:21Z", 
"locale": "en-US" 
} 

JSON 요청은 텐트에서 캡처. 그것은 intent가 설정되어 있지 않음을 보여줍니다. 위와 같이 fooIntent 구현에서 끌어 내려고 시도 할 때 이것이 계속 실패하는 이유라고 생각합니다.

{ 
    "type": "LaunchRequest", 
    "requestId": "amzn1.echo-api.request.972bb705-d181-495e-bf60-991f2bd8fbb1", 
    "timestamp": "2017-12-30T21:35:21Z", 
    "locale": "en-US" 
} 
  • 미트

답변

1

Amazon's documentation에 지정된대로 대화 인터페이스는 특정 목적의 필요한 모든 슬롯을 해소하기 위해 개발되었다 :

질문과 답변이 수집하는 의도를 모든 인 텐트의 필수 슬롯에 대한 값을 확인하십시오. 인 텐트에 필요한 모든 슬롯이 채워지고 확인 될 때까지 대화가 계속됩니다.

귀하의 경우 사용자의 요청이 의도적 (즉, IntentRequest 유형)이 아니라 LaunchRequest입니다. 따라서 인 텐트 핸들러가 처리하더라도 인터랙션 모델은없고 끌어낼 슬롯도 없다.

당신은 당신의 스킬,

알렉사처럼 깊은 호출과 의도 한대로 작동 샌드위치 의도 경우, 또는에서 (나에게 샌드위치

를 만들기 위해 XYZ 기술을 말할 수 있어야

당신의 경우는 fooIntent이고, 유도 할 슬롯은 WHEN입니다.

희망이 도움이됩니다.

+0

감사합니다. 나는 launchrequest에서 호출 할 의도로'this.event.request.intent.slots.foo.value'를 볼 수 없습니다. 위의 질문을 콘솔에서 볼 수있는 요청과 핸들러 용 코드로 업데이트했습니다. – Amit

+0

안녕하세요. @amit, 내 대답을 확장하여 이제 귀하의 사례를 다루어야합니다. 스킬의 행동을 설명해 준다면 알려주세요! –

+0

안녕하세요. 회신 해 주셔서 감사합니다. 나는 어제 문서를 읽은 후 동일하게 추리했다. 이제 사용자에게 LaunchRequest 내에서 간단한 환영 메시지와 함께 Intent를 호출하도록 요청합니다. 그러나 '요청'에서 '의도'를 불러내는 능력은 좋았을 것입니다. 대화 및 위임 모델이 마음에 들었다. – Amit