Skip to main content

Facebook Messenger library for Python/Asyncio.

Project description

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

Acknowledgements

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

Release history Release notifications | RSS feed

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

fbchat-asyncio-0.4.0a4.tar.gz (53.4 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

fbchat_asyncio-0.4.0a4-py3-none-any.whl (64.2 kB view details)

Uploaded Python 3

File details

Details for the file fbchat-asyncio-0.4.0a4.tar.gz.

File metadata

  • Download URL: fbchat-asyncio-0.4.0a4.tar.gz
  • Upload date:
  • Size: 53.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for fbchat-asyncio-0.4.0a4.tar.gz
Algorithm Hash digest
SHA256 83a5268f6f8cabee6a1f7eca211aa21a7b22f3212bec5f91bf1e2df388e7674b
MD5 26c99f26cf908a17c83c8766b394cc79
BLAKE2b-256 01869caf3acaaac1e1907ed17b44d6fe2ed65d1840308fbc0ea80d787d842fd3

See more details on using hashes here.

File details

Details for the file fbchat_asyncio-0.4.0a4-py3-none-any.whl.

File metadata

  • Download URL: fbchat_asyncio-0.4.0a4-py3-none-any.whl
  • Upload date:
  • Size: 64.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/3.1.1 pkginfo/1.4.2 requests/2.22.0 setuptools/45.2.0 requests-toolbelt/0.8.0 tqdm/4.30.0 CPython/3.8.2

File hashes

Hashes for fbchat_asyncio-0.4.0a4-py3-none-any.whl
Algorithm Hash digest
SHA256 8a2dbf35809517400a5b938d287c07b89b745f78d2881aff1f7ba6fc1ea4b57e
MD5 40e833d65e41d4b3a23323c5e919c72a
BLAKE2b-256 8993673b8db89b725338291b346b8dede8f632025c04fea4298a1fbd0614fe61

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page