Can we use SSML in dialogflow JSON Response from webhook i.e. without using Google Assistant client library.
Basically I would like to return SSML subalias in the response from my webhook hosted on AWS Lambda.
I tried to search if it is possible using dialogflow JSON response, but not able to find it anywhere.
Added the following in
"textToSpeech": '<speak><sub alias="Indian Premier League"> IPL</sub></speak>'
Related
I have a question about the Dialogflow node js code.
There are two different way to build an intent in code :
with the webhook client
with action on google
the code has a form like :
app.intent(....) with conv.ask or a basic function with agent.add(...) .
This question already has an answer here:
Making an HTTP POST request from fulfillment in Dialogflow
(1 answer)
Closed 4 years ago.
We are creating an action that will take user's input and create an entity in our database (datastore).
Ideally, we would like to be able to access the user's raw input audio, but it doesn't seem that is possible.
As a work around we are going to send the speech-to-text of user's utterance to our backend services. We are using firebase cloud functions for our fulfillment and an external rest api for our crud operations.
We are trying to make a post request in a webhook to create an entity based on user's input, but when I check my logs it doesn't seem like the post request is reaching our service. I'm not able to debug what or if we are getting a response back
app.intent('favorite color', (conv, {color}) => {
const options = {
// options
};
function callback(error, response, body) {
// log response or error
}
request(options, callback);
const luckyNumber = color.length;
// Respond with the user's lucky number and end the conversation.
conv.close('This word has ' + luckyNumber + ' letters.');
});
// Set the DialogflowApp object to handle the HTTPS POST request.
exports.dialogflowFirebaseFulfillment = functions.https.onRequest(app);
This question is not the same as the one that it was marked as a duplicate because the solution was the account type not supporting POST requests to an external API and not the HTTP Client we were using
The Inline Editor in the Dialogflow console uses Firebase Cloud Functions, as you already know.
Unfortunately, Firebase Cloud Functions DOESN'T support external API calls in it's free plan. You may need to switch to blaze plan or deploy your fulfillment elsewhere.
I built a custom webhook as a fulfillment endpoint for a Dialogflow intent. It works fine when I respond with raw JSON, ie: {'fullfillmentText':'hi'},
but does not seem to work using the "actions-on-google" library.
The code from their website implies this should work:
app.intent('myintent', (conv) => {
conv.close('See you later!');
});
But it does not. Google Home just says my app isn't responding. It might be that as it stands my function (using Fn Project) has to return JSON and if I return JSON as a response that it isn't expecting it fails. Maybe someone can shed some light?
Edit 1:
I'm using a custom webhook using the Fn Project open source functions as a service. Demonstrating how to use the project is my purpose here so I don't want to use inline editor or Google Cloud Functions or firebase or any other default option.
Here's the rest of the code
const fdk = require('#fnproject/fdk');
const request = require('request');
const dialogflow = require('actions-on-google');
const app = dialogflow({
debug: true,
});
fdk.handle(function (input) {
app.intent('myintent', (conv) => {
conv.ask('I could not understand. Can you say that again?');
});
return {'fulfillmentText': 'response from webhook'}
});
Although you are creating the app object, which does the Intent handler processing and such, and registering a handler with it via app.intent(), you're not doing anything to "export" it so app's methods are called when the webhook is triggered. When called, it gets the body of the request and will format the JSON for the response.
If, for example, you were using Firebase functions, you would connect app to be handled through the functions with something like
exports.fulfillment = functions.https.onRequest(app);
But you're not. You're using a different framework.
The library comes with a number of frameworks that are supported out of the box, but the Fn Project isn't one of them. In theory, you can create your own Framework object which will do this for you (the "Frameworks" section of this article discusses it briefly, but doesn't go into details about how to do so).
As you surmise, it may be easiest for you to just read the JSON request and generate the JSON response yourself without using the actions-on-google library. Or you can look into a library such as multivocal to see if it would be easier to leverage its multi-framework support.
I'm designing a Google Actions webhook. I want to use the pre-defined static response for most requests, but in some situations, I want to return a 'simple response' to the user.
I've read that if my webhook does not return a response, then the static response will be used, but the webhook response format requires a 'Richresponse'. How can I send a response that will cause the static response to be used?
If you want to use the static responses that are defined in Dialogflow console, you can use the incoming property of the conversation object. here is the document explaining how it works.
I'm trying to add API.AI middleware to my Botkit on Facebook Messenger.
However, it doesn't return anything from API.AI.
Anyone had success implementing API.AI with Botkit?
controller.middleware.receive.use(apiai.receive);
controller.hears(['apiai'],'message_received',apiai.hears,function(bot, message) {
console.log('APIAI: ', message)
});
P.S. Here's the API.AI middleware https://github.com/abeai/botkit-middleware-apiai
I had the same problem. Had to figure out, that the first argument of controller.heares (in your case 'apiai') has to exactly match the intent's name on your apiai agent. The other problem you may have is logging the message object to the console. I'd eighter stringify
JSON.stringify(message)
it or log message.intent to the console. Hope This helps.