pimax / fb-messenger-php

Facebook Messenger Bot PHP API
GNU General Public License v2.0
314 stars 147 forks source link

How shall I send Location Attachment #114

Closed jiyanibharat303 closed 7 years ago

jiyanibharat303 commented 7 years ago

Trying to send location as attachment :

    $coordinates = [
        "coordinates" => [
            "lat" => "20.464079",
            "long" =>  "74.996857"
        ]
    ];

  $bot->send(
    new StructuredMessage($senderID,
      StructuredMessage::TYPE_GENERIC,
      [
          'text' => 'Location',
      ],
      [ 
            new Attachment(Attachment::TYPE_LOCATION, $coordinates,[]) 
      ]
    ));

Please help

wittfabian commented 7 years ago

Use markdown in your description

wittfabian commented 7 years ago

Check the examples for StructuredMessage: https://github.com/pimax/fb-messenger-php-example

jiyanibharat303 commented 7 years ago

Hello Sir, I have tried those that is working with the button elements but not with attachments. Can you show and example for attachments.

wittfabian commented 7 years ago

Your example does not match with the one we created!

StructuredMessage

__construct($recipient, $type, $data, $quick_replies = array(), $tag = null, $notification_type = parent::NOTIFY_REGULAR)

I think locations as attachments is not possible. https://developers.facebook.com/docs/messenger-platform/send-api-reference/contenttypes

wittfabian commented 7 years ago

Check this workaround: https://stackoverflow.com/questions/38017382/how-to-send-location-from-facebook-messenger-platform

wittfabian commented 7 years ago

solved?

wittfabian commented 7 years ago

No answer, closed!