Skip to content
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

Add support for uploading files #22

Open
remixz opened this issue Jul 1, 2016 · 3 comments
Open

Add support for uploading files #22

remixz opened this issue Jul 1, 2016 · 3 comments

Comments

@remixz
Copy link
Owner

remixz commented Jul 1, 2016

Facebook just recently added the ability to upload files (images, audio, videos, or a generic file) for a message, instead of having to specify a URL for an attachment.

They all share the same format of it being a multipart POST form, with the file being under the key of filedata. For our sendMessage / reply, we should have some sort of special key in the payload that accepts the same inputs as request does for multipart forms (https://github.com/request/request#forms), and is then added to the request as filedata.

@bitcoinvsalts
Copy link

any update on this?

@danielnjoo
Copy link

Highly interested

@baudev
Copy link
Contributor

baudev commented Jun 8, 2018

I've just created a PR using the Facebook Attachment Upload API: Add Attachment Upload API method.

You can use it as below:

bot.getAttachmentUploadId("https://images.pexels.com/photos/63324/california-road-highway-mountains-63324.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260", true, "image", (err, body) => {
    // ...
});

With this function you get a attachment_id which is usable with the Media Template Reference.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants