TimLChan / fbchat

Facebook Chat (Messenger) for Python

Home Page:https://fbchat.readthedocs.io

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

This project is semi-maintained

This project is was previously maintained by @madsmtm and @carpedm20, but they both no longer have the time to continue to maintain the project. Therefore, this fork will try to maintain a workable solution until there is a proper maintainer available to add/modify functionality. Follow the discussion in issue 613 for updates on if/when a maintainer has been found.

Most importantly, this code has been maintained in a works for me approach, meaning that any issues that arise from the code fits into two buckets:

  1. It affects me and I'll try fix it
  2. It doesn't affect me and I probably won't look at it

If you've read through all that and still want to use the code, you can do the following:

$ python -m pip install git+https://github.com/TimLChan/fbchat.git

Original project description below

fbchat - Facebook Messenger for Python

Project version Supported python versions: 3.5, 3.6, 3.7, 3.8 and pypy License: BSD 3-Clause Documentation Travis CI Code style

A powerful and efficient library to interact with Facebook's Messenger, using just your email and password.

This is not an official API, Facebook has that over here for chat bots. This library differs by using a normal Facebook account instead.

fbchat currently support:

  • Sending many types of messages, with files, stickers, mentions, etc.
  • Fetching all messages, threads and images in threads.
  • Searching for messages and threads.
  • Creating groups, setting the group emoji, changing nicknames, creating polls, etc.
  • Listening for, an reacting to messages and other events in real-time.
  • Type hints, and it has a modern codebase (e.g. only Python 3.5 and upwards).
  • async/await (COMING).

Essentially, everything you need to make an amazing Facebook bot!

Version Warning

v2 is currently being developed at the master branch and it's highly unstable. If you want to view the old v1, go here.

Additionally, you can view the project's progress here.

Caveats

fbchat works by imitating what the browser does, and thereby tricking Facebook into thinking it's accessing the website normally.

However, there's a catch! Using this library may not comply with Facebook's Terms Of Service!, so be responsible Facebook citizens! We are not responsible if your account gets banned!

Additionally, the APIs the library is calling is undocumented! In theory, this means that your code could break tomorrow, without the slightest warning! If this happens to you, please report it, so that we can fix it as soon as possible!

With that out of the way, you may go to Read The Docs to see the full documentation!

Installation

$ pip install fbchat

If you don't have pip, this guide can guide you through the process.

You can also install directly from source, provided you have pip>=19.0:

$ pip install git+https://github.com/carpedm20/fbchat.git

Example Usage

import getpass
import fbchat
session = fbchat.Session.login("<email/phone number>", getpass.getpass())
user = fbchat.User(session=session, id=session.user_id)
user.send_text("Test message!")

More examples are available here.

Maintainer

No one, see notice at the top.

Acknowledgements

This project was originally inspired by facebook-chat-api.

About

Facebook Chat (Messenger) for Python

https://fbchat.readthedocs.io

License:BSD 3-Clause "New" or "Revised" License


Languages

Language:Python 100.0%