Reputation: 3351
I am trying to get a response from firebase function in dialogflow. when I've enabled the webhook and invoking the agent, I'm getting an error as
and here is my code
const functions = require('firebase-functions');
const admin = require('firebase-admin');
const requst = require('request');
const {
dialogflow,
BasicCard,
BrowseCarousel,
BrowseCarouselItem,
Button,
Carousel,
Image,
LinkOutSuggestion,
List,
MediaObject,
Suggestions,
SimpleResponse,
} = require('actions-on-google');
const intentSuggestions = [
'Basic Card',
'Browse Carousel',
'Carousel',
'List',
'Media',
'Suggestions',
'Table',
];
admin.initializeApp(functions.config().firebase);
var firestore = admin.firestore();
const randomize = require('randomatic');
exports.webhook = functions.https.onRequest((request, response) => {
const app = dialogflow({ debug: true });
app.intent('Default Welcome Intent', (conv) => {
conv.ask(new SimpleResponse({
speech: 'Hi there!',
text: 'Hello there!',
}));
conv.ask(new SimpleResponse({
speech: 'I can show you basic cards, lists and carousels ' +
'as well as suggestions on your phone.',
text: 'I can show you basic cards, lists and carousels as ' +
'well as suggestions.',
}));
conv.ask(new Suggestions(intentSuggestions));
});
});
Here is the log output in firebase.
Please let me know where am I going wrong and how can I fix it.
Thanks
Upvotes: 0
Views: 498
Reputation: 5550
The error you're getting has nothing to do with billing. The log you have shown is not complete but from your code I can spot the following issues:
The name of your function must be dialogflowFirebaseFulfillment
to work with dialogflow.
Your const app = dialogflow({ debug: true });
must move out of the exports
block to somewhere before it.
If there are still issues, please update your question with the complete error log.
Upvotes: 1
Reputation: 339
You first error is saying that your billing account is not configured: this will block all external calls in your code. You can first try activating billing in Google Console > Navigation Menu > Billing > Enable Billing.
Upvotes: 1