Fritak / messenger-platform

Implementation of the Messenger Platform in a PHP.
MIT License
34 stars 15 forks source link

Where get the Information of Button Postback? #22

Closed michelpf closed 8 years ago

michelpf commented 8 years ago

Using the follow example

$buttons = [new Button('Click', Button::TYPE_WEB, 'www.seuapp.com.br'),new Button('Click2', Button::TYPE_POSTBACK, 'HELP')]; $bot->sendButton($usuario, 'Example text... Not too long, hehe.', $buttons);

The 'Click2' button will send to the webhook the string 'HELP'. How to catch that in order to trigger a message, for example?

michelpf commented 8 years ago

I manage to work, it's just simple put:

if (empty($mensagem)){ $mensagem = $messages[0]->messaging[0]->postback->payload; }