Skip to content
This repository has been archived by the owner on Jul 9, 2022. It is now read-only.

api.getThreadHistory returns and empty array #486

Closed
ghost opened this issue May 29, 2017 · 11 comments
Closed

api.getThreadHistory returns and empty array #486

ghost opened this issue May 29, 2017 · 11 comments

Comments

@ghost
Copy link

ghost commented May 29, 2017

api.getThreadHistory returns and empty array version 1.4.0 called like the docs
getThreadHistory(threadID, amount, timestamp, callback)

@kieferlam
Copy link
Contributor

Do you get any errors? Are you sure the threadID is correct?

@gamelaster
Copy link
Contributor

🤔

@Schmavery
Copy link
Owner

@leonardlabuneti please show us a sample of non-working code 😄

@ghost
Copy link
Author

ghost commented May 31, 2017

The function returns no error and an empty array, the threadID is correct and the same code used to return messages a few days ago. I will come back with my code example. Thank you

@ghost
Copy link
Author

ghost commented May 31, 2017

api.getThreadHistory(threadId, 10, undefined, 
            function (err, response) {
                console.log('getThreadHistory got response :', err, response);
});

getThreadHistory got response : null []
error-> null,
response -> empty array

The threadId used is correct, the getThreadList works ok and I am using the same threadId I get from this api response

@bsansouci
Copy link
Collaborator

Mmmh I just tried here with one of my chats and it worked.

Are sure there are any messages in that thread? Are you sure the bot is in the thread?

@ghost
Copy link
Author

ghost commented May 31, 2017

There are messages in the thread and I am in that thread, I will double check my code. Good to know it works.
PS which version are you using ? 1.3 or 1.4 ?

@bsansouci
Copy link
Collaborator

I'm using master actually. There are definitely issues depending on where you live though, since FB rolls out changes weirdly across the world. Seems like 1.4 also works for me.

@ghost
Copy link
Author

ghost commented May 31, 2017

const login = require("facebook-chat-api");

login({email: "<yourFbEmail>", password: "<yourFbpassword>"}, (err, api) => {
    if(err) return console.error(err);
    // Here you can use the api

    var threadID = '<ContactFbID>';

    api.getThreadHistory(threadID, 10, undefined, (err, history) => {
            if(err) return console.error('Err',err);
             console.log('History:', history);
        });
});

Could someone try this code please ?

@ghost
Copy link
Author

ghost commented Jun 1, 2017

I doublechecked the issue was my testing fb account, it looks like you get some kind of block if you hammer the fb servers.

thank you guys

@Schmavery
Copy link
Owner

Thanks for following up @leonardlabuneti. As we state at the top of our README, facebook employs a number of rate-limiting measures to avoid people hammering them and this api explicitly doesn't attempt to circumvent them.

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

No branches or pull requests

4 participants