Facebook Messenger library for Python/Asyncio.
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!
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!
$ pip install fbchat-asyncio
You can also install directly from source, provided you have pip>=19.0:
$ pip install git+https://github.com/tulir/fbchat-asyncio.git#egg=fbchat
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.
- Tulir Asokan / @tulir
This project was originally inspired by facebook-chat-api.
Release history Release notifications | RSS feed
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
|Filename, size||File type||Python version||Upload date||Hashes|
|Filename, size fbchat_asyncio-0.6.21-py3-none-any.whl (66.4 kB)||File type Wheel||Python version py3||Upload date||Hashes View|
|Filename, size fbchat-asyncio-0.6.21.tar.gz (55.4 kB)||File type Source||Python version None||Upload date||Hashes View|
Hashes for fbchat_asyncio-0.6.21-py3-none-any.whl