CasperLaiTW / laravel-fb-messenger

Laravel Facebook Messenger Provider
MIT License
105 stars 27 forks source link

How to add subtitle for GenericTemplate? #83

Closed quangtam closed 7 years ago

quangtam commented 7 years ago

Hi, Could you please help me to know how to add subtitle for generictemplate?

CasperLaiTW commented 7 years ago

Hi, Subtitle is in new Element($title, $subtitle) or $generic->addElement($title, $subtitle)

description equal to subtitle.

$generic = new GenericTemplate($message->getSender());
        $defaultButton = new UrlButton(null, 'https://developers.facebook.com/docs/messenger-platform/send-api-reference/list-template');
        $generic
            ->addElement('First item', 'description')
            ->buttons()
            ->addPostBackButton('First Button')
            ->addWebButton('facebook', 'https://facebook.com');
        $generic->addElement('Second item', 'description')
            ->buttons()
            ->addPostBackButton('Second Button')
            ->addWebButton('google', 'http://www.google.com')
            ->addShareButton();
        $this->send($generic);