fbapy


Namefbapy JSON
Version 1.0.1 PyPI version JSON
download
home_pagehttps://github.com/RFS-ADRENO/fbapy
SummaryUnofficial Facebook Chat API for Python
upload_time2024-01-19 03:00:32
maintainer
docs_urlNone
authorRFS-ADRENO (RDU), KhangPhan27 (KhangPhan)
requires_python
license
keywords facebook messenger chat api python unofficial
VCS
bugtrack_url
requirements certifi charset-normalizer idna paho-mqtt python-magic requests urllib3
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # fbapy
Unofficial Facebook Chat API for Python

## Table of Contents

- [Introduction](#introduction)
- [Installation](#installation)
  - [libmagic issue](#libmagic-issue)
- [Example Usage](#example-usage)
    - [Login](#login)
    - [Send Message (HTTP Method)](#send-message-http-method)
- [Testing](#testing)
- [Documentation](#documentation)
- [License](#license)


## Introduction

fbapy 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).


fbapy 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).


## Installation

fbapy is available on PyPI:

```bash
pip install fbapy
```

### libmagic issue

If you encounter an error like this:

`ImportError: failed to find libmagic.  Check your installation`

You need to install libmagic.

For Termux:

```bash
pkg install sox
```

For [replit.com](https://replit.com/), open `replit.nix` and add magic to the list of dependencies, for example:

```nix
{ pkgs }: {
  deps = [
    pkgs.python311Packages.magic
  ];
}
```

For Other Platforms, try installing `python-magic-bin`:

```bash
pip install python-magic-bin==0.4.14
```


## Example Usage

### Login

Using base64 encoded appstate from [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate)

```python
from fbapy import *

client = Client()

api = client.login(
    appstate="YOUR_BASE64_ENCODED_APP_STATE",
    options={
        "user_agent": "YOUR_USER_AGENT",
    },
)
```

### Send Message (HTTP Method)

```python
api.http.send_message(
    msg="Hello World!",
    thread_id="0000000000000000",
)
```

## Testing

You can run `test.py` to test the package. Install packages from requirements.txt + python-dotenv first.

```bash
pip install -r requirements.txt
pip install python-dotenv
```

Then create a `.env` file in the root directory of the project and add the following:

```bash
APPSTATE="YOUR_BASE64_ENCODED_APP_STATE"
```

Then run `test.py`:

```bash
python test.py
```

Open a chat with the appstate account, try sending `?ping1`/`?ping2`, and you should get a reply `pong`

![Alt text](https://i.ibb.co/Mg3WZ3w/image-2024-01-18-221941325.png)

## Documentation

See [DOCS.md](DOCS.md) for more information.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/RFS-ADRENO/fbapy",
    "name": "fbapy",
    "maintainer": "",
    "docs_url": null,
    "requires_python": "",
    "maintainer_email": "",
    "keywords": "facebook,messenger,chat,api,python,unofficial",
    "author": "RFS-ADRENO (RDU), KhangPhan27 (KhangPhan)",
    "author_email": "",
    "download_url": "https://files.pythonhosted.org/packages/ae/13/0e03465ad3a002b5e8edb15a8c69ed8616a8eb65bb6d4cd1df80661df961/fbapy-1.0.1.tar.gz",
    "platform": null,
    "description": "# fbapy\r\nUnofficial Facebook Chat API for Python\r\n\r\n## Table of Contents\r\n\r\n- [Introduction](#introduction)\r\n- [Installation](#installation)\r\n  - [libmagic issue](#libmagic-issue)\r\n- [Example Usage](#example-usage)\r\n    - [Login](#login)\r\n    - [Send Message (HTTP Method)](#send-message-http-method)\r\n- [Testing](#testing)\r\n- [Documentation](#documentation)\r\n- [License](#license)\r\n\r\n\r\n## Introduction\r\n\r\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).\r\n\r\n\r\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).\r\n\r\n\r\n## Installation\r\n\r\nfbapy is available on PyPI:\r\n\r\n```bash\r\npip install fbapy\r\n```\r\n\r\n### libmagic issue\r\n\r\nIf you encounter an error like this:\r\n\r\n`ImportError: failed to find libmagic.  Check your installation`\r\n\r\nYou need to install libmagic.\r\n\r\nFor Termux:\r\n\r\n```bash\r\npkg install sox\r\n```\r\n\r\nFor [replit.com](https://replit.com/), open `replit.nix` and add magic to the list of dependencies, for example:\r\n\r\n```nix\r\n{ pkgs }: {\r\n  deps = [\r\n    pkgs.python311Packages.magic\r\n  ];\r\n}\r\n```\r\n\r\nFor Other Platforms, try installing `python-magic-bin`:\r\n\r\n```bash\r\npip install python-magic-bin==0.4.14\r\n```\r\n\r\n\r\n## Example Usage\r\n\r\n### Login\r\n\r\nUsing base64 encoded appstate from [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate)\r\n\r\n```python\r\nfrom fbapy import *\r\n\r\nclient = Client()\r\n\r\napi = client.login(\r\n    appstate=\"YOUR_BASE64_ENCODED_APP_STATE\",\r\n    options={\r\n        \"user_agent\": \"YOUR_USER_AGENT\",\r\n    },\r\n)\r\n```\r\n\r\n### Send Message (HTTP Method)\r\n\r\n```python\r\napi.http.send_message(\r\n    msg=\"Hello World!\",\r\n    thread_id=\"0000000000000000\",\r\n)\r\n```\r\n\r\n## Testing\r\n\r\nYou can run `test.py` to test the package. Install packages from requirements.txt + python-dotenv first.\r\n\r\n```bash\r\npip install -r requirements.txt\r\npip install python-dotenv\r\n```\r\n\r\nThen create a `.env` file in the root directory of the project and add the following:\r\n\r\n```bash\r\nAPPSTATE=\"YOUR_BASE64_ENCODED_APP_STATE\"\r\n```\r\n\r\nThen run `test.py`:\r\n\r\n```bash\r\npython test.py\r\n```\r\n\r\nOpen a chat with the appstate account, try sending `?ping1`/`?ping2`, and you should get a reply `pong`\r\n\r\n![Alt text](https://i.ibb.co/Mg3WZ3w/image-2024-01-18-221941325.png)\r\n\r\n## Documentation\r\n\r\nSee [DOCS.md](DOCS.md) for more information.\r\n\r\n## License\r\n\r\nThis project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.\r\n",
    "bugtrack_url": null,
    "license": "",
    "summary": "Unofficial Facebook Chat API for Python",
    "version": "1.0.1",
    "project_urls": {
        "Homepage": "https://github.com/RFS-ADRENO/fbapy"
    },
    "split_keywords": [
        "facebook",
        "messenger",
        "chat",
        "api",
        "python",
        "unofficial"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "c23e7db23a8f2e7d2c9a00efc97746c50a0ed57dcb91381136440c3b29a3a1b9",
                "md5": "87a193fc5a15a17f189c2f79bd5ecf15",
                "sha256": "d22d3bbf0db64c4ddfc68531006713a3f697c04ddaf81ec88feb663c0d4861e8"
            },
            "downloads": -1,
            "filename": "fbapy-1.0.1-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "87a193fc5a15a17f189c2f79bd5ecf15",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 38335,
            "upload_time": "2024-01-19T03:00:29",
            "upload_time_iso_8601": "2024-01-19T03:00:29.381529Z",
            "url": "https://files.pythonhosted.org/packages/c2/3e/7db23a8f2e7d2c9a00efc97746c50a0ed57dcb91381136440c3b29a3a1b9/fbapy-1.0.1-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "ae130e03465ad3a002b5e8edb15a8c69ed8616a8eb65bb6d4cd1df80661df961",
                "md5": "66bd408f7ee60826769b9f08b2a64efa",
                "sha256": "006778c409310f12fb3d8b0e4183c66ada702261aee7cf84f220467b8fb6d07f"
            },
            "downloads": -1,
            "filename": "fbapy-1.0.1.tar.gz",
            "has_sig": false,
            "md5_digest": "66bd408f7ee60826769b9f08b2a64efa",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 30493,
            "upload_time": "2024-01-19T03:00:32",
            "upload_time_iso_8601": "2024-01-19T03:00:32.446459Z",
            "url": "https://files.pythonhosted.org/packages/ae/13/0e03465ad3a002b5e8edb15a8c69ed8616a8eb65bb6d4cd1df80661df961/fbapy-1.0.1.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-01-19 03:00:32",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "RFS-ADRENO",
    "github_project": "fbapy",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "certifi",
            "specs": [
                [
                    "==",
                    "2023.7.22"
                ]
            ]
        },
        {
            "name": "charset-normalizer",
            "specs": [
                [
                    "==",
                    "3.3.2"
                ]
            ]
        },
        {
            "name": "idna",
            "specs": [
                [
                    "==",
                    "3.4"
                ]
            ]
        },
        {
            "name": "paho-mqtt",
            "specs": [
                [
                    "==",
                    "1.6.1"
                ]
            ]
        },
        {
            "name": "python-magic",
            "specs": [
                [
                    "==",
                    "0.4.27"
                ]
            ]
        },
        {
            "name": "requests",
            "specs": [
                [
                    "==",
                    "2.31.0"
                ]
            ]
        },
        {
            "name": "urllib3",
            "specs": [
                [
                    "==",
                    "2.1.0"
                ]
            ]
        }
    ],
    "lcname": "fbapy"
}
        
Elapsed time: 0.16835s