Schmavery/facebook-chat-api

Getting error while uploading attachment as a page

Open

#133 opened on Jan 6, 2016

View on GitHub
 (19 comments) (0 reactions) (0 assignees)JavaScript (1,879 stars) (555 forks)batch import
bugfacebook changehelp wanted

Description

Can't upload image by using

var msg = {
   attachment: fs.createReadStream(__dirname + '/kitty.jpg')
};

localAPI.sendMessage(msg, "0000000000", function callback(obj, other) {
});

Error message on

ERR! ERROR in sendMessage --> { error: 'JSON.parse error. Check the detail property on this error.', ERR! ERROR in sendMessage --> detail: [SyntaxError: Unexpected end of input], ERR! ERROR in sendMessage --> res: '' }

In sendMessage.js defaultFuncs .post("https://www.facebook.com/ajax/mercury/send_messages.php", ctx.jar, form) .then(utils.parseAndCheckLogin)

If I send message. It call utils.parseAndCheckLogin 1 time But when I upload an attachment. Error happen.

Thank you :D

Contributor guide