<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 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
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 extension](https://github.com/c3cbot/c3c-ufc-utility) in your browser. Go back to your Facebook account and use this extension while you are on Facebook. You will get the cookies save the cookies 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"
# 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()
asyncio.run(main())
```
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"
bot = await Test.startSession(cookies_path)
if await bot.isLoggedIn():
print("Logged in as", bot_info.uid)
try:
await bot.listen()
except Exception as e:
print(e)
asyncio.run(main())
```
## 🔧 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": "https://github.com/togashigreat/fbchat-muqit",
"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/8c/1a/72474049eebf436f5f7c393e2e72552e05aa89ed03cb844906c0bc230102/fbchat_muqit-1.1.0.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 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\nTo 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 extension](https://github.com/c3cbot/c3c-ufc-utility) in your browser. Go back to your Facebook account and use this extension while you are on Facebook. You will get the cookies save the cookies 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\"\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\nasyncio.run(main())\n\n```\n\nSubclassing 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\"\n bot = await Test.startSession(cookies_path)\n if await bot.isLoggedIn():\n print(\"Logged in as\", bot_info.uid)\n\n try:\n await bot.listen()\n except Exception as e:\n print(e)\n\n\nasyncio.run(main()) \n\n```\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.0",
"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": "",
"digests": {
"blake2b_256": "b877b8daaf64da095239ba3a84b959f3a4b2e33d019bc689e2d025cae8db021f",
"md5": "2d23cd4c656311111cb4d72989e1745e",
"sha256": "a96fc0d9990104b02d4e93111c521e5aa5c768d01a41a0e167d92b4a2c820acf"
},
"downloads": -1,
"filename": "fbchat_muqit-1.1.0-py3-none-any.whl",
"has_sig": false,
"md5_digest": "2d23cd4c656311111cb4d72989e1745e",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.9",
"size": 65617,
"upload_time": "2025-01-08T04:04:11",
"upload_time_iso_8601": "2025-01-08T04:04:11.442284Z",
"url": "https://files.pythonhosted.org/packages/b8/77/b8daaf64da095239ba3a84b959f3a4b2e33d019bc689e2d025cae8db021f/fbchat_muqit-1.1.0-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "8c1a72474049eebf436f5f7c393e2e72552e05aa89ed03cb844906c0bc230102",
"md5": "83555791488b336f0aa111f54ae3a4ab",
"sha256": "ee56b9b18dc2388f1f66133d4318077da493da7f50f719b3636719a58c3e0103"
},
"downloads": -1,
"filename": "fbchat_muqit-1.1.0.tar.gz",
"has_sig": false,
"md5_digest": "83555791488b336f0aa111f54ae3a4ab",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.9",
"size": 56105,
"upload_time": "2025-01-08T04:04:14",
"upload_time_iso_8601": "2025-01-08T04:04:14.918946Z",
"url": "https://files.pythonhosted.org/packages/8c/1a/72474049eebf436f5f7c393e2e72552e05aa89ed03cb844906c0bc230102/fbchat_muqit-1.1.0.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-08 04:04:14",
"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"
}