[1.0] Todo list
tgallice opened this issue · comments
- Add Airline template
- Add Sender actions
- Handle Account linking
- Handle webhook (partial)
- Handle Payment Webhook
- Apply php-cs-fixer
handle webhook please !
Hi, can you add how to send quickReplies in the documentation please?
$message = new FBMessenger\Model\Message(<QUICK_REPLIES_TITLE_TEXT>);
$message->setQuickReplies([
new Model\QuickReply('Option1', 'YOUR_PAYLOAD_HERE'),
new Model\QuickReply('Option2', 'YOUR_PAYLOAD_HERE')
]);
$this->messenger->sendMessage(<USER_ID>, $message);
Something i thing is a bug is that when i click on a QuciReply i receive it as a message_event and not as a postback_event, because i need to is_null($event->getMessage()->getQuickReply()) instean of just receiving it as a postback_event
Hello @Ismael-sm thank for the feedback. You right, I will add it in the doc.
For the QuickReply event, it's not a bug. Cf. to the documentation, when you click on a quick reply this send back a message event. A quick reply is not only a posback. It's return the text too and a Location can be set as an attachment if the quick reply content-type is define as location
.
But I will add some methods as shortcut in the MessageEvent:
MessageEvent::isQuickReply() : bool
MessageEvent::getQuickReplyPayload() : null|string
MessageEvent::isLocation() : bool
MessageEvent::getLocation() : null|array
This seem good to you ?
Hi @tgallice :), your fast response is apreciated. I'm not sure if this is the rigth way to do this, but i created a "MessengerController" class which have a function called processUpdate($webookHandler->getAllCallbackEvents()); and in this function i have this
foreach ($events as $event) {
/**
* https://developers.facebook.com/docs/messenger-platform/webhook-reference#setup
*/
switch ($event->getType()) {
case 'message_event':
$this->processMessage($event);
break;
case 'message_read_event':
break;
case 'message_delivery_event';
break;
case 'message_echo_event';
break;
case 'authentication_event':
break;
case 'account_linking_event':
$this->processAccountLinking($event);
break;
case 'postback_event';
$this->processPostback($event);
break;
case 'raw_event';
break;
}
}
You maybe can implement some kind of handler that invokes a function dependent of the type of the event.
Like
$messenger->onMessage(...);
$messenger->onPostback(...);
etc or you can manage the postsbacks as "commands"
$messenger->addCommand/postbackHandler(<CLASS>);
But well that is just ideas, you are the programmer ;)
👍 Yes this is a good idea ! This will give more flexibility. Feel free to open a PR/issue to implement/speak about this feature.
@tgallice I really don't know how this git think works, it says i don't have permission to push when i click to Sync, and i see mine commits in the app, but cannot see them here in the website? :s
Have you fork this repo first ? Please look to the github doc : https://guides.github.com/activities/contributing-to-open-source/
Thank's @tgallice, i made the pull request now ^^
TODO list:
can you add the send API endpoint and is_reusable field on attachments?
and/or field is_reusable on payload of class Image/File/Attachment
thanks!