pimax / fb-messenger-php

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

How to send pre-formatted json response #161

Closed Stacey940 closed 5 years ago

Stacey940 commented 5 years ago

Would you like assistance or advice? Advice

Issue description

I want to send a pre formatted json response. For example the api returned a json like :

"payload": {
  "template_type": "list",
  "top_element_style": "<LARGE | COMPACT>",
  "elements": [
    {
      "title": "<TITLE_TEXT>",
      "subtitle": "<SUBTITLE_TEXT>",
      "image_url": "<IMAGE_URL_FOR_THUMBNAIL>",          
      "buttons": [<BUTTON_OBJECT>],
      "default_action": {
        "type": "web_url",
        "url": "<URL_TO_OPEN_WHEN_ITEM_IS_TAPPED>",
        "messenger_extensions": <TRUE | FALSE>,
        "webview_height_ratio": "<COMPACT | TALL | FULL>"
      }
    },
    ...
  ],
   "buttons": [<BUTTON_OBJECT>]  
}

I just want to forward this message using the $bot->send() , as we do using the sdk

wittfabian commented 5 years ago

Use the call function.

https://github.com/pimax/fb-messenger-php/blob/master/FbBotApp.php#L496

Stacey940 commented 5 years ago

Thanks @wittfabian