pimax/fb-messenger-php

How shall I send Location Attachment

Closed this issue · 7 comments

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

Use markdown in your description

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

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

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

solved?

No answer, closed!