Schmavery / facebook-chat-api

Unofficial Facebook Chat API for Nodejs
MIT License
1.93k stars 596 forks source link

Add support for facebook links #305

Open notbrian opened 8 years ago

notbrian commented 8 years ago

Adding a URL for a Facebook event or a profile to my url field gives me this error.

WARN parseAndCheckLogin: Got status code 500 retrying... ERR! ERROR in sendMessage --> { error: 'JSON.parse error. Check thedetailproperty on this error.', ERR! ERROR in sendMessage --> detail: [SyntaxError: Unexpected end of input], ERR! ERROR in sendMessage --> res: '' }

I found that websites such as google.com or reddit.com work perfectly fine though.

Is this happening because of the more detailed embed that Facebook uses for events? Image

Schmavery commented 8 years ago

If you send this as part of the message rather than setting it as a url, does it work?

notbrian commented 8 years ago

It doesn't attach it to the bottom as seen in the picture and just shows up as a link. Pic

Schmavery commented 8 years ago

In that case, it sounds like facebook links are treated differently than regular ones, so this would be a feature request to support "facebook links". It seems to me like a reasonable workaround for now will be including the facebook url as a regular message, even though it's not as pretty.

notbrian commented 8 years ago

Sounds good! Thanks for the help!

ianw11 commented 7 years ago

Is there any update on facebook links? I'm also seeing an issue if a url is in the body and facebook includes its preview of the page, api.listen doesn't receive a callback. However if you paste and send the message fast enough it works just fine

Schmavery commented 7 years ago

@ianw11 This is an issue specifically for links to pages on the facebook itself. Are you seeing your second bug for all kinds of links? If so, can you open a new issue for it? Doesn't sound like it's related to this, and is probably worth fixing.

ianw11 commented 7 years ago

Thanks for the super quick reply, I created a new issue https://github.com/Schmavery/facebook-chat-api/issues/415

Schmavery commented 7 years ago

Is anyone able to check if this issue was fixed by #416 @notbrian

luispena-minted commented 6 years ago

@Schmavery i checked and this still failing, now we are getting:

Error: parseAndCheckLogin got status code: 404. Bailing out of trying to parse response. at /Users/luispena/personal/facebook_test/node_modules/facebook-chat-api/utils.js:1040:15 at tryCatcher (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/util.js:26:23) at Function.Promise.attempt.Promise.try (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/method.js:31:24) at /Users/luispena/personal/facebook_test/node_modules/facebook-chat-api/utils.js:987:24 at tryCatcher (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/util.js:26:23) at Promise._settlePromiseFromHandler (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/promise.js:510:31) at Promise._settlePromiseAt (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/promise.js:584:18) at Async._drainQueue (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/async.js:128:12) at Async._drainQueues (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/async.js:133:10) at Immediate.Async.drainQueues (/Users/luispena/personal/facebook_test/node_modules/bluebird/js/main/async.js:15:14) at runCallback (timers.js:800:20) at tryOnImmediate (timers.js:762:5) at processImmediate [as _immediateCallback] (timers.js:733:5)

Addind the facebook url as part of the message body works, but it doesnt append the thumbail and is not threated as a link.

calvinbui commented 6 years ago

Still happening on 1.5.1. I'm trying to send instagram links as url but they're not giving the above error Youtube links are showing fine.