我正在使用dialogflow,并将dialogflow API获取到Messenger,但即使我遵循https://developers.facebook.com/docs/messenger-platform/send-messages/template/generic格式,也无法在Messenger API(facebook)中使用。我做错了什么吗?
$FieldName = $fulfillmentMessage->getCard()
{
$title = $FieldName->getTitle();
$subtitle = $FieldName->getSubtitle();
$image_uri = $FieldName->getImageURI();
$buttons = $FieldName->getButtons();
foreach($buttons as $button)
{
$text = $button->getText();
$postback = $button->getPostback();
}
$res = [
"recipient" => ["id" => $id],
'source' => "source",
'data' => ["facebook" => ["attachment" => ["type" => "template", "payload" => ['template_type' => "generic",
"elements" =>["title" => $title,
"image_url" => $image_uri,
"subtitle" => $subtitle,
"buttons" => [[
"type" => "web_url",
"url" => $postback,
"title" => $text],
["type" => "postback",
"title" => $text,
"payload" =>$text]
]]]]]]];
$this->sendMessage($res);