Suppose there is an intent in Dialogflow named "intent.direction". This intent have some phrases like : "Direction to PLACE_NAME" or "Navigate to PLACE_NAME",etc. Here "PLACE_NAME" is the name of any place to which user wants to go.
When this intent is triggered, I want the "PLACE_NAME" i.e. name of place, to be passed to my WEBHOOK (index.js).
Is there any way to do this?
-------------------UPDATED RESPONSES------------------
function makeDirection(app)
{
if (!hasScreen)
{
app.ask('Sorry, try this on a screen device');
}
else
{
//-----variables----
var body2="";
var placeName = app.getArgument( 'PLACE_NAME' );
app.ask(placeName);
below are the few images of testing, I am getting the last word i.e. "PLACE_NAME" but....
Yes.
I assume your Intent looks something like this:
The important things to note about the Intent settings are:
@sys.any
. This will match anything. If we have other entity types that would make sense here (either one we define or something like@sys.address
or@sys.street-address
), we could have used those instead.PLACE_NAME
.We've also done things like set the action name to something and turned on fulfillment through a webhook.
In our webhook, we'll get the values of the parameters that have been set by this Intent. How we do this will depend on what libraries we're using, if any.
Since you've indicated this is for Actions on Google, it is likely you're using the AoG node.js library. If so, we can get the parameter using something like
If you're reading the JSON and using Dialogflow V1, you can get the value out of the body object with something like this:
if you're using Dialogflow V2 instead, it is at a slightly different path:
This is an alternative way: