Giter VIP home page Giter VIP logo

Comments (10)

tgallice avatar tgallice commented on July 18, 2024 1

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 ?

from fb-messenger-sdk.

tgallice avatar tgallice commented on July 18, 2024 1

👍 Yes this is a good idea ! This will give more flexibility. Feel free to open a PR/issue to implement/speak about this feature.

from fb-messenger-sdk.

tgallice avatar tgallice commented on July 18, 2024 1

Have you fork this repo first ? Please look to the github doc : https://guides.github.com/activities/contributing-to-open-source/

from fb-messenger-sdk.

eight-buddha avatar eight-buddha commented on July 18, 2024

handle webhook please !

from fb-messenger-sdk.

ismael-saavedra avatar ismael-saavedra commented on July 18, 2024

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);

from fb-messenger-sdk.

ismael-saavedra avatar ismael-saavedra commented on July 18, 2024

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

from fb-messenger-sdk.

ismael-saavedra avatar ismael-saavedra commented on July 18, 2024

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 ;)

from fb-messenger-sdk.

ismael-saavedra avatar ismael-saavedra commented on July 18, 2024

@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

from fb-messenger-sdk.

ismael-saavedra avatar ismael-saavedra commented on July 18, 2024

Thank's @tgallice, i made the pull request now ^^

from fb-messenger-sdk.

Giambapisasale avatar Giambapisasale commented on July 18, 2024

TODO list:
can you add the send API endpoint and is_reusable field on attachments?

send API reference

and/or field is_reusable on payload of class Image/File/Attachment

thanks!

from fb-messenger-sdk.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.