Skip to main content

A powerful Facebook Messenger API to interact with Facebook and Messenger.

Project description

fbchat-muqit Facebook & Messenger API

PyPI - Python Version fbchat-muqit License: GPLv3

fbchat-muqit An Unofficial Asynchronous Facebook Messenger API designed to interact with Facebook and Messenger. As It is an Unofficial API we are not responsible if you get banned by Facebook. We recommend to use a dummy Facebook account. For more details check the Documentation.

[!WARNING] Due to end-to-end encryption sending messages to other Users is not supported anymore. You can send messages to Group Chat, Room Chat and to pages. See more You may still be able to send messages to another User if the that User account is inactive for many years because end-to-end encryption is not applied when sending message to those account unless the account is Opened again.

🛠️ Installation

You can install fbchat-muqit using pip:

pip install fbchat-muqit

For the latest development version:

pip install git+https://github.com/togashigreat/fbchat-muqit.git 

📙 Documentation

The API is Documented. Read The Documentation.

🔧 Prerequisites

  • Python 3.9+
  • A Facebook account (It's safer to use old unused account)
  • Facebook account cookies 🍪

📖 Usage Example

To login in Facebook you will need Facebook account cookies. Since login via email and password is no longer supported.

To get your Facebook account cookies. First login in your Facebook account and then add C3C Chrome extension in your browser. Open a your Facebook account in a browser tab and use this extension to get your account cookies. Copy the cookies and save them in a json file. We will use the cookies to interact with Facebook server. We will call this account Client account.

A basic example of How to use it.

from fbchat_muqit import Client, Message, EventType

client = Client(cookies_file_path="cookies.json")

@client.event
async def on_message(message: Message):
    # To avoid spam check if sender_id is client's id or not
    if message.sender_id != client.uid:
        # echo the message
        await client.send_message(message.text, message.thread_id)

client.run()

Save the code in file test.py and now run the code.

python3 test.py

If It logins succesfully then Use another Facebook account to create a messenger group and add both of the accounts to the group. Now, send message to the group and fbchat_muqit Client account will listen to all incoming messages and events. If everything works properly It should reply and react to the message sent by your other account with an emoji.

📄 License

This project is distributed under a dual-license model:

  • BSD-3-Clause License: Parts of the code are reused and adapted from the original fbchat library, licensed under the BSD-3-Clause License. See LICENSE-BSD for details.

  • GPL v3 License: New contributions and modifications by Muhammad MuQiT/togashigreat are licensed under the GPL v3.0 License. See LICENSE for details.

✉️Contact Me

Project details


Download files

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

Source Distribution

fbchat_muqit-1.2.0.tar.gz (206.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_muqit-1.2.0-py3-none-any.whl (108.5 kB view details)

Uploaded Python 3

File details

Details for the file fbchat_muqit-1.2.0.tar.gz.

File metadata

  • Download URL: fbchat_muqit-1.2.0.tar.gz
  • Upload date:
  • Size: 206.4 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fbchat_muqit-1.2.0.tar.gz
Algorithm Hash digest
SHA256 e806f10df915588aa73000e2e6f89e62099fa6e8e26a0068c7ce8719031a3489
MD5 b95a1144b1e49aea589615dcda3a000e
BLAKE2b-256 6faff2ae460149a907889e1aae19b38aa1bd9a1a2d926b430641c99f48758a12

See more details on using hashes here.

Provenance

The following attestation bundles were made for fbchat_muqit-1.2.0.tar.gz:

Publisher: python_publish.yml on togashigreat/fbchat-muqit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file fbchat_muqit-1.2.0-py3-none-any.whl.

File metadata

  • Download URL: fbchat_muqit-1.2.0-py3-none-any.whl
  • Upload date:
  • Size: 108.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for fbchat_muqit-1.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 e4cbf69e82ee9db4467372c21c126c0a2702f644af25e524b799831501565b2a
MD5 23980c17f8b6a66dee587b58d2173b8d
BLAKE2b-256 aff04646515d8359753cf051fdbac9db7e641e2e86c98bec85ee202aea104e0a

See more details on using hashes here.

Provenance

The following attestation bundles were made for fbchat_muqit-1.2.0-py3-none-any.whl:

Publisher: python_publish.yml on togashigreat/fbchat-muqit

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

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