I am using php sdk for dialogflow api, i am using below code
// create text input
$textInput = new TextInput();
$textInput->setText($user_text);
$textInput->setLanguageCode($this->language_code);
// create query input
$queryInput = new QueryInput();
$queryInput->setText($textInput);
// get response and relevant info
$response = $sessionsClient->detectIntent($session, $queryInput);
$queryResult = $response->getQueryResult();
$queryText = $queryResult->getQueryText();
$intent = $queryResult->getIntent();
How to get followup intent name and call it with queryinput.
example:
Intent: Contact form
Training phrase: Contact from , etc.
Followup Intent: Ask username
now if $user_text is "Contact from" ie training phrase of Intent: Contact form than how can i get the Followup intent name form
$response = $sessionsClient->detectIntent($session, $queryInput);
How to get folloup intent name in $response or other variable.
You do not call a followup intent directly. Followup intents may be triggered by the user's next response after you transmit the response to them in some way.
Remember - all Intents are triggered by a user activity of some sort - typically by the $user_text
that you're specifying in this case.
If you need to display something based on how you expect or need the user to reply, then you should tie this to the Intent (or Intent Name) that was matched as well as any other current state that may be useful. You don't know what the next Intent to be triggered will be - it could be a followup intent, or could be some other intent if that is the better match. The only thing you do know is what just matched.
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments