pimax/fb-messenger-php

Gallery Card TYPE_GENERIC

Closed this issue · 1 comments

Hi,

I am trying to add the url in the Gallery Card . But when I do that , it produces the array which is not correct . Here is what I am doing.

$arr = new MessageElement($heading, $subheading, $url _img , $url ,
[
new MessageButton(MessageButton::TYPE_POSTBACK, 'This Button'),
new MessageButton(MessageButton::TYPE_POSTBACK, 'Second button'),
]
),

I am pushing each new element created in an array to create the Element array . If I does, this it produces an array in the URL field. Below is the Log I have:

array (
0 =>
array (
0 =>
pimax\Messages\MessageElement::__set_state(array(
'title' => 'Some Heading',
'image_url' => 'http://dashboard.test/block_image/gal_5ad1b49c1a6181523692752.jpg',
'subtitle' => 'Some Subheading',
'url' =>
array (
0 =>
pimax\Messages\MessageButton::__set_state(array(
'type' => 'postback',
'title' => 'This Button',
'url' => 'Welcome',
'webview_height_ratio' => '',
'messenger_extensions' => false,
'fallback_url' => '',
'share_contents' => NULL,
'webview_share_button' => NULL,
)),
1 =>
pimax\Messages\MessageButton::__set_state(array(
'type' => 'postback',
'title' => 'Second button',
'url' => 'Welcome',
'webview_height_ratio' => '',
'messenger_extensions' => false,
'fallback_url' => '',
'share_contents' => NULL,
'webview_share_button' => NULL,
)),
),
'buttons' => 'www.someurl.com',
'default_action' =>
array (
),
)),
),
1 =>
array (
0 =>
pimax\Messages\MessageElement::__set_state(array(
'title' => 'some heading2',
'image_url' => 'http://dashboard.test/block_image/gal_5ad1b5277d27e1523692845.jpg',
'subtitle' => 'subheading 2',
'url' =>
array (
0 =>
pimax\Messages\MessageButton::__set_state(array(
'type' => 'postback',
'title' => 'This Button',
'url' => 'Welcome',
'webview_height_ratio' => '',
'messenger_extensions' => false,
'fallback_url' => '',
'share_contents' => NULL,
'webview_share_button' => NULL,
)),
1 =>
pimax\Messages\MessageButton::__set_state(array(
'type' => 'postback',
'title' => 'SomeButton',
'url' => 'Welcome',
'webview_height_ratio' => '',
'messenger_extensions' => false,
'fallback_url' => '',
'share_contents' => NULL,
'webview_share_button' => NULL,
)),
),
'buttons' => 'www.someurl.com',
'default_action' =>
array (
),
)),
),
)

Please check and suggest

Resolved. It should have written like this

new MessageElement($heading, $subheading, $url_img, $buttons , $url);