Deploying code from local environment to Google Action/Dialogflow: Nothing happens
up vote
0
down vote
favorite
I am trying to make a Google Action in Dialogflow. More specifically I am trying to deploy javaScript code from my terminal. A few days ago the code worked perfectly.
The index.js file that works:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
var admin = require("firebase-admin");
var serviceAccount = require("./pathToAccountKey);
let count = 0
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://voice-c5a55.firebaseio.com/"
});
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 welcome(agent) {
agent.add(`Welkom gekke banaan!`);
}
function fallback(agent) {
let conv = agent.conv();
count++
console.log("count is " + count)
if (count === 1){
agent.add(`poging 1`)
} else if (count === 2) {
agent.add(`nu 2`);
} else {
return agent.close('Te laat')
};
}
function voting(agent) {
let conv = agent.conv(); // Get Actions on Google library conv instance
let endConversation = false;
let responseText = '';
let singer = agent.parameters['kleur'];
if ( singer !== '' ) {
let artistName = singer.replace(' ', ''). toLowerCase();
let currentArtist = admin.database().ref().child('/artists/' + artistName);
currentArtist.once('value', function (snapshot) {
if ( snapshot.exists() && snapshot.hasChild('votes') ) {
let obj = snapshot.val();
currentArtist.update({
votes: obj.votes + 1
})
} else {
currentArtist.set({
votes: 1
})
}
});
responseText = 'Thanks man voor je stem!';
} else {
fallback();
}
if ( endConversation ) {
conv.close(responseText);
} else {
conv.ask(responseText);
}
agent.add(responseText);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('kleur stemmen', voting);
The problem is that there seems to be no connection between my local environment and the Actions console. The package.json contains everything there needs to be. I really do not know what to do, again I could deploy and test this code a few days ago but now just nothing happens.
I installed all dependencies using NPM, so that can not be a problem in my opinion. Again, it worked perfectly fine a few days ago. I also checked if all the fulfillments for webhook were enabled, they were.
The deployment from the terminal does not throw any errors. However when I try to test it in the Action Simulator I get the following error:
{
"responseMetadata": {
"status": {
"code": 10,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"@type": "type.googleapis.com/google.protobuf.Value",
"value": "{"id":"ea987ebc-670b-4fd4-b002-dce3a21910eb","timestamp":"2018-11-07T15:33:16.59Z","lang":"nl","result":{},"status":{"code":200,"errorType":"success"},"sessionId":"ABwppHEMJQALun_4R3ESqXJoEO8JoIs1P9riNuLpNMYbHfGT6XLhxo4EQaj6vmDe1ks-jUZG7-l6A9JkIaE"}"
}
]
}
}
}
So it seems to me that something goes wrong in the connection between my terminal and the console. I would really love to get an answer to this question!
UPDATE:
I tried to deploy using
firebase deploy
The deployment throws no errors whatsoever and reacts exactly the way it did when the code did work so there seems to be no problem there. I also checked if i was in the correct directory.Nothing appears in the Firebase logs. As you can see in the code something should appear there but it doesn't.
Screenshot from the Dialogflow Fulfillment page.
- Intent handlers are added to the code, they were in there but I copied and pasted it badly.
javascript npm webhooks dialogflow actions-on-google
add a comment |
up vote
0
down vote
favorite
I am trying to make a Google Action in Dialogflow. More specifically I am trying to deploy javaScript code from my terminal. A few days ago the code worked perfectly.
The index.js file that works:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
var admin = require("firebase-admin");
var serviceAccount = require("./pathToAccountKey);
let count = 0
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://voice-c5a55.firebaseio.com/"
});
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 welcome(agent) {
agent.add(`Welkom gekke banaan!`);
}
function fallback(agent) {
let conv = agent.conv();
count++
console.log("count is " + count)
if (count === 1){
agent.add(`poging 1`)
} else if (count === 2) {
agent.add(`nu 2`);
} else {
return agent.close('Te laat')
};
}
function voting(agent) {
let conv = agent.conv(); // Get Actions on Google library conv instance
let endConversation = false;
let responseText = '';
let singer = agent.parameters['kleur'];
if ( singer !== '' ) {
let artistName = singer.replace(' ', ''). toLowerCase();
let currentArtist = admin.database().ref().child('/artists/' + artistName);
currentArtist.once('value', function (snapshot) {
if ( snapshot.exists() && snapshot.hasChild('votes') ) {
let obj = snapshot.val();
currentArtist.update({
votes: obj.votes + 1
})
} else {
currentArtist.set({
votes: 1
})
}
});
responseText = 'Thanks man voor je stem!';
} else {
fallback();
}
if ( endConversation ) {
conv.close(responseText);
} else {
conv.ask(responseText);
}
agent.add(responseText);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('kleur stemmen', voting);
The problem is that there seems to be no connection between my local environment and the Actions console. The package.json contains everything there needs to be. I really do not know what to do, again I could deploy and test this code a few days ago but now just nothing happens.
I installed all dependencies using NPM, so that can not be a problem in my opinion. Again, it worked perfectly fine a few days ago. I also checked if all the fulfillments for webhook were enabled, they were.
The deployment from the terminal does not throw any errors. However when I try to test it in the Action Simulator I get the following error:
{
"responseMetadata": {
"status": {
"code": 10,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"@type": "type.googleapis.com/google.protobuf.Value",
"value": "{"id":"ea987ebc-670b-4fd4-b002-dce3a21910eb","timestamp":"2018-11-07T15:33:16.59Z","lang":"nl","result":{},"status":{"code":200,"errorType":"success"},"sessionId":"ABwppHEMJQALun_4R3ESqXJoEO8JoIs1P9riNuLpNMYbHfGT6XLhxo4EQaj6vmDe1ks-jUZG7-l6A9JkIaE"}"
}
]
}
}
}
So it seems to me that something goes wrong in the connection between my terminal and the console. I would really love to get an answer to this question!
UPDATE:
I tried to deploy using
firebase deploy
The deployment throws no errors whatsoever and reacts exactly the way it did when the code did work so there seems to be no problem there. I also checked if i was in the correct directory.Nothing appears in the Firebase logs. As you can see in the code something should appear there but it doesn't.
Screenshot from the Dialogflow Fulfillment page.
- Intent handlers are added to the code, they were in there but I copied and pasted it badly.
javascript npm webhooks dialogflow actions-on-google
By saying you're deploying it, do you mean deploying it usingfirebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?
– Prisoner
Nov 7 at 17:52
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I am trying to make a Google Action in Dialogflow. More specifically I am trying to deploy javaScript code from my terminal. A few days ago the code worked perfectly.
The index.js file that works:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
var admin = require("firebase-admin");
var serviceAccount = require("./pathToAccountKey);
let count = 0
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://voice-c5a55.firebaseio.com/"
});
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 welcome(agent) {
agent.add(`Welkom gekke banaan!`);
}
function fallback(agent) {
let conv = agent.conv();
count++
console.log("count is " + count)
if (count === 1){
agent.add(`poging 1`)
} else if (count === 2) {
agent.add(`nu 2`);
} else {
return agent.close('Te laat')
};
}
function voting(agent) {
let conv = agent.conv(); // Get Actions on Google library conv instance
let endConversation = false;
let responseText = '';
let singer = agent.parameters['kleur'];
if ( singer !== '' ) {
let artistName = singer.replace(' ', ''). toLowerCase();
let currentArtist = admin.database().ref().child('/artists/' + artistName);
currentArtist.once('value', function (snapshot) {
if ( snapshot.exists() && snapshot.hasChild('votes') ) {
let obj = snapshot.val();
currentArtist.update({
votes: obj.votes + 1
})
} else {
currentArtist.set({
votes: 1
})
}
});
responseText = 'Thanks man voor je stem!';
} else {
fallback();
}
if ( endConversation ) {
conv.close(responseText);
} else {
conv.ask(responseText);
}
agent.add(responseText);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('kleur stemmen', voting);
The problem is that there seems to be no connection between my local environment and the Actions console. The package.json contains everything there needs to be. I really do not know what to do, again I could deploy and test this code a few days ago but now just nothing happens.
I installed all dependencies using NPM, so that can not be a problem in my opinion. Again, it worked perfectly fine a few days ago. I also checked if all the fulfillments for webhook were enabled, they were.
The deployment from the terminal does not throw any errors. However when I try to test it in the Action Simulator I get the following error:
{
"responseMetadata": {
"status": {
"code": 10,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"@type": "type.googleapis.com/google.protobuf.Value",
"value": "{"id":"ea987ebc-670b-4fd4-b002-dce3a21910eb","timestamp":"2018-11-07T15:33:16.59Z","lang":"nl","result":{},"status":{"code":200,"errorType":"success"},"sessionId":"ABwppHEMJQALun_4R3ESqXJoEO8JoIs1P9riNuLpNMYbHfGT6XLhxo4EQaj6vmDe1ks-jUZG7-l6A9JkIaE"}"
}
]
}
}
}
So it seems to me that something goes wrong in the connection between my terminal and the console. I would really love to get an answer to this question!
UPDATE:
I tried to deploy using
firebase deploy
The deployment throws no errors whatsoever and reacts exactly the way it did when the code did work so there seems to be no problem there. I also checked if i was in the correct directory.Nothing appears in the Firebase logs. As you can see in the code something should appear there but it doesn't.
Screenshot from the Dialogflow Fulfillment page.
- Intent handlers are added to the code, they were in there but I copied and pasted it badly.
javascript npm webhooks dialogflow actions-on-google
I am trying to make a Google Action in Dialogflow. More specifically I am trying to deploy javaScript code from my terminal. A few days ago the code worked perfectly.
The index.js file that works:
'use strict';
const functions = require('firebase-functions');
const {WebhookClient} = require('dialogflow-fulfillment');
const {Card, Suggestion} = require('dialogflow-fulfillment');
process.env.DEBUG = 'dialogflow:debug'; // enables lib debugging statements
var admin = require("firebase-admin");
var serviceAccount = require("./pathToAccountKey);
let count = 0
admin.initializeApp({
credential: admin.credential.cert(serviceAccount),
databaseURL: "https://voice-c5a55.firebaseio.com/"
});
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 welcome(agent) {
agent.add(`Welkom gekke banaan!`);
}
function fallback(agent) {
let conv = agent.conv();
count++
console.log("count is " + count)
if (count === 1){
agent.add(`poging 1`)
} else if (count === 2) {
agent.add(`nu 2`);
} else {
return agent.close('Te laat')
};
}
function voting(agent) {
let conv = agent.conv(); // Get Actions on Google library conv instance
let endConversation = false;
let responseText = '';
let singer = agent.parameters['kleur'];
if ( singer !== '' ) {
let artistName = singer.replace(' ', ''). toLowerCase();
let currentArtist = admin.database().ref().child('/artists/' + artistName);
currentArtist.once('value', function (snapshot) {
if ( snapshot.exists() && snapshot.hasChild('votes') ) {
let obj = snapshot.val();
currentArtist.update({
votes: obj.votes + 1
})
} else {
currentArtist.set({
votes: 1
})
}
});
responseText = 'Thanks man voor je stem!';
} else {
fallback();
}
if ( endConversation ) {
conv.close(responseText);
} else {
conv.ask(responseText);
}
agent.add(responseText);
}
let intentMap = new Map();
intentMap.set('Default Welcome Intent', welcome);
intentMap.set('Default Fallback Intent', fallback);
intentMap.set('kleur stemmen', voting);
The problem is that there seems to be no connection between my local environment and the Actions console. The package.json contains everything there needs to be. I really do not know what to do, again I could deploy and test this code a few days ago but now just nothing happens.
I installed all dependencies using NPM, so that can not be a problem in my opinion. Again, it worked perfectly fine a few days ago. I also checked if all the fulfillments for webhook were enabled, they were.
The deployment from the terminal does not throw any errors. However when I try to test it in the Action Simulator I get the following error:
{
"responseMetadata": {
"status": {
"code": 10,
"message": "Failed to parse Dialogflow response into AppResponse because of empty speech response",
"details": [
{
"@type": "type.googleapis.com/google.protobuf.Value",
"value": "{"id":"ea987ebc-670b-4fd4-b002-dce3a21910eb","timestamp":"2018-11-07T15:33:16.59Z","lang":"nl","result":{},"status":{"code":200,"errorType":"success"},"sessionId":"ABwppHEMJQALun_4R3ESqXJoEO8JoIs1P9riNuLpNMYbHfGT6XLhxo4EQaj6vmDe1ks-jUZG7-l6A9JkIaE"}"
}
]
}
}
}
So it seems to me that something goes wrong in the connection between my terminal and the console. I would really love to get an answer to this question!
UPDATE:
I tried to deploy using
firebase deploy
The deployment throws no errors whatsoever and reacts exactly the way it did when the code did work so there seems to be no problem there. I also checked if i was in the correct directory.Nothing appears in the Firebase logs. As you can see in the code something should appear there but it doesn't.
Screenshot from the Dialogflow Fulfillment page.
- Intent handlers are added to the code, they were in there but I copied and pasted it badly.
javascript npm webhooks dialogflow actions-on-google
javascript npm webhooks dialogflow actions-on-google
edited Nov 8 at 9:51
asked Nov 7 at 15:40
Luuk van Hoogstraten
11
11
By saying you're deploying it, do you mean deploying it usingfirebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?
– Prisoner
Nov 7 at 17:52
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14
add a comment |
By saying you're deploying it, do you mean deploying it usingfirebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?
– Prisoner
Nov 7 at 17:52
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14
By saying you're deploying it, do you mean deploying it using
firebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?– Prisoner
Nov 7 at 17:52
By saying you're deploying it, do you mean deploying it using
firebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?– Prisoner
Nov 7 at 17:52
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14
add a comment |
1 Answer
1
active
oldest
votes
up vote
0
down vote
You need to enable Webhook in your Dialogflow fulfillment and paste the deployment URL of Firebase functions that are deployed using firebase deploy
.
Make sure you are using the correct Actions Project
firebase use <PROJECT_ID>
Your Action's project ID can be found in the Actions Console, under Overview > (Gear icon) > Project settings.
Refer the following Google Codelabs link to setup connection between your local environment and firebase functions:
https://codelabs.developers.google.com/codelabs/actions-2/#2
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
0
down vote
You need to enable Webhook in your Dialogflow fulfillment and paste the deployment URL of Firebase functions that are deployed using firebase deploy
.
Make sure you are using the correct Actions Project
firebase use <PROJECT_ID>
Your Action's project ID can be found in the Actions Console, under Overview > (Gear icon) > Project settings.
Refer the following Google Codelabs link to setup connection between your local environment and firebase functions:
https://codelabs.developers.google.com/codelabs/actions-2/#2
add a comment |
up vote
0
down vote
You need to enable Webhook in your Dialogflow fulfillment and paste the deployment URL of Firebase functions that are deployed using firebase deploy
.
Make sure you are using the correct Actions Project
firebase use <PROJECT_ID>
Your Action's project ID can be found in the Actions Console, under Overview > (Gear icon) > Project settings.
Refer the following Google Codelabs link to setup connection between your local environment and firebase functions:
https://codelabs.developers.google.com/codelabs/actions-2/#2
add a comment |
up vote
0
down vote
up vote
0
down vote
You need to enable Webhook in your Dialogflow fulfillment and paste the deployment URL of Firebase functions that are deployed using firebase deploy
.
Make sure you are using the correct Actions Project
firebase use <PROJECT_ID>
Your Action's project ID can be found in the Actions Console, under Overview > (Gear icon) > Project settings.
Refer the following Google Codelabs link to setup connection between your local environment and firebase functions:
https://codelabs.developers.google.com/codelabs/actions-2/#2
You need to enable Webhook in your Dialogflow fulfillment and paste the deployment URL of Firebase functions that are deployed using firebase deploy
.
Make sure you are using the correct Actions Project
firebase use <PROJECT_ID>
Your Action's project ID can be found in the Actions Console, under Overview > (Gear icon) > Project settings.
Refer the following Google Codelabs link to setup connection between your local environment and firebase functions:
https://codelabs.developers.google.com/codelabs/actions-2/#2
answered Nov 9 at 4:03
sai.raj
697
697
add a comment |
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53192787%2fdeploying-code-from-local-environment-to-google-action-dialogflow-nothing-happe%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
By saying you're deploying it, do you mean deploying it using
firebase deploy
? Can you update your question with the answers to: What is the output of your deployment? When the Action is triggered does anything appear in the Firebase Cloud Functions logs? Can you add a screen shot of the Fulfillment page in Dialogflow?– Prisoner
Nov 7 at 17:52
Are you sure this index.js file works? I'm seeing a missing quote on your service account line, and I'm not seeing where your agent handles the request intent.
– Nick Felker
Nov 7 at 20:48
did you test your local code using ngrok? is there any error coming?
– Abhinav Tyagi
Nov 8 at 4:46
I updated the question! I do not use Ngrok, checked it out but it looks as if it's going to make things harder for me. Not very experienced but I am willing to look into it if you guys think it could help.
– Luuk van Hoogstraten
Nov 8 at 11:14