Facebook Chat (Messenger) for Python. This project was inspired by facebook-chat-api.
No XMPP or API key is needed. Just use your ID and PASSWORD.
Simple:
$ pip install fbchat
import fbchat
client = fbchat.Client("YOUR_ID", "YOUR_PASSWORD")
friends = client.getUsers("FRIEND'S NAME") # return a list of names
friend = friends[0]
sent = client.send(friend.uid, "Your Message")
if sent:
print("Message sent successfully!")
last_messages = client.getThreadInfo(friend.uid,0)
last_messages.reverse() # messages come in reversed order
for message in last_messages:
print(message.body)
Taehoon Kim / @carpedm20