You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository has been archived by the owner on Jan 2, 2023. It is now read-only.
Hello,
I tried to use this lib to simply print a BasicCard response but I have the following error:
_MalformedResponse final_response.rich_response: the first element must be a 'simple_response', a 'structured_response' or a 'custom_response'. _
And this is the code I used:
<?php
require './vendor/autoload.php';
use Dialogflow\WebhookClient;
use Dialogflow\Action\Responses\SimpleResponse;
use Dialogflow\Action\Responses\BasicCard;
/*
use Dialogflow\Action\Responses\Image;
use Dialogflow\Action\Questions\Carousel;
use Dialogflow\Action\Questions\Carousel\Option;
use \Dialogflow\RichMessage\Image;
*/
$agent = new WebhookClient(json_decode(file_get_contents('php://input'),true));
if ('question_intercept'==$agent->getIntent())
{
$conv = $agent->getActionConversation();
$question = $agent->getParameters()['questionValue'];
if ($question == "picture")
{
$conv->close(BasicCard::create()
->title('This is a title')
->formattedText('This is a subtitle')
->image('https://picsum.photos/400/300')
->button('This is a button', 'https://docs.dialogflow.com/')
);
$agent->reply( $conv );
}
else
{
$agent->reply('You said: ' . $question);
}
}
else
{
$agent->reply('Failed');
}
header('Content-type: application/json');
echo json_encode($agent->render());
?>
The text was updated successfully, but these errors were encountered:
@bit111 Probably related to the fact that you should also set a 'simple' response next to a rich message.
You are not looking after the device an end-user uses while working with the assistant. BasicCards are more into Google Actions rather than let's say Facebook Messenger etc.
My best guess is to use a simple response next to the basic card and it should work.
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Hello,
I tried to use this lib to simply print a BasicCard response but I have the following error:
_MalformedResponse final_response.rich_response: the first element must be a 'simple_response', a 'structured_response' or a 'custom_response'. _
And this is the code I used:
The text was updated successfully, but these errors were encountered: