fbchat-dev / fbchat

Facebook Chat (Messenger) for Python
https://fbchat.readthedocs.io
BSD 3-Clause "New" or "Revised" License
1.19k stars 412 forks source link

client.send() method is returning a False response #35

Closed afonsocarlos closed 8 years ago

afonsocarlos commented 8 years ago

I can't send messages to anyone since today (it was sending messages normally until yesterday). In the send method r.ok is False. Is it happening with anyone else?

PidgeyL commented 8 years ago

Facebook is blocking your messages until you verify your account again. Log in to facebook, and send the same message you would using the script. Complete the verification process, and it should work again

kiliangraf commented 8 years ago

I have the same problem. send() is always returning false. How do i verify my account? I can log into my account from the same ip, and don't need to verify. Also, fetching messages works just fine.

Edit: I can also send to group messages.

afonsocarlos commented 8 years ago

I verified and it keeps returning false. I also tried to log in with an old account and it keeps returning false as well.

PidgeyL commented 8 years ago

Seems like Facebook changed something to block tools like this. Guess we'll probably have to take a look under the hood again

-----Original Message----- From: "Charliiee" notifications@github.com Sent: ‎01/‎04/‎2016 16:49 To: "carpedm20/fbchat" fbchat@noreply.github.com Cc: "Pidgey" pieterjan.moreels@gmail.com Subject: Re: [carpedm20/fbchat] client.send() method is returning a Falseresponse (#35)

I verified and it keeps returning false. I also tried to log in with an old account and it keeps returning false as well. — You are receiving this because you commented. Reply to this email directly or view it on GitHub

afonsocarlos commented 8 years ago

How can I help? Looking for another way of sending/receiving messages maybe?

PidgeyL commented 8 years ago

This repo is based on one in JavaScript (also on GitHub). In the readme, you can find the link. See if they also have the issues, and if not, how their code differs

-----Original Message----- From: "Charliiee" notifications@github.com Sent: ‎01/‎04/‎2016 22:21 To: "carpedm20/fbchat" fbchat@noreply.github.com Cc: "Pidgey" pieterjan.moreels@gmail.com Subject: Re: [carpedm20/fbchat] client.send() method is returning a Falseresponse (#35)

How can I help? Looking for another way of sending/receiving messages maybe? — You are receiving this because you commented. Reply to this email directly or view it on GitHub

Schmavery commented 8 years ago

Hey @Charliiee, our sendMessage function appears to be working fine right now, in case you wanted to compare them. The function is a little big, but hopefully it's useful. The main idea would probably be to compare the forms sent by the different APIs to see if there's a major difference that could be causing this. Other than that, it would be a cookie issue, which we found Facebook recently started checking more closely for, but I think if it was cookies, you'd see the issue in other functions as well.

Erickira commented 8 years ago

I have the same problem (send always return false, except when I put a group discutions thread id). Do anyone know what to do?

PidgeyL commented 8 years ago

As we already stated in a few issues before, group chat is not supported yet

Erickira commented 8 years ago

Sorry, I think I wasn't very clear.

friends = client.getUsers("FRIEND'S NAME")  # return a list of names
friend = friends[0]
sent = client.send(friend.uid, "test")

When I try that I always get false, if I print the uid I get something but "sent" never get true. What I mean by group chat is when I put the thread ID of a group chat then the send command work (and the message is sent).

Edit: I've got the group chat thread ID by looking directly in Facebook, the thread id appear in the URL but not for single user chat.

JohnathonNow commented 8 years ago

I can confirm that send does not work for single user chats but it does work for group chats with the group IDs found from the URL of the chat.

Edit: If you add 'message_batch[0][other_user_fbid]': thread_id to the data dictionary in the send function, then you can send messages to single users, but not group chats. I suggest that send take another argument, group, which defaults to False, that, if False adds the above to said dictionary.

Erickira commented 8 years ago

It works, but now when I use the friends=client.getUsers("FRIEND'S NAME") I get this error:

File "C:\Python27\lib\json\decoder.py", line 382, in raw_decode
obj, end = self.scan_once(s, idx)
ValueError: Expecting ',' delimiter: line 1 column 69 (char 68)

I'll try to find out how to fix this. Thanks JohnathonNow for your single users send fix.

Edit: It work if I directly put a thread Id of a single user conversation.

afonsocarlos commented 8 years ago

It works! thank you very much! @Erickira, about the getUsers("FRIEND'S NAME") error, try to change the return value in get_json() function from utils.py this was fixed already #32 . You can also check my fork :)

Erickira commented 8 years ago

@Charliiee Thanks, I've did it on the computer I used before but completely forgot about it when I changed computer. Thanks for your help.

kiliangraf commented 8 years ago

@JohnathonNow i added the line to the dictionary, but still cannot write single users messages

JohnathonNow commented 8 years ago

@creezbb How are you trying to send the single user message? Is it simply returning false and not sending?

kiliangraf commented 8 years ago

if i print the return value it says "none"

JohnathonNow commented 8 years ago

@creezbb And if you use known-to-be code, such as @Charliiee's fork, do you still have the issue?

kiliangraf commented 8 years ago

I added the line to the data dictionary, but it doesn't seem to do anything. Do i need to change code elsewhere?

yuvraj-credr commented 8 years ago

Guys, I'm still getting return value as "False" for client.send(), though I verified my account and evrything. I did this:

friends = client.getUsers("FRIEND'S NAME") friend = friends[0] sent = client.send(friend.uid, "test") I got the friend uid as well but not able to send message, it returning as False. Please suggest .....

DylanVanAssche commented 8 years ago

The same here, I also tried to verify my account but I can't send a message, everything else works perfect.