<div align="center">
# fbchat-muqit Facebook & Messenger API

[](https://pypi.org/project/fbchat-muqit/)
[](https://www.gnu.org/licenses/gpl-3.0)
**fbchat-muqit** An Unofficial Asynchronous Facebook Messenger API designed to interact with Facebook and Messenger. It is an early release. Most of the feautures are not available yet.
As It is an Unofficial API we are not responsible if you get banned by Facebook. We recommend to use a dummy Facebook account.
</div>
## 🛠️ Installation
You can install fbchat-muqit using pip:
```bash
pip install fbchat-muqit
```
## 📙 Documentation
The API is not fully documented yet [Read Documentation](http://fbchat-muqit.rtfd.io/)
## 📖 Usage Example
• Usage Requirements:
- A Facebook account (It's safer to use new account)
- Facebook account cookies 🍪
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](https://github.com/c3cbot/c3c-ufc-utility) 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.
A basic example of How to use it.
```python
import asyncio
from fbchat_muqit import Client, ThreadType
async def main():
cookies_path = "path to json cookies file"
# Lets login in Facebook
bot = await Client.startSession(cookies_path)
if await bot.isLoggedIn():
"""Lets send a Message to a friend when Client is logged in."""
# put a valid fb user id
await bot.sendMessage("I'm Online!", "10000072727288", ThreadType.USER)
print("Logged in as", bot.uid)
# listen to all incoming events
await bot.listen()
# Windows User uncomment below two lines
# if sys.platform.startswith("win"):
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
```
Save the code and now run it.
```bash
python3 test.py
```
If It logins successfully then It will send a message to the given Facebook User.
• Subclassing Client class.
```python
from fbchat_muqit import Client, Message, ThreadType
import asyncio
# Create a class use Client as base Class
class Test(Client):
async def onMessage(self, mid, author_id: str, message_object: Message, thread_id, thread_type=ThreadType.USER, **kwargs):
"""you will receive all messenger messages here every time anyone sends messages in a thread (Group/User)"""
# author_id is message sender ID
if author_id != self.uid:
await message_object.reply("Hello! This is a reply")
await message_object.react("❤️")
# mid is message ID
await self.sendMessage("Hello", thread_id, thread_type, reply_to_id=mid)
async def main():
cookies_path = "path to json cookies file"
bot = await Test.startSession(cookies_path)
if await bot.isLoggedIn():
fetch_client_info = await bot.fetchUserInfo(bot.uid)
client_info = fetch_client_info[bot.uid]
print("Logged in as", client_info.name)
try:
await bot.listen()
except Exception as e:
print(e)
# Windows User uncomment below two lines
# if sys.platform.startswith("win"):
# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())
asyncio.run(main())
```
Save the code and now run it.
```bash
python3 test.py
```
Now, use another Facebook account to send message to the fbchat_muqit Client account. If everything works properly It should reply and react to the message with an emoji.
## 🔧 Requirements
- Python 3.9+
- aiohttp
- aiomqtt
- aenum
### 📄 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](https://github.com/fbchat-dev/fbchat) library, licensed under the BSD-3-Clause License.
See [LICENSE-BSD](./LICENSE-BSD.md) for details.
- **GPL v3 License**: New contributions and modifications by Muhammad MuQiT/togashigreat are licensed under the GPL v3.0 License.
See [LICENSE](./LICENSE.md) for details.
Raw data
{
"_id": null,
"home_page": null,
"name": "fbchat-muqit",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.9",
"maintainer_email": null,
"keywords": "facebook, messenger, chat, api, asyncio",
"author": "Muhammad MuQiT",
"author_email": "togashiyuuta1111@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/a0/8e/9cd5de51d4232c667d61cdb69821b9a9fb106b7ce74be693f7fc6cc05d2a/fbchat_muqit-1.1.31.tar.gz",
"platform": null,
"description": "<div align=\"center\">\n\n# fbchat-muqit Facebook & Messenger API\n\n\n[](https://pypi.org/project/fbchat-muqit/)\n[](https://www.gnu.org/licenses/gpl-3.0)\n\n**fbchat-muqit** An Unofficial Asynchronous Facebook Messenger API designed to interact with Facebook and Messenger. It is an early release. Most of the feautures are not available yet. \nAs It is an Unofficial API we are not responsible if you get banned by Facebook. We recommend to use a dummy Facebook account.\n\n</div>\n\n## \ud83d\udee0\ufe0f Installation\n\nYou can install fbchat-muqit using pip:\n\n```bash\npip install fbchat-muqit\n\n```\n\n\n## \ud83d\udcd9 Documentation\n\nThe API is not fully documented yet [Read Documentation](http://fbchat-muqit.rtfd.io/)\n\n## \ud83d\udcd6 Usage Example\n\n\u2022 Usage Requirements:\n- A Facebook account (It's safer to use new account)\n- Facebook account cookies \ud83c\udf6a\n\n\n\nTo login in Facebook you will need Facebook account cookies. Since login via email and password is no longer supported. \n\nTo get your Facebook account cookies. First login in your Facebook account and then add [C3C Chrome extension](https://github.com/c3cbot/c3c-ufc-utility) 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.\n\nA basic example of How to use it.\n\n```python\nimport asyncio\nfrom fbchat_muqit import Client, ThreadType\n\nasync def main():\n cookies_path = \"path to json cookies file\"\n # Lets login in Facebook\n bot = await Client.startSession(cookies_path)\n if await bot.isLoggedIn():\n\n \"\"\"Lets send a Message to a friend when Client is logged in.\"\"\"\n # put a valid fb user id\n await bot.sendMessage(\"I'm Online!\", \"10000072727288\", ThreadType.USER)\n print(\"Logged in as\", bot.uid)\n # listen to all incoming events\n await bot.listen()\n\n# Windows User uncomment below two lines\n# if sys.platform.startswith(\"win\"):\n# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\nasyncio.run(main())\n\n```\n\nSave the code and now run it. \n\n```bash\npython3 test.py\n```\nIf It logins successfully then It will send a message to the given Facebook User. \n\n\n\u2022 Subclassing Client class. \n\n```python\n\nfrom fbchat_muqit import Client, Message, ThreadType\nimport asyncio\n# Create a class use Client as base Class\nclass Test(Client):\n\n async def onMessage(self, mid, author_id: str, message_object: Message, thread_id, thread_type=ThreadType.USER, **kwargs):\n\n \"\"\"you will receive all messenger messages here every time anyone sends messages in a thread (Group/User)\"\"\"\n # author_id is message sender ID\n if author_id != self.uid:\n await message_object.reply(\"Hello! This is a reply\")\n await message_object.react(\"\u2764\ufe0f\")\n # mid is message ID\n await self.sendMessage(\"Hello\", thread_id, thread_type, reply_to_id=mid)\n\n\nasync def main():\n cookies_path = \"path to json cookies file\"\n bot = await Test.startSession(cookies_path)\n if await bot.isLoggedIn():\n fetch_client_info = await bot.fetchUserInfo(bot.uid)\n client_info = fetch_client_info[bot.uid]\n print(\"Logged in as\", client_info.name)\n\n try:\n await bot.listen()\n except Exception as e:\n print(e)\n\n\n# Windows User uncomment below two lines\n# if sys.platform.startswith(\"win\"):\n# asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())\nasyncio.run(main()) \n\n```\n\nSave the code and now run it. \n\n```bash\npython3 test.py\n```\n\nNow, use another Facebook account to send message to the fbchat_muqit Client account. If everything works properly It should reply and react to the message with an emoji. \n\n\n## \ud83d\udd27 Requirements\n\n- Python 3.9+\n- aiohttp\n- aiomqtt\n- aenum\n\n\n### \ud83d\udcc4 License\n\nThis project is distributed under a dual-license model:\n\n- **BSD-3-Clause License**: Parts of the code are reused and adapted from the original [fbchat](https://github.com/fbchat-dev/fbchat) library, licensed under the BSD-3-Clause License. \n See [LICENSE-BSD](./LICENSE-BSD.md) for details.\n\n- **GPL v3 License**: New contributions and modifications by Muhammad MuQiT/togashigreat are licensed under the GPL v3.0 License.\nSee [LICENSE](./LICENSE.md) for details.\n\n\n",
"bugtrack_url": null,
"license": "GPL-V3",
"summary": "A powerful Facebook Messenger API to interact with Facebook and Messenger.",
"version": "1.1.31",
"project_urls": {
"Documentation": "https://fbchat-muqit.readthedocs.io",
"Homepage": "https://github.com/togashigreat/fbchat-muqit",
"Repository": "https://github.com/togashigreat/fbchat-muqit"
},
"split_keywords": [
"facebook",
" messenger",
" chat",
" api",
" asyncio"
],
"urls": [
{
"comment_text": null,
"digests": {
"blake2b_256": "e9787629db82cfb19a0df0071fcee42abea33492f7cf1abd6cdc20cdb996ea98",
"md5": "ea07aaf52cfdc807f4ef426576bf7c39",
"sha256": "f8ef7628ba7f356c2ad765b569b90438203dacf6509333d901e6d3054011e280"
},
"downloads": -1,
"filename": "fbchat_muqit-1.1.31-py3-none-any.whl",
"has_sig": false,
"md5_digest": "ea07aaf52cfdc807f4ef426576bf7c39",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 69204,
"upload_time": "2025-07-14T19:53:50",
"upload_time_iso_8601": "2025-07-14T19:53:50.994957Z",
"url": "https://files.pythonhosted.org/packages/e9/78/7629db82cfb19a0df0071fcee42abea33492f7cf1abd6cdc20cdb996ea98/fbchat_muqit-1.1.31-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": null,
"digests": {
"blake2b_256": "a08e9cd5de51d4232c667d61cdb69821b9a9fb106b7ce74be693f7fc6cc05d2a",
"md5": "8c0fb4ea9d92eaa53474a520753f6ae9",
"sha256": "8f8c02aa43aa6b33ff73dd7228d8a102f83702d7a55c956acad7c955691a1992"
},
"downloads": -1,
"filename": "fbchat_muqit-1.1.31.tar.gz",
"has_sig": false,
"md5_digest": "8c0fb4ea9d92eaa53474a520753f6ae9",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 59502,
"upload_time": "2025-07-14T19:53:52",
"upload_time_iso_8601": "2025-07-14T19:53:52.317029Z",
"url": "https://files.pythonhosted.org/packages/a0/8e/9cd5de51d4232c667d61cdb69821b9a9fb106b7ce74be693f7fc6cc05d2a/fbchat_muqit-1.1.31.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-07-14 19:53:52",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "togashigreat",
"github_project": "fbchat-muqit",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"lcname": "fbchat-muqit"
}