@dongdev/fca-unofficial 2.0.31 → 3.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -0
- package/LICENSE-MIT +1 -1
- package/README.md +402 -95
- package/func/checkUpdate.js +0 -1
- package/index.d.ts +685 -607
- package/package.json +1 -1
- package/src/api/messaging/createThemeAI.js +98 -0
- package/src/api/messaging/sendMessage.js +234 -341
- package/src/api/socket/core/connectMqtt.js +58 -11
- package/src/api/socket/core/emitAuth.js +39 -9
- package/src/api/socket/core/parseDelta.js +13 -4
- package/src/api/socket/listenMqtt.js +79 -10
- package/src/utils/client.js +98 -25
- package/src/utils/request.js +30 -12
- package/src/api/messaging/sendMessageMqtt.js +0 -323
package/CHANGELOG.md
CHANGED
package/LICENSE-MIT
CHANGED
package/README.md
CHANGED
|
@@ -1,32 +1,95 @@
|
|
|
1
|
-
|
|
1
|
+
<div align="center">
|
|
2
2
|
|
|
3
|
-
|
|
4
|
-
[](https://www.npmjs.com/package/@dongdev/fca-unofficial)
|
|
3
|
+
# 💬 @dongdev/fca-unofficial
|
|
5
4
|
|
|
6
|
-
|
|
5
|
+
**Unofficial Facebook Chat API for Node.js** - Interact with Facebook Messenger programmatically
|
|
6
|
+
|
|
7
|
+
[](https://www.npmjs.com/package/@dongdev/fca-unofficial)
|
|
8
|
+
[](https://www.npmjs.com/package/@dongdev/fca-unofficial)
|
|
9
|
+
[](./LICENSE-MIT)
|
|
10
|
+
[](https://nodejs.org/)
|
|
11
|
+
|
|
12
|
+
[Features](#-features) • [Installation](#-installation) • [Quick Start](#-quick-start) • [Documentation](#-documentation) • [Support](#-support)
|
|
13
|
+
|
|
14
|
+
</div>
|
|
15
|
+
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
## 📋 Table of Contents
|
|
19
|
+
|
|
20
|
+
- [⚠️ Important Disclaimer](#️-important-disclaimer)
|
|
21
|
+
- [✨ Features](#-features)
|
|
22
|
+
- [🔍 Introduction](#-introduction)
|
|
23
|
+
- [📦 Installation](#-installation)
|
|
24
|
+
- [🚀 Quick Start](#-quick-start)
|
|
25
|
+
- [📝 Message Types](#-message-types)
|
|
26
|
+
- [💾 AppState Management](#-appstate-management)
|
|
27
|
+
- [👂 Listening for Messages](#-listening-for-messages)
|
|
28
|
+
- [🎯 API Quick Reference](#-api-quick-reference)
|
|
29
|
+
- [📚 Documentation](#-documentation)
|
|
30
|
+
- [🛠️ Projects Using This API](#️-projects-using-this-api)
|
|
31
|
+
- [🤝 Contributing](#-contributing)
|
|
32
|
+
- [📄 License](#-license)
|
|
33
|
+
- [👨💻 Author & Support](#-author--support)
|
|
34
|
+
|
|
35
|
+
---
|
|
7
36
|
|
|
8
37
|
## ⚠️ Important Disclaimer
|
|
9
38
|
|
|
39
|
+
<div align="center">
|
|
40
|
+
|
|
41
|
+
**⚠️ Use at your own risk! We are not responsible for account bans.**
|
|
42
|
+
|
|
43
|
+
</div>
|
|
44
|
+
|
|
10
45
|
**We are not responsible if your account gets banned for spammy activities such as:**
|
|
11
46
|
|
|
12
|
-
- Sending lots of messages to people you don't know
|
|
13
|
-
- Sending messages very quickly
|
|
14
|
-
- Sending spammy looking URLs
|
|
15
|
-
- Logging in and out very quickly
|
|
47
|
+
- ❌ Sending lots of messages to people you don't know
|
|
48
|
+
- ❌ Sending messages very quickly
|
|
49
|
+
- ❌ Sending spammy looking URLs
|
|
50
|
+
- ❌ Logging in and out very quickly
|
|
51
|
+
|
|
52
|
+
**💡 Recommendations:**
|
|
53
|
+
|
|
54
|
+
- Use **Firefox browser** or visit [fca.dongdev.id.vn](https://fca.dongdev.id.vn) to reduce logout issues (especially for iOS users)
|
|
55
|
+
- Use **AppState** instead of credentials when possible
|
|
56
|
+
- Implement **rate limiting** in your bots
|
|
57
|
+
- Follow Facebook's Terms of Service
|
|
58
|
+
|
|
59
|
+
**🆘 Support:** If you encounter errors, contact us [here](https://www.facebook.com/mdong.dev)
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## ✨ Features
|
|
16
64
|
|
|
17
|
-
|
|
65
|
+
- ✅ **Full Messenger API** - Send messages, files, stickers, and more
|
|
66
|
+
- ✅ **Real-time Events** - Listen to messages, reactions, and thread events
|
|
67
|
+
- ✅ **User Account Support** - Works with personal Facebook accounts (not just Pages)
|
|
68
|
+
- ✅ **AppState Support** - Save login state to avoid re-authentication
|
|
69
|
+
- ✅ **MQTT Protocol** - Real-time messaging via MQTT
|
|
70
|
+
- ✅ **TypeScript Support** - Includes TypeScript definitions
|
|
71
|
+
- ✅ **Active Development** - Regularly updated and maintained
|
|
18
72
|
|
|
19
|
-
|
|
73
|
+
---
|
|
20
74
|
|
|
21
75
|
## 🔍 Introduction
|
|
22
76
|
|
|
23
|
-
Facebook
|
|
77
|
+
Facebook provides an [official API for chat bots](https://developers.facebook.com/docs/messenger-platform), but it's **only available for Facebook Pages**.
|
|
24
78
|
|
|
25
|
-
`@dongdev/fca-unofficial` is the only API that allows you to automate chat functionalities on a **user account** by emulating the browser. This means:
|
|
79
|
+
`@dongdev/fca-unofficial` is the **only API** that allows you to automate chat functionalities on a **user account** by emulating the browser. This means:
|
|
26
80
|
|
|
27
|
-
- Making the exact same GET/POST requests as a browser
|
|
28
|
-
- Does not work with auth tokens
|
|
29
|
-
- Requires Facebook account credentials (email/password) or AppState
|
|
81
|
+
- 🔄 Making the exact same GET/POST requests as a browser
|
|
82
|
+
- 🔐 Does not work with auth tokens
|
|
83
|
+
- 📝 Requires Facebook account credentials (email/password) or AppState
|
|
84
|
+
|
|
85
|
+
**Perfect for:**
|
|
86
|
+
- 🤖 Building chatbots
|
|
87
|
+
- 📱 Automating message responses
|
|
88
|
+
- 🔔 Creating notification systems
|
|
89
|
+
- 🎮 Building interactive games
|
|
90
|
+
- 📊 Analytics and monitoring
|
|
91
|
+
|
|
92
|
+
---
|
|
30
93
|
|
|
31
94
|
## 📦 Installation
|
|
32
95
|
|
|
@@ -34,9 +97,15 @@ Facebook now has an [official API for chat bots](https://developers.facebook.com
|
|
|
34
97
|
npm install @dongdev/fca-unofficial@latest
|
|
35
98
|
```
|
|
36
99
|
|
|
37
|
-
|
|
100
|
+
**Requirements:**
|
|
101
|
+
- Node.js >= 12.0.0
|
|
102
|
+
- Active Facebook account
|
|
103
|
+
|
|
104
|
+
---
|
|
38
105
|
|
|
39
|
-
|
|
106
|
+
## 🚀 Quick Start
|
|
107
|
+
|
|
108
|
+
### 1️⃣ Login and Simple Echo Bot
|
|
40
109
|
|
|
41
110
|
```javascript
|
|
42
111
|
const login = require("@dongdev/fca-unofficial");
|
|
@@ -53,7 +122,7 @@ login({ appState: [] }, (err, api) => {
|
|
|
53
122
|
});
|
|
54
123
|
```
|
|
55
124
|
|
|
56
|
-
### 2
|
|
125
|
+
### 2️⃣ Send Text Message
|
|
57
126
|
|
|
58
127
|
```javascript
|
|
59
128
|
const login = require("@dongdev/fca-unofficial");
|
|
@@ -64,19 +133,19 @@ login({ appState: [] }, (err, api) => {
|
|
|
64
133
|
return;
|
|
65
134
|
}
|
|
66
135
|
|
|
67
|
-
|
|
68
|
-
|
|
136
|
+
const yourID = "000000000000000"; // Replace with actual Facebook ID
|
|
137
|
+
const msg = "Hey! 👋";
|
|
69
138
|
|
|
70
139
|
api.sendMessage(msg, yourID, err => {
|
|
71
140
|
if (err) console.error("Message Sending Error:", err);
|
|
72
|
-
else console.log("Message sent successfully!");
|
|
141
|
+
else console.log("✅ Message sent successfully!");
|
|
73
142
|
});
|
|
74
143
|
});
|
|
75
144
|
```
|
|
76
145
|
|
|
77
|
-
|
|
146
|
+
> **💡 Tip:** To find your Facebook ID, look inside the cookies under the name `c_user`
|
|
78
147
|
|
|
79
|
-
### 3
|
|
148
|
+
### 3️⃣ Send File/Image
|
|
80
149
|
|
|
81
150
|
```javascript
|
|
82
151
|
const login = require("@dongdev/fca-unofficial");
|
|
@@ -88,43 +157,51 @@ login({ appState: [] }, (err, api) => {
|
|
|
88
157
|
return;
|
|
89
158
|
}
|
|
90
159
|
|
|
91
|
-
|
|
92
|
-
|
|
160
|
+
const yourID = "000000000000000";
|
|
161
|
+
const imagePath = __dirname + "/image.jpg";
|
|
93
162
|
|
|
94
163
|
// Check if file exists
|
|
95
164
|
if (!fs.existsSync(imagePath)) {
|
|
96
|
-
console.error("Error: Image file not found!");
|
|
165
|
+
console.error("❌ Error: Image file not found!");
|
|
97
166
|
return;
|
|
98
167
|
}
|
|
99
168
|
|
|
100
|
-
|
|
101
|
-
body: "
|
|
169
|
+
const msg = {
|
|
170
|
+
body: "Check out this image! 📷",
|
|
102
171
|
attachment: fs.createReadStream(imagePath)
|
|
103
172
|
};
|
|
104
173
|
|
|
105
174
|
api.sendMessage(msg, yourID, err => {
|
|
106
175
|
if (err) console.error("Message Sending Error:", err);
|
|
107
|
-
else console.log("
|
|
176
|
+
else console.log("✅ Image sent successfully!");
|
|
108
177
|
});
|
|
109
178
|
});
|
|
110
179
|
```
|
|
111
180
|
|
|
181
|
+
---
|
|
182
|
+
|
|
112
183
|
## 📝 Message Types
|
|
113
184
|
|
|
114
|
-
| Type
|
|
115
|
-
|
|
116
|
-
| **Regular text** | `{ body: "message text" }`
|
|
117
|
-
| **Sticker**
|
|
118
|
-
| **File/Image**
|
|
119
|
-
| **URL**
|
|
120
|
-
| **Large emoji**
|
|
185
|
+
| Type | Usage | Example |
|
|
186
|
+
|------|-------|---------|
|
|
187
|
+
| **Regular text** | `{ body: "message text" }` | `{ body: "Hello!" }` |
|
|
188
|
+
| **Sticker** | `{ sticker: "sticker_id" }` | `{ sticker: "369239263222822" }` |
|
|
189
|
+
| **File/Image** | `{ attachment: fs.createReadStream(path) }` | `{ attachment: fs.createReadStream("image.jpg") }` |
|
|
190
|
+
| **URL** | `{ url: "https://example.com" }` | `{ url: "https://github.com" }` |
|
|
191
|
+
| **Large emoji** | `{ emoji: "👍", emojiSize: "large" }` | `{ emoji: "👍", emojiSize: "large" }` |
|
|
192
|
+
|
|
193
|
+
> **📌 Note:** A message can only be a regular message (which can be empty) and optionally **one of the following**: a sticker, an attachment, or a URL.
|
|
121
194
|
|
|
122
|
-
**
|
|
195
|
+
**Emoji sizes:** `small` | `medium` | `large`
|
|
123
196
|
|
|
124
|
-
|
|
197
|
+
---
|
|
198
|
+
|
|
199
|
+
## 💾 AppState Management
|
|
125
200
|
|
|
126
201
|
### Save AppState
|
|
127
202
|
|
|
203
|
+
Save your login session to avoid re-authentication:
|
|
204
|
+
|
|
128
205
|
```javascript
|
|
129
206
|
const fs = require("fs");
|
|
130
207
|
const login = require("@dongdev/fca-unofficial");
|
|
@@ -142,13 +219,15 @@ login(credentials, (err, api) => {
|
|
|
142
219
|
fs.writeFileSync("appstate.json", appState);
|
|
143
220
|
console.log("✅ AppState saved successfully!");
|
|
144
221
|
} catch (error) {
|
|
145
|
-
console.error("Error saving AppState:", error);
|
|
222
|
+
console.error("❌ Error saving AppState:", error);
|
|
146
223
|
}
|
|
147
224
|
});
|
|
148
225
|
```
|
|
149
226
|
|
|
150
227
|
### Use Saved AppState
|
|
151
228
|
|
|
229
|
+
Load your saved AppState for faster login:
|
|
230
|
+
|
|
152
231
|
```javascript
|
|
153
232
|
const fs = require("fs");
|
|
154
233
|
const login = require("@dongdev/fca-unofficial");
|
|
@@ -167,7 +246,9 @@ login(
|
|
|
167
246
|
);
|
|
168
247
|
```
|
|
169
248
|
|
|
170
|
-
**Alternative:** Use [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) to get fbstate.json
|
|
249
|
+
**Alternative:** Use [c3c-fbstate](https://github.com/c3cbot/c3c-fbstate) to get `fbstate.json`
|
|
250
|
+
|
|
251
|
+
---
|
|
171
252
|
|
|
172
253
|
## 👂 Listening for Messages
|
|
173
254
|
|
|
@@ -203,15 +284,15 @@ login(
|
|
|
203
284
|
switch (event.type) {
|
|
204
285
|
case "message":
|
|
205
286
|
if (event.body && event.body.trim().toLowerCase() === "/stop") {
|
|
206
|
-
api.sendMessage("Goodbye…", event.threadID);
|
|
287
|
+
api.sendMessage("Goodbye… 👋", event.threadID);
|
|
207
288
|
stopListening();
|
|
208
289
|
return;
|
|
209
290
|
}
|
|
210
|
-
api.sendMessage(
|
|
291
|
+
api.sendMessage(`🤖 BOT: ${event.body}`, event.threadID);
|
|
211
292
|
break;
|
|
212
293
|
|
|
213
294
|
case "event":
|
|
214
|
-
console.log("Event Received:", event);
|
|
295
|
+
console.log("📢 Event Received:", event);
|
|
215
296
|
break;
|
|
216
297
|
}
|
|
217
298
|
});
|
|
@@ -221,6 +302,8 @@ login(
|
|
|
221
302
|
|
|
222
303
|
### Listen Options
|
|
223
304
|
|
|
305
|
+
Configure listening behavior:
|
|
306
|
+
|
|
224
307
|
```javascript
|
|
225
308
|
api.setOptions({
|
|
226
309
|
listenEvents: true, // Receive events (join/leave, rename, etc.)
|
|
@@ -229,97 +312,321 @@ api.setOptions({
|
|
|
229
312
|
});
|
|
230
313
|
```
|
|
231
314
|
|
|
232
|
-
**
|
|
315
|
+
**Default values:**
|
|
316
|
+
- `listenEvents`: `false` - won't receive events like joining/leaving chat, title changes
|
|
317
|
+
- `selfListen`: `false` - will ignore messages sent by the current account
|
|
318
|
+
- `logLevel`: `"info"` - default logging level
|
|
233
319
|
|
|
234
|
-
|
|
235
|
-
- `selfListen` is `false` - will ignore messages sent by the current account
|
|
320
|
+
---
|
|
236
321
|
|
|
237
|
-
##
|
|
322
|
+
## 🎯 API Quick Reference
|
|
238
323
|
|
|
239
|
-
|
|
240
|
-
- **[Miraiv2](https://github.com/miraiPr0ject/miraiv2)** - Simple Facebook Messenger Bot
|
|
241
|
-
- **[Messer](https://github.com/mjkaufer/Messer)** - Command-line messaging for Facebook Messenger
|
|
242
|
-
- **[messen](https://github.com/tomquirk/messen)** - Rapidly build Facebook Messenger apps in Node.js
|
|
243
|
-
- **[Concierge](https://github.com/concierge/Concierge)** - Highly modular chat bot with built-in package manager
|
|
244
|
-
- **[Marc Zuckerbot](https://github.com/bsansouci/marc-zuckerbot)** - Facebook chat bot
|
|
245
|
-
- **[Botyo](https://github.com/ivkos/botyo)** - Modular bot for group chat rooms
|
|
246
|
-
- **[matrix-puppet-facebook](https://github.com/matrix-hacks/matrix-puppet-facebook)** - Facebook bridge for Matrix
|
|
247
|
-
- **[Miscord](https://github.com/Bjornskjald/miscord)** - Easy-to-use Facebook bridge for Discord
|
|
248
|
-
- **[chat-bridge](https://github.com/rexx0520/chat-bridge)** - Messenger, Telegram and IRC chat bridge
|
|
249
|
-
- **[Botium](https://github.com/codeforequity-at/botium-core)** - The Selenium for Chatbots
|
|
250
|
-
- **[Messenger-CLI](https://github.com/AstroCB/Messenger-CLI)** - Command-line interface for Facebook Messenger
|
|
251
|
-
- **[BotCore](https://github.com/AstroCB/BotCore)** - Tools for writing and managing Facebook Messenger bots
|
|
324
|
+
### 📨 Messaging Methods
|
|
252
325
|
|
|
253
|
-
|
|
326
|
+
```javascript
|
|
327
|
+
// Send message
|
|
328
|
+
api.sendMessage(message, threadID, callback);
|
|
254
329
|
|
|
255
|
-
|
|
330
|
+
// Send typing indicator
|
|
331
|
+
api.sendTypingIndicator(threadID, callback);
|
|
256
332
|
|
|
257
|
-
|
|
333
|
+
// Get message
|
|
334
|
+
api.getMessage(threadID, limit, callback);
|
|
258
335
|
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
- Event types
|
|
262
|
-
- Error handling
|
|
263
|
-
- Advanced usage examples
|
|
336
|
+
// Edit message
|
|
337
|
+
api.editMessage(message, messageID, callback);
|
|
264
338
|
|
|
265
|
-
|
|
339
|
+
// Delete message
|
|
340
|
+
api.deleteMessage(messageID, callback);
|
|
266
341
|
|
|
267
|
-
|
|
342
|
+
// Unsend message
|
|
343
|
+
api.unsendMessage(messageID, callback);
|
|
268
344
|
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
api.sendMessage(message, threadID, callback);
|
|
345
|
+
// Set message reaction
|
|
346
|
+
api.setMessageReaction(reaction, messageID, callback);
|
|
272
347
|
|
|
273
|
-
//
|
|
274
|
-
api.
|
|
348
|
+
// Forward attachment
|
|
349
|
+
api.forwardAttachment(attachmentID, threadID, callback);
|
|
275
350
|
|
|
351
|
+
// Upload attachment
|
|
352
|
+
api.uploadAttachment(attachment, callback);
|
|
353
|
+
|
|
354
|
+
// Create poll
|
|
355
|
+
api.createPoll(question, options, threadID, callback);
|
|
356
|
+
|
|
357
|
+
// Create theme AI
|
|
358
|
+
api.createThemeAI(threadID, callback);
|
|
359
|
+
|
|
360
|
+
// Get theme pictures
|
|
361
|
+
api.getThemePictures(threadID, callback);
|
|
362
|
+
|
|
363
|
+
// Get emoji URL
|
|
364
|
+
api.getEmojiUrl(emoji, size, callback);
|
|
365
|
+
|
|
366
|
+
// Resolve photo URL
|
|
367
|
+
api.resolvePhotoUrl(photoID, callback);
|
|
368
|
+
```
|
|
369
|
+
|
|
370
|
+
### 📬 Read Receipt & Delivery
|
|
371
|
+
|
|
372
|
+
```javascript
|
|
276
373
|
// Mark as read
|
|
277
374
|
api.markAsRead(threadID, callback);
|
|
278
375
|
|
|
279
|
-
//
|
|
280
|
-
api.
|
|
376
|
+
// Mark as read all
|
|
377
|
+
api.markAsReadAll(callback);
|
|
378
|
+
|
|
379
|
+
// Mark as delivered
|
|
380
|
+
api.markAsDelivered(threadID, callback);
|
|
381
|
+
|
|
382
|
+
// Mark as seen
|
|
383
|
+
api.markAsSeen(threadID, callback);
|
|
384
|
+
```
|
|
281
385
|
|
|
386
|
+
### 👥 Thread Management
|
|
387
|
+
|
|
388
|
+
```javascript
|
|
282
389
|
// Get thread info
|
|
283
390
|
api.getThreadInfo(threadID, callback);
|
|
284
391
|
|
|
392
|
+
// Get thread list
|
|
393
|
+
api.getThreadList(limit, timestamp, callback);
|
|
394
|
+
|
|
395
|
+
// Get thread history
|
|
396
|
+
api.getThreadHistory(threadID, amount, timestamp, callback);
|
|
397
|
+
|
|
398
|
+
// Get thread pictures
|
|
399
|
+
api.getThreadPictures(threadID, limit, callback);
|
|
400
|
+
|
|
401
|
+
// Search for thread
|
|
402
|
+
api.searchForThread(name, callback);
|
|
403
|
+
|
|
404
|
+
// Delete thread
|
|
405
|
+
api.deleteThread(threadID, callback);
|
|
406
|
+
```
|
|
407
|
+
|
|
408
|
+
### 🎨 Thread Customization
|
|
409
|
+
|
|
410
|
+
```javascript
|
|
285
411
|
// Change thread color
|
|
286
412
|
api.changeThreadColor(color, threadID, callback);
|
|
287
413
|
|
|
288
414
|
// Change thread emoji
|
|
289
415
|
api.changeThreadEmoji(emoji, threadID, callback);
|
|
290
416
|
|
|
291
|
-
//
|
|
292
|
-
api.
|
|
417
|
+
// Change group image
|
|
418
|
+
api.changeGroupImage(image, threadID, callback);
|
|
419
|
+
|
|
420
|
+
// Set title
|
|
421
|
+
api.setTitle(title, threadID, callback);
|
|
422
|
+
|
|
423
|
+
// Change nickname
|
|
424
|
+
api.changeNickname(nickname, userID, threadID, callback);
|
|
293
425
|
```
|
|
294
426
|
|
|
427
|
+
### 👤 User Management
|
|
428
|
+
|
|
429
|
+
```javascript
|
|
430
|
+
// Get user info
|
|
431
|
+
api.getUserInfo(userID, callback);
|
|
432
|
+
|
|
433
|
+
// Get user info V2
|
|
434
|
+
api.getUserInfoV2(userID, callback);
|
|
435
|
+
|
|
436
|
+
// Get user ID
|
|
437
|
+
api.getUserID(username, callback);
|
|
438
|
+
|
|
439
|
+
// Get friends list
|
|
440
|
+
api.getFriendsList(callback);
|
|
441
|
+
|
|
442
|
+
// Get current user ID
|
|
443
|
+
api.getCurrentUserID(callback);
|
|
444
|
+
```
|
|
445
|
+
|
|
446
|
+
### 👥 Group Management
|
|
447
|
+
|
|
448
|
+
```javascript
|
|
449
|
+
// Create new group
|
|
450
|
+
api.createNewGroup(participantIDs, groupTitle, callback);
|
|
451
|
+
|
|
452
|
+
// Add user to group
|
|
453
|
+
api.addUserToGroup(userID, threadID, callback);
|
|
454
|
+
|
|
455
|
+
// Remove user from group
|
|
456
|
+
api.removeUserFromGroup(userID, threadID, callback);
|
|
457
|
+
|
|
458
|
+
// Change admin status
|
|
459
|
+
api.changeAdminStatus(userID, threadID, admin, callback);
|
|
460
|
+
```
|
|
461
|
+
|
|
462
|
+
### ⚙️ Thread Settings
|
|
463
|
+
|
|
464
|
+
```javascript
|
|
465
|
+
// Mute thread
|
|
466
|
+
api.muteThread(threadID, muteSeconds, callback);
|
|
467
|
+
|
|
468
|
+
// Change archived status
|
|
469
|
+
api.changeArchivedStatus(threadID, archived, callback);
|
|
470
|
+
|
|
471
|
+
// Change blocked status
|
|
472
|
+
api.changeBlockedStatus(userID, block, callback);
|
|
473
|
+
|
|
474
|
+
// Handle message request
|
|
475
|
+
api.handleMessageRequest(threadID, accept, callback);
|
|
476
|
+
```
|
|
477
|
+
|
|
478
|
+
### 🔗 Sharing & Contacts
|
|
479
|
+
|
|
480
|
+
```javascript
|
|
481
|
+
// Share contact
|
|
482
|
+
api.shareContact(contactID, threadID, callback);
|
|
483
|
+
```
|
|
484
|
+
|
|
485
|
+
### 🎭 User Actions
|
|
486
|
+
|
|
487
|
+
```javascript
|
|
488
|
+
// Change avatar
|
|
489
|
+
api.changeAvatar(image, callback);
|
|
490
|
+
|
|
491
|
+
// Change bio
|
|
492
|
+
api.changeBio(bio, callback);
|
|
493
|
+
|
|
494
|
+
// Handle friend request
|
|
495
|
+
api.handleFriendRequest(userID, accept, callback);
|
|
496
|
+
|
|
497
|
+
// Unfriend
|
|
498
|
+
api.unfriend(userID, callback);
|
|
499
|
+
|
|
500
|
+
// Set post reaction
|
|
501
|
+
api.setPostReaction(postID, reaction, callback);
|
|
502
|
+
|
|
503
|
+
// Refresh fb_dtsg
|
|
504
|
+
api.refreshFb_dtsg(callback);
|
|
505
|
+
```
|
|
506
|
+
|
|
507
|
+
### 🔐 Authentication
|
|
508
|
+
|
|
509
|
+
```javascript
|
|
510
|
+
// Logout
|
|
511
|
+
api.logout(callback);
|
|
512
|
+
|
|
513
|
+
// Get app state
|
|
514
|
+
api.getAppState();
|
|
515
|
+
|
|
516
|
+
// Set options
|
|
517
|
+
api.setOptions(options);
|
|
518
|
+
```
|
|
519
|
+
|
|
520
|
+
### 📡 Listening
|
|
521
|
+
|
|
522
|
+
```javascript
|
|
523
|
+
// Listen to MQTT events
|
|
524
|
+
api.listenMqtt(callback);
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
### Event Types
|
|
528
|
+
|
|
529
|
+
- `message` - New message received
|
|
530
|
+
- `event` - Thread events (join, leave, title change, etc.)
|
|
531
|
+
- `typ` - Typing indicator
|
|
532
|
+
- `read_receipt` - Read receipt
|
|
533
|
+
- `presence` - User presence (online/offline)
|
|
534
|
+
- `read` - Message read status
|
|
535
|
+
- `delivery_receipt` - Message delivery receipt
|
|
536
|
+
|
|
537
|
+
---
|
|
538
|
+
|
|
539
|
+
## 📚 Documentation
|
|
540
|
+
|
|
541
|
+
For detailed API documentation, see [DOCS.md](./DOCS.md)
|
|
542
|
+
|
|
543
|
+
**Includes:**
|
|
544
|
+
- 📖 All available API methods
|
|
545
|
+
- 🔧 Parameters and options
|
|
546
|
+
- 📨 Event types and structures
|
|
547
|
+
- ⚠️ Error handling
|
|
548
|
+
- 💡 Advanced usage examples
|
|
549
|
+
|
|
550
|
+
---
|
|
551
|
+
|
|
552
|
+
## 🛠️ Projects Using This API
|
|
553
|
+
|
|
554
|
+
Here are some awesome projects built with `@dongdev/fca-unofficial`:
|
|
555
|
+
|
|
556
|
+
| Project | Description |
|
|
557
|
+
|---------|-------------|
|
|
558
|
+
| **[c3c](https://github.com/lequanglam/c3c)** | Customizable bot with plugins, supports Facebook & Discord |
|
|
559
|
+
| **[Miraiv2](https://github.com/miraiPr0ject/miraiv2)** | Simple Facebook Messenger Bot |
|
|
560
|
+
| **[Messer](https://github.com/mjkaufer/Messer)** | Command-line messaging for Facebook Messenger |
|
|
561
|
+
| **[messen](https://github.com/tomquirk/messen)** | Rapidly build Facebook Messenger apps in Node.js |
|
|
562
|
+
| **[Concierge](https://github.com/concierge/Concierge)** | Highly modular chat bot with built-in package manager |
|
|
563
|
+
| **[Marc Zuckerbot](https://github.com/bsansouci/marc-zuckerbot)** | Facebook chat bot |
|
|
564
|
+
| **[Botyo](https://github.com/ivkos/botyo)** | Modular bot for group chat rooms |
|
|
565
|
+
| **[matrix-puppet-facebook](https://github.com/matrix-hacks/matrix-puppet-facebook)** | Facebook bridge for Matrix |
|
|
566
|
+
| **[Miscord](https://github.com/Bjornskjald/miscord)** | Easy-to-use Facebook bridge for Discord |
|
|
567
|
+
| **[chat-bridge](https://github.com/rexx0520/chat-bridge)** | Messenger, Telegram and IRC chat bridge |
|
|
568
|
+
| **[Botium](https://github.com/codeforequity-at/botium-core)** | The Selenium for Chatbots |
|
|
569
|
+
| **[Messenger-CLI](https://github.com/AstroCB/Messenger-CLI)** | Command-line interface for Facebook Messenger |
|
|
570
|
+
| **[BotCore](https://github.com/AstroCB/BotCore)** | Tools for writing and managing Facebook Messenger bots |
|
|
571
|
+
|
|
572
|
+
[See more projects...](https://github.com/Donix-VN/fca-unofficial#projects-using-this-api)
|
|
573
|
+
|
|
574
|
+
---
|
|
575
|
+
|
|
295
576
|
## 🤝 Contributing
|
|
296
577
|
|
|
297
|
-
Contributions are welcome!
|
|
578
|
+
Contributions are welcome! We love your input 💙
|
|
298
579
|
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
580
|
+
**How to contribute:**
|
|
581
|
+
|
|
582
|
+
1. 🍴 Fork the repository
|
|
583
|
+
2. 🌿 Create a new branch (`git checkout -b feature/AmazingFeature`)
|
|
584
|
+
3. 💾 Commit your changes (`git commit -m 'Add some AmazingFeature'`)
|
|
585
|
+
4. 📤 Push to the branch (`git push origin feature/AmazingFeature`)
|
|
586
|
+
5. 🔄 Open a Pull Request
|
|
587
|
+
|
|
588
|
+
**Guidelines:**
|
|
589
|
+
- Follow the existing code style
|
|
590
|
+
- Add tests for new features
|
|
591
|
+
- Update documentation as needed
|
|
592
|
+
- Be respectful and constructive
|
|
593
|
+
|
|
594
|
+
---
|
|
304
595
|
|
|
305
596
|
## 📄 License
|
|
306
597
|
|
|
307
|
-
MIT License -
|
|
598
|
+
This project is licensed under the **MIT License** - see the [LICENSE-MIT](./LICENSE-MIT) file for details.
|
|
308
599
|
|
|
309
|
-
|
|
600
|
+
---
|
|
310
601
|
|
|
311
|
-
|
|
602
|
+
## 👨💻 Author & Support
|
|
312
603
|
|
|
313
|
-
|
|
604
|
+
<div align="center">
|
|
314
605
|
|
|
315
|
-
|
|
606
|
+
**Made with ❤️ by DongDev**
|
|
607
|
+
|
|
608
|
+
[](https://www.facebook.com/mdong.dev)
|
|
609
|
+
[](https://github.com/Donix-VN)
|
|
610
|
+
|
|
611
|
+
</div>
|
|
316
612
|
|
|
317
|
-
|
|
613
|
+
### 🔗 Links
|
|
318
614
|
|
|
319
|
-
- [NPM Package](https://www.npmjs.com/package/@dongdev/fca-unofficial)
|
|
320
|
-
- [GitHub Repository](https://github.com/Donix-VN/fca-unofficial)
|
|
321
|
-
- [Issue Tracker](https://github.com/Donix-VN/fca-unofficial/issues)
|
|
615
|
+
- 📦 [NPM Package](https://www.npmjs.com/package/@dongdev/fca-unofficial)
|
|
616
|
+
- 🐙 [GitHub Repository](https://github.com/Donix-VN/fca-unofficial)
|
|
617
|
+
- 🐛 [Issue Tracker](https://github.com/Donix-VN/fca-unofficial/issues)
|
|
618
|
+
- 📖 [Documentation](./DOCS.md)
|
|
619
|
+
|
|
620
|
+
### ⭐ Support
|
|
621
|
+
|
|
622
|
+
If this project is helpful, please give it a ⭐ on GitHub!
|
|
322
623
|
|
|
323
624
|
---
|
|
324
625
|
|
|
325
|
-
|
|
626
|
+
<div align="center">
|
|
627
|
+
|
|
628
|
+
**⚠️ Disclaimer:** This is an unofficial API and is not officially supported by Facebook. Use responsibly and comply with [Facebook Terms of Service](https://www.facebook.com/terms.php).
|
|
629
|
+
|
|
630
|
+
Made with ❤️ for the developer community
|
|
631
|
+
|
|
632
|
+
</div>
|
package/func/checkUpdate.js
CHANGED