4.3.5 • Published 5 months ago

chatbox-fca-remake v4.3.5

Weekly downloads
-
License
MIT
Repository
-
Last release
5 months ago

Chatbox-FCA-Remake - Unofficial Facebook Chat API

Chatbox-FCA-Remake is a fork of the original fca-unofficial repository. This version includes new features and updates that are integrated faster than the main repository. Please note that while new features offer added functionality, they may also introduce bugs.


Overview

The Chatbox-FCA-Remake API allows you to automate Facebook chat functionalities by emulating the browser's GET/POST requests. Unlike the official API, it does not use an authentication token and instead requires the AppState (session information) from a previously authenticated Facebook session, which can be obtained using third-party tools.


Important Notes

Login via Credentials Supported

login({
    email: "your_email",
    password: "your_password"
}, (err, api) => {
    if(err) return console.error(err);
});

AppState Support

login({
    appState: JSON.parse(fs.readFileSync('appstate.json', 'utf8'))
}, (err, api) => {
    if(err) return console.error(err);
});

To use the API, you need to provide an AppState from a previously authenticated session. You can retrieve and even update your AppState with the api.getAppState() function after logging in.

  • Kiwi Browser & c3c-ufc-utility Extension: Use the Kiwi Browser along with the c3c-ufc-utility extension to extract the AppState after logging into Facebook manually.

Once you have the AppState, load it into the API to authenticate. You can also use api.getAppState() to update the AppState during your session.

Please use the API responsibly to avoid account bans, which may result from excessive automation or spamming.


New Features

1. Bypass Automatic Behavior Detection

This feature helps bypass Facebook's behavior detection mechanisms, reducing the likelihood that your bot's activity will be flagged as automated.

2. Auto Refresh for fb_dtsg Token

The AutoRefreshFbDtsg feature automatically refreshes the fb_dtsg token, ensuring your session remains active without needing to log in again. This is especially useful as fb_dtsg tokens expire periodically.

Example 1 Example 2

If other FCAs lack this feature, they may encounter errors, as shown below: Error Example


How to Obtain AppState

Kiwi Browser & c3c-ufc-utility Extension

  1. Install the Kiwi Browser.
  2. Add the c3c-ufc-utility extension to the browser.
  3. Use the extension to extract your AppState (session cookies) after manually logging into Facebook.
  4. Save the AppState as a appstate.json file and load it into your API configuration.

For detailed instructions, refer to the official c3c-ufc-utility GitHub release.


Installation

To install chatbox-fca-remake, run the following npm command:

npm install chatbox-fca-remake

For the latest development version directly from GitHub:

npm install git+https://github.com/your/repository.git

Example Usage

Here’s an example of bot and how to log in using your AppState:

const fs = require("fs");
const login = require("chatbox-fca-remake");

// Simple bot that responds when you say "test" or "/stop"
login({
    appState: JSON.parse(fs.readFileSync('test.json', 'utf8'))  // Load AppState from the saved JSON file
}, (err, api) => {
    if (err) return console.error(err);  // Handle login errors

    // Set the bot's options for its behavior and connection
    api.setOptions({
        forceLogin: true,  // Force login even if the session is active
        listenEvents: true,  // Enable event listening
        logLevel: "silent",  // Set log level to silent (no logs)
        updatePresence: true,  // Keep the presence (status) updated
        selfListen: false,  // Do not listen to the bot's own messages
        userAgent: "Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:118.0) Gecko/20100101 Firefox/118.0",  // Set custom user agent for the bot
        online: false,  // Keep the bot offline or Set it to true if you want to see bots online status.
        autoMarkDelivery: false,  // Disable auto marking of delivery status
        autoMarkRead: false  // Disable auto marking of messages as read
    });

    // Start listening for incoming messages and events
    const stopListening = api.listenMqtt((err, event) => {
        if (err) return console.error(err);  // Handle any errors while listening

        // Switch case to handle different types of events
        switch (event.type) {
            case "message":
                if (event.body === '/stop') {  // If the message is "/stop"
                    api.sendMessage("Goodbye…", event.threadID);  // Send "Goodbye" message
                    return stopListening();  // Stop listening to events
                }
                if (event.body.toLowerCase() === 'test') {  // If the message is "test" (case-insensitive)
                    api.sendMessage("TEST BOT: " + event.body, event.threadID);  // Send a test response
                }
                break;
            case "event":
                console.log(event);  // Log any other event type
                break;
        }
    });
});

Main Functionality

  • Sending Messages:

    • Text Messages
    • Sticker Messages
    • Image/File Attachments
    • URLs
    • Emojis
  • Listening for Messages:

    • Real-time message listening
    • Event listeners for actions like user joining or leaving a chat

FAQ

  1. How do I log in without credentials?

    • After logging into Facebook manually, extract your AppState using the c3c-ufc-utility extension. This is the only supported authentication method.
  2. Can I listen for messages from the bot?

    • Yes, the bot can listen to incoming messages and automatically respond. You can customize the responses based on message content.
  3. Can I send media like images or files?

    • Yes, you can send images or files as attachments, as demonstrated in the example usage.
  4. How do I keep my session alive?

    • Once your AppState is saved, you can reuse it to authenticate without needing to log in again.

Projects Using This API

  • c3c - A customizable bot with Facebook and Discord support.
  • Messenger-CLI - Command-line interface for Facebook Messenger.

License

This project is licensed under the MIT License. See the LICENSE file for more details.


Contact & Community

For support or inquiries, contact:

Join our ChatBot Community:


Note: This project is an unofficial Facebook chat API. Please use it responsibly and in accordance with Facebook's terms of service.


4.3.5

5 months ago

4.3.2

5 months ago

4.3.4

5 months ago

4.3.1

5 months ago

4.2.9

6 months ago

4.3.0

6 months ago

4.1.8

6 months ago

4.1.7

6 months ago

4.1.9

6 months ago

4.2.3

6 months ago

4.2.2

6 months ago

4.2.5

6 months ago

4.2.4

6 months ago

4.2.1

6 months ago

4.2.0

6 months ago

4.2.7

6 months ago

4.2.6

6 months ago

4.1.4

6 months ago

4.1.3

6 months ago

4.1.6

6 months ago

4.1.5

6 months ago

4.1.0

7 months ago

4.1.2

6 months ago

4.1.1

7 months ago

4.0.9

7 months ago

4.0.8

7 months ago

4.0.5

7 months ago

4.0.7

7 months ago

4.0.6

7 months ago

4.0.1

7 months ago

4.0.0

7 months ago

4.0.2

7 months ago

2.1.2

7 months ago

2.1.1

7 months ago

2.1.4

7 months ago

2.1.3

7 months ago

2.1.5

7 months ago

3.0.9

7 months ago

2.1.0

7 months ago

3.0.4

7 months ago

3.0.3

7 months ago

3.0.2

7 months ago

3.1.0

7 months ago

3.0.1

7 months ago

3.0.8

7 months ago

3.0.7

7 months ago

3.0.6

7 months ago

3.0.5

7 months ago

3.0.0

7 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.0.9

10 months ago

1.0.8

10 months ago

1.1.6

10 months ago

1.0.7

10 months ago

1.1.5

10 months ago

1.0.6

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.1.2

10 months ago

2.0.3

10 months ago

2.0.2

10 months ago

2.0.5

10 months ago

2.0.7

10 months ago

2.0.6

10 months ago

2.0.9

9 months ago

2.0.8

10 months ago

2.0.1

10 months ago

2.0.0

10 months ago

1.0.5

10 months ago

1.0.4

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago