i’m trying to send a image attachment to a facebook chat with curl.
I got the instructions form (https://developers.facebook.com/docs/messenger-platform/send-api-reference/image-attachment)
curl
-F 'recipient={"id":"YYYY"}'
-F 'message={"attachment":{"type":"image", "payload":{}}'
-F 'filedata=@/home/dominic/site/drophere/hitcat.jpg;type=image/jpeg'
"https://graph.facebook.com/v2.6/me/messages?access_token=XXXX"
after I ececuted it, this error message appear:
{"error":{"message":"(#100) Message cannot be empty, must provide valid attachment or text","type":"OAuthException","code":100,"error_subcode":2018034,"fbtrace_id":"DwlBQTqXCw/"}}
cant find my mistake.
2
Answers
You seem to be missing a } after “payload”:{}}. Your code should read:
Also their documentation has a bad JSON example here https://developers.facebook.com/docs/messenger-platform/send-messages
Note the EQUALS sign here:
Here should be
:
instead of=