-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
support for sending image(file) #9
Comments
already supported! see https://github.com/chen-ye/hubot-fb#sending-rich-messages-templates-images |
sorry was a bit vague bout that. I meant to ask about sending image via 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" |
Thats supported via the attachment payload as well - check the data recieved when an image is sent from the user to the bot |
I tested using
Which echos back rich mesages |
ohh thx, will try later, let's close for now. |
update: the method you showed above still works only for sending url of image, not the buffer stream of your local file. For example, run image transformation from facebook: take image from user, transform to output, send that file back to people. Luckily this can be done by plain HTTP request now: var formData = {
recipient: `{"id":"${envelope.user.id}"}`,
message: '{"attachment":{"type":"image", "payload":{}}}',
filedata: fs.createReadStream(outFilepath)
}
request.post({url:'https://graph.facebook.com/v2.6/me/messages?access_token='+process.env.FB_PAGE_TOKEN, formData: formData}); |
Ok! I'm currently on a weekend vacation, but I can take a look at adding
|
no worries, I'm using that script above now. |
Currently hubot-fb supports sending images via urls. Here's the guideline of sending image (file).
Will this be supported?
The text was updated successfully, but these errors were encountered: