I had integrated the Dialogflow with Facebook messenger integration. I had followed the steps in the dialogflow docs.
I am not getting any output /message from the messenger.
I had used conv.ask() to respond to the Intents, is that the issue?
Do I need to update the surface capabilities section in actions?
'use strict';
// Import the Dialogflow module and response creation dependencies
// from the Actions on Google client library.
const {
dialogflow,
BasicCard,
} = require('actions-on-google');
// Import the firebase-functions package for deployment.
const functions = require('firebase-functions');
// Instantiate the Dialogflow client.
const app = dialogflow({debug: true});
function getRandomInt(max) {
return Math.floor(Math.random() * Math.floor(max));
}
const swamiMessages = require('./messages');
const swamiQuotes =require('./quotes');
// Intent Mapping
//INTENT: 'Default Welcome Intent'.
app.intent('Default Welcome Intent', (conv) => {
conv.ask(
`<speak> <emphasis level="moderate" > `+
`Do you want to hear an Inspiring <break/> Quote or a Message from Swami <break/> Sukhabodhananda ` +
`Do you want to know about Prasanna Trust <break/>`+
//`Do you want to know about the upcoming programs` +
` </emphasis> </speak>`);
});
//INTENT: 'quote'
//Should get triggered when the user request for an inspiring thought
// asks for motivation
app.intent('quote', (conv) => {
// when the welcome intent is triggered recite a random quote
//let quoteNumber= getRandomInt(5);
//let quote = quotes[quoteNumber].quote; //
let quote =swamiQuotes.getQuote();
if (quote) {
conv.ask(
`<speak> <emphasis level="moderate" > `+
`Let us hear an Inspiring quote \n` +
`<break strength="strong"> </break> `+
`${quote}` +
`<break strength="strong"> </break> `+
`\nDo you want to hear another quote or message ` +
` </emphasis> </speak>`);
} else
{
conv.ask(
`<speak> <emphasis level="moderate" > `+
`Let us hear an Inspiring quote ` +
`<break strength="strong"> </break> `+
`quotes` +
`\nDo you want to hear another quote or message ` +
` </emphasis> </speak>`);
}
});
// INTENT: message
//Should get triggered when the user request for an inspiring message
app.intent('message', (conv) => {
// when the welcome intent is triggered recite a random message
let message =swamiMessages.getMessage();
//let formattedMessage=swamiMessages.formattedMessage(message);
conv.ask(
`<speak> <emphasis level="moderate" > `+
`Let us hear an Inspiring Message ` +
`<break strength="strong"> </break> `+
`${message}`+
`\nDo you want to hear another quote or message ` +
` </emphasis> </speak>`);
});
Update
If I make changes to use the dialogflow-fulfillment library, how do I add two default handler functions - one for Actions on Google and one for other integrations? I'm doing something like
intentMap.set(null, googleAssistantOther);
intentMap.set(null, other);
//In place of null should i update the Intent Name and
// googleAssitantOther and other are callback functions.