I am trying to use the new Facebook Messenger Platform API to send image message using image file from application directory.
Facebook gives the example using cURL
like below:
curl \
-F recipient='{"id":"USER_ID"}' \
-F message='{"attachment":{"type":"image", "payload":{}}}' \
-F filedata=@/tmp/testpng.png \
"https://graph.facebook.com/v2.6/me/messages?access_token=PAGE_ACCESS_TOKEN"
But I am trying to use the API with C#
. For your information, I have successfully use the API if I use the file from an internet url.
I have tried to fill in the filedata
property by using base64
string of the image file, but unsuccessful.
Kindly explain how does cURL
works with the given file path especially image and create a POST request to the web server? And if possible, what options do I have to do it with C#
?