AWS Lambda、Node.js、Alexa Skills Kitを使用してAlexaスキルを開発しています。 -nodejs-fact project & &が正常にデプロイされました。サンプルファクトプロジェクトがテストされました。次に、いくつかのFacebookフィードの投稿を読むためにそのコードを変更しようとしています。投稿を読むことができるノードアプリケーションを開発しようとしました。&、あなたのreference.IのコードFBモジュール使用の下に - https://www.npmjs.com/package/fbAWS Lambda、Node.js、Alexaスキルキットを使用してFacebook投稿を読むことができるAlexaスキル
const FB = require('fb');
FB.setAccessToken('abc');
const query='cnninternational/posts';
FB.api(query, function (res) {
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
return;
}
console.log(res);
});
次へ]を、私はタラの上に統合しようとしましたこれらのコードを使用してFacebookの投稿を読むことはできませんでした。下のパネルでそのコードブロックを見つけてください。また、雲のログも確認しました。「GetNewsIntent」が表示されていますが、ログに "fb-init"、 "fb-error"または "fb-exit"のエントリが表示されませんでした。確かにログにもエラーはありません。誰かがその問題を解決することができれば幸いです。
'use strict';
const Alexa = require('alexa-sdk');
const FB = require('fb');
const APP_ID = 'abc';
const SKILL_NAME = 'test';
const GET_FACT_MESSAGE = "Here's your news: ";
const STOP_MESSAGE = 'Goodbye!';
exports.handler = function(event, context, callback) {
var alexa = Alexa.handler(event, context);
alexa.appId = APP_ID;
alexa.registerHandlers(handlers);
alexa.execute();
};
const handlers = {
'LaunchRequest': function() {
this.emit('GetNewsIntent');
},
'GetNewsIntent': function() {
console.log('GetNewsIntent');
const speechOutput = GET_FACT_MESSAGE;
const query='cnninternational/posts';
FB.setAccessToken('abc');
FB.api(query, function (res) {
console.log('fb-init');
if(!res || res.error) {
console.log(!res ? 'error occurred' : res.error);
console.log('fb-error');
return;
}
console.log(res);
speechOutput = speechOutput + res;
console.log('fb-exit');
});
this.response.cardRenderer(SKILL_NAME, speechOutput);
this.response.speak(speechOutput);
this.emit(':responseReady');
},
'AMAZON.StopIntent': function() {
this.response.speak(STOP_MESSAGE);
this.emit(':responseReady');
},
};
あなたの応答Ben.Yesのためのおかげで、私did.Iはthis.event.session.user.accessToken.Accountリンクの値が成功しているハードコード。 –