[英]Alexa skill not responding after uploading data to firesbase
我已經在 alexa 開發人員控制台中開發了我的項目,並且已經發送到 firebase (Firestore),但是在 firebase (firestore) 中創建集合后 Alexa 沒有發送響應。下面是我的代碼:
const Alexa = require('ask-sdk-core');
const admin1 = require("firebase-admin");
const serviceAccount = require('./serviceAccountKey.json');
databaseURL="https://alexa-db8fe.firebaseio.com";
admin1.initializeApp({
credential: admin1.credential.cert(serviceAccount),
databaseURL: "https://alexa-db8fe.firebaseio.com"
});
var db = admin1.firestore();
const LaunchRequestHandler = {
canHandle(handlerInput) {
return Alexa.getRequestType(handlerInput.requestEnvelope) === 'LaunchRequest';
},
handle(handlerInput) {
var documentReference = db.collection('menu1').doc('namedoc');
documentReference.get().then(documentSnapshot=>
{
if(documentSnapshot.exists){
let speakOutput1 =('Document Exists');
return handlerInput.responseBuilder
.speak(speakOutput1)
.reprompt(speakOutput1)
.getResponse();
}
else{
let speakOutput2 =('Document does not Exists');
return handlerInput.responseBuilder
.speak(speakOutput2)
.reprompt(speakOutput2)
.getResponse();
}
});
}};
代碼var documentReference = db.collection('menu1').doc('namedoc');
正在正確創建一個新的集合和一個文檔,但是 alexa 沒有說下面的響應“文檔存在”,它說的是執行 etcc 時出現問題......任何人都可以幫助解決這個問題嗎?
嘗試:
return documentReference.get().then...
只需返回您從回調函數返回的對象。 Alexa 只是不知道該說什么,因為您沒有在handle
方法的末尾返回響應對象。
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.