{"id":17593844,"url":"https://github.com/rfs-adreno/fbapy","last_synced_at":"2025-04-30T06:45:12.001Z","repository":{"id":217880327,"uuid":"645873157","full_name":"RFS-ADRENO/fbapy","owner":"RFS-ADRENO","description":"Unofficial Facebook Chat API for Python","archived":false,"fork":false,"pushed_at":"2024-01-29T15:56:34.000Z","size":219,"stargazers_count":21,"open_issues_count":3,"forks_count":5,"subscribers_count":2,"default_branch":"main","last_synced_at":"2025-04-30T06:44:56.743Z","etag":null,"topics":["api","chatbot","facebook","messenger","python"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/RFS-ADRENO.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-05-26T16:31:12.000Z","updated_at":"2025-03-27T01:01:57.000Z","dependencies_parsed_at":"2024-10-23T02:00:10.653Z","dependency_job_id":null,"html_url":"https://github.com/RFS-ADRENO/fbapy","commit_stats":null,"previous_names":["rfs-adreno/fbapy"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Ffbapy","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Ffbapy/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Ffbapy/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/RFS-ADRENO%2Ffbapy/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/RFS-ADRENO","download_url":"https://codeload.github.com/RFS-ADRENO/fbapy/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":251658196,"owners_count":21622819,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","chatbot","facebook","messenger","python"],"created_at":"2024-10-22T06:43:21.980Z","updated_at":"2025-04-30T06:45:11.932Z","avatar_url":"https://github.com/RFS-ADRENO.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# fbapy\nUnofficial Facebook Chat API for Python\n\n## Table of Contents\n\n- [Introduction](#introduction)\n- [Installation](#installation)\n  - [libmagic issue](#libmagic-issue)\n- [Example Usage](#example-usage)\n    - [Login](#login)\n    - [Send Message (HTTP Method)](#send-message-http-method)\n- [Testing](#testing)\n- [Documentation](#documentation)\n- [License](#license)\n\n\n## Introduction\n\nfbapy is a Python version of the Node.js package [@xaviabot/fca-unofficial](https://www.npmjs.com/package/@xaviabot/fca-unofficial). It is based on the forked deprecated version [fca-unoffical](https://www.npmjs.com/package/fca-unofficial), which itself is a fork of the deprecated version [facebook-chat-api](https://www.npmjs.com/package/facebook-chat-api).\n\n\nfbapy acknowledges the contributions of the original authors of [facebook-chat-api](https://www.npmjs.com/package/facebook-chat-api), recognizes the efforts put into [fca-unoffical](https://www.npmjs.com/package/fca-unofficial), and explains that the Python version is based on the for [@xaviabot/fca-unofficial](https://www.npmjs.com/package/@xaviabot/fca-unofficial).\n\n\n## Installation\n\nfbapy is available on PyPI:\n\n```bash\npip install fbapy\n```\n\n### libmagic issue\n\nIf you encounter an error like this:\n\n`ImportError: failed to find libmagic.  Check your installation`\n\nYou need to install libmagic.\n\nFor Termux:\n\n```bash\npkg install sox\n```\n\nFor [replit.com](https://replit.com/), open `replit.nix` and add magic to the list of dependencies, for example:\n\n```nix\n{ pkgs }: {\n  deps = [\n    pkgs.python311Packages.magic\n  ];\n}\n```\n\nFor Other Platforms, try installing `python-magic-bin`:\n\n```bash\npip install python-magic-bin==0.4.14\n```\n\n\n## Example Usage\n\n### Login\n\nUsing base64 encoded appstate from [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate)\n\n```python\nfrom fbapy import *\n\nclient = Client()\n\napi = client.login(\n    appstate=\"YOUR_BASE64_ENCODED_APP_STATE\",\n    options={\n        \"user_agent\": \"YOUR_USER_AGENT\",\n    },\n)\n```\n\n### Send Message (HTTP Method)\n\n```python\napi.http.send_message(\n    msg=\"Hello World!\",\n    thread_id=\"0000000000000000\",\n)\n```\n\n## Testing\n\nYou can run `test.py` to test the package. Install packages from requirements.txt + python-dotenv first.\n\n```bash\npip install -r requirements.txt\npip install python-dotenv\n```\n\nThen create a `.env` file in the root directory of the project and add the following:\n\n```bash\nAPPSTATE=\"YOUR_BASE64_ENCODED_APP_STATE\"\n```\n\nThen run `test.py`:\n\n```bash\npython test.py\n```\n\nOpen a chat with the appstate account, try sending `?ping1`/`?ping2`, and you should get a reply `pong`\n\n![Alt text](https://i.ibb.co/Mg3WZ3w/image-2024-01-18-221941325.png)\n\n## Documentation\n\nSee [DOCS.md](DOCS.md) for more information.\n\n## License\n\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfs-adreno%2Ffbapy","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frfs-adreno%2Ffbapy","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frfs-adreno%2Ffbapy/lists"}