Schmavery / facebook-chat-api

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

Could api.getUserInfo be made to include last active time? #335

Open mrmishmash opened 8 years ago

mrmishmash commented 8 years ago

Because this API works like a browser, that basically means you should be able to get the "last active" time of the user, no? It would be nice if this function could include that information.

Schmavery commented 8 years ago

If the call to https://www.facebook.com/chat/user_info/ returns this information, I don't think we'd have any problem with accepting a PR that exposed it.

lyneca commented 7 years ago

What page calls that endpoint?

bsansouci commented 7 years ago

@lyneca You should be able to figure out which request has that information by using the chrome dev tools. If you start recording in the "network" tab and go to Facebook.com you'll see the "user_info" request and you can check the response. You can skim through the other requests and look for "active" maybe? I'm not sure which will give you that (I think we looked into it but couldn't find much)

lyneca commented 7 years ago

So just Facebook.com? I've been recording network activity in messenger.com and the FB chat page, but I'll try the main page.

bsansouci commented 7 years ago

Oh either could do! Good idea to look at messenger, the API will probably be newer

bsansouci commented 7 years ago

This information does not seem to be available from user_info.php. It's possible that we can get it through a GraphQL call, but we'd have to find the right one. The way to get last active time would be through the "presence" event which fires semi-frequently (every couple of minutes) for all of your friends (or a big chunk of them as far as I can tell...)