質問をすることでしか得られない、回答やアドバイスがある。

15分調べてもわからないことは、質問しよう!

新規登録して質問してみよう
ただいま回答率
85.49%
Dialogflow

Dialogflowは、Googleが提供している自然言語対話プラットフォーム。音声入力で自然言語の解析を行ってくれる機能で、対話型アプリを簡単に作成することが可能です。

Q&A

0回答

1130閲覧

Dialogflowで記入した名前と日付がスプレットシートに反映されない

PythonEgg

総合スコア1

Dialogflow

Dialogflowは、Googleが提供している自然言語対話プラットフォーム。音声入力で自然言語の解析を行ってくれる機能で、対話型アプリを簡単に作成することが可能です。

0グッド

0クリップ

投稿2020/12/24 08:50

現在、Dialogflowの学習をしておりますが、調べても分からずに困っていることがあり投稿しました。
今行っている学習:

DialogflowのFulfillmentでインラインエディターを書いている

const functions = require('firebase-functions'); const {WebhookClient} = require('dialogflow-fulfillment'); const {Card, Suggestion} = require('dialogflow-fulfillment'); //httpの利用を宣言する const https = require('https'); process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements exports.dialogflowFirebaseFulfillment = functions.https.onRequest((request, response) => { const agent = new WebhookClient({ request, response }); console.log('Dialogflow Request headers: ' + JSON.stringify(request.headers)); console.log('Dialogflow Request body: ' + JSON.stringify(request.body)); function namae(agent) { return new Promise((resolve, reject) => { let context = agent.getContext('hinichi-followup'); let date = context['parameters']['date']; let name = agent.parameters['any']; let url = 'https://script.google.com/macros/s/(spreadsheetID)/exec?date=' + encodeURIComponent(date.substring(1, 10)) +'&name=' + encodeURIComponent(name) ; console.log('request:' + url); //httpのリクエストを送信 let req = https.get(url, (res) => { let chunk = ''; //読み込み中の処理 res.on('data', (c) => { chunk += c; }); //読み込み完了時の処理 res.on('end', () => { //処理終了 resolve(); }); }); //エラー時の処理 req.on('error', (e) => { console.error(`エラー: ${e.message}`); }); }); } function welcome(agent) { agent.add(`Welcome to my agent!`); } function fallback(agent) { agent.add(`I didn't understand`); agent.add(`I'm sorry, can you try again?`); } // Run the proper function handler based on the matched Dialogflow intent name let intentMap = new Map(); intentMap.set('namae', namae); intentMap.set('Default Welcome Intent', welcome); intentMap.set('Default Fallback Intent', fallback); // intentMap.set('your intent name here', yourFunctionHandler); // intentMap.set('your intent name here', googleAssistantHandler); agent.handleRequest(intentMap); });

GASで公開URLを取得

function doGet(e) { var sheet = SpreadsheetApp.openById('spreadsheetID').getSheetByName('シート1'); var result = {}; if (e.parameter == undefined) { //受信に失敗した場合 result['result']= 'NG'; } else { //受信に成功した場合 var date = e.parameter['date']; var name= e.parameter['name']; sheet.appendRow([date, name]); result['result']= 'OK'; } return ContentService.createTextOutput(JSON.stringify(result)); }

直接URLに?date=2020-12-24&name=田中 とブラウザに打ち込むとスプレットシートに反映さますが、Diakogflowからですと記録されません。。
教示頂けたら幸いです。

試行錯誤してDialogflowの何かが動いていない可能性があるかもしれないと思ったのですが理由は以下の通りになります。

・FirebaseはBlazeになっています

・GASのURLでdate=2020-12-24&name=yamadaと記入してブラウザで開いたらスプレットシートに反映されている

・ログでエラー見たらNo responses defined for platform: DIALOGFLOW_CONSOLEとなっている

・DialogflowのDIAGNOSTIC INFOで見たら、

 "webhookStatus": {

"code": 14, "message": "Webhook call failed. Error: UNAVAILABLE."

 となっている

よろしくお願いいたします。

気になる質問をクリップする

クリップした質問は、後からいつでもMYページで確認できます。

またクリップした質問に回答があった際、通知やメールを受け取ることができます。

バッドをするには、ログインかつ

こちらの条件を満たす必要があります。

guest

あなたの回答

tips

太字

斜体

打ち消し線

見出し

引用テキストの挿入

コードの挿入

リンクの挿入

リストの挿入

番号リストの挿入

表の挿入

水平線の挿入

プレビュー

まだ回答がついていません

会員登録して回答してみよう

アカウントをお持ちの方は

15分調べてもわからないことは
teratailで質問しよう!

ただいまの回答率
85.49%

質問をまとめることで
思考を整理して素早く解決

テンプレート機能で
簡単に質問をまとめる

質問する

関連した質問