-3

This is my sample code where I get the message from the user. It's text only, so how can I get if I receive an image from the user? I'm using PHP from my bot.

 $message = $input['entry'][0]['messaging'][0]['message']['text'];
Razin
  • 221
  • 6
  • 15
Mavs Mavs
  • 409
  • 1
  • 4
  • 10

2 Answers2

0

get the value of attach file using php:

$message = $input['entry'][0]['messaging'][0]['message']['attachments'];

to post the result => $message[0]['payload']['url'].

Mavs Mavs
  • 409
  • 1
  • 4
  • 10
0

You will have the image url at:

entry[0].messaging[0].message.attachments[0].payload.url

To check if you have recieved a text or an image :

if(entry[0].messaging[i].message.text)
  //text
else 
  // image
Arbaz Siddiqui
  • 441
  • 2
  • 10