nexus-fca 1.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 +1 -0
- package/DOCS.md +2047 -0
- package/Fca_Database/database.sqlite +0 -0
- package/LICENSE-MIT +21 -0
- package/README.md +240 -0
- package/docs/README.md +9 -0
- package/docs/addExternalModule.md +15 -0
- package/docs/addUserToGroup.md +20 -0
- package/docs/changeAdminStatus.md +21 -0
- package/docs/changeArchivedStatus.md +19 -0
- package/docs/changeAvatar.md +21 -0
- package/docs/changeAvatarV2.md +18 -0
- package/docs/changeBio.md +15 -0
- package/docs/changeBlockedStatus.md +16 -0
- package/docs/changeBlockedStatusMqtt.md +16 -0
- package/docs/changeCover.md +15 -0
- package/docs/changeGroupImage.md +16 -0
- package/docs/changeName.md +18 -0
- package/docs/changeNickname.md +17 -0
- package/docs/changeThreadColor.md +16 -0
- package/docs/changeThreadEmoji.md +16 -0
- package/docs/changeUsername.md +15 -0
- package/docs/createCommentPost.md +16 -0
- package/docs/createNewGroup.md +16 -0
- package/docs/createPoll.md +17 -0
- package/docs/createPost.md +15 -0
- package/docs/deleteMessage.md +15 -0
- package/docs/deleteThread.md +15 -0
- package/docs/editMessage.md +16 -0
- package/docs/follow.md +15 -0
- package/docs/forwardAttachment.md +16 -0
- package/docs/getAccess.md +17 -0
- package/docs/getAvatarUser.md +15 -0
- package/docs/getBotInitialData.md +14 -0
- package/docs/getCtx.md +14 -0
- package/docs/getCurrentUserID.md +12 -0
- package/docs/getEmojiUrl.md +17 -0
- package/docs/getFriendsList.md +14 -0
- package/docs/getMessage.md +15 -0
- package/docs/getOptions.md +14 -0
- package/docs/getRegion.md +14 -0
- package/docs/getThreadHistory.md +17 -0
- package/docs/getThreadHistoryDeprecated.md +17 -0
- package/docs/getThreadInfo.md +15 -0
- package/docs/getThreadInfoDeprecated.md +17 -0
- package/docs/getThreadList.md +17 -0
- package/docs/getThreadListDeprecated.md +17 -0
- package/docs/getThreadPictures.md +17 -0
- package/docs/getUID.md +15 -0
- package/docs/getUserID.md +15 -0
- package/docs/getUserInfo.md +15 -0
- package/docs/handleFriendRequest.md +16 -0
- package/docs/handleMessageRequest.md +16 -0
- package/docs/httpGet.md +15 -0
- package/docs/httpPost.md +16 -0
- package/docs/httpPostFormData.md +16 -0
- package/docs/listenMqtt.md +17 -0
- package/docs/listenNotification.md +14 -0
- package/docs/logout.md +14 -0
- package/docs/markAsDelivered.md +16 -0
- package/docs/markAsRead.md +16 -0
- package/docs/markAsReadAll.md +14 -0
- package/docs/markAsSeen.md +15 -0
- package/docs/muteThread.md +16 -0
- package/docs/pinMessage.md +17 -0
- package/docs/postFormData.md +16 -0
- package/docs/refreshFb_dtsg.md +14 -0
- package/docs/removeUserFromGroup.md +16 -0
- package/docs/resolvePhotoUrl.md +15 -0
- package/docs/searchForThread.md +15 -0
- package/docs/searchStickers.md +15 -0
- package/docs/sendComment.md +16 -0
- package/docs/sendMessage.md +16 -0
- package/docs/sendMessageMqtt.md +16 -0
- package/docs/sendTypingIndicator.md +15 -0
- package/docs/setMessageReaction.md +17 -0
- package/docs/setMessageReactionMqtt.md +16 -0
- package/docs/setPostReaction.md +16 -0
- package/docs/setProfileGuard.md +15 -0
- package/docs/setStoryReaction.md +16 -0
- package/docs/setTitle.md +16 -0
- package/docs/shareContact.md +16 -0
- package/docs/shareLink.md +16 -0
- package/docs/stopListenMqtt.md +8 -0
- package/docs/threadColors.md +11 -0
- package/docs/unfriend.md +15 -0
- package/docs/unsendMessage.md +15 -0
- package/docs/uploadAttachment.md +15 -0
- package/fca-config.json +7 -0
- package/index.d.ts +618 -0
- package/index.js +361 -0
- package/lib/database/models/index.js +47 -0
- package/lib/database/models/thread.js +31 -0
- package/lib/database/threadData.js +93 -0
- package/lib/logger.js +24 -0
- package/lib/login.js +0 -0
- package/package.json +90 -0
- package/src/addExternalModule.js +19 -0
- package/src/addUserToGroup.js +113 -0
- package/src/changeAdminStatus.js +79 -0
- package/src/changeArchivedStatus.js +55 -0
- package/src/changeAvatar.js +126 -0
- package/src/changeAvatarV2.js +77 -0
- package/src/changeBio.js +77 -0
- package/src/changeBlockedStatus.js +47 -0
- package/src/changeBlockedStatusMqtt.js +71 -0
- package/src/changeCover.js +72 -0
- package/src/changeGroupImage.js +132 -0
- package/src/changeName.js +79 -0
- package/src/changeNickname.js +59 -0
- package/src/changeThreadColor.js +65 -0
- package/src/changeThreadEmoji.js +55 -0
- package/src/changeUsername.js +58 -0
- package/src/createCommentPost.js +225 -0
- package/src/createNewGroup.js +86 -0
- package/src/createPoll.js +71 -0
- package/src/createPost.js +276 -0
- package/src/deleteMessage.js +56 -0
- package/src/deleteThread.js +56 -0
- package/src/editMessage.js +57 -0
- package/src/follow.js +54 -0
- package/src/forwardAttachment.js +60 -0
- package/src/getAccess.js +67 -0
- package/src/getAvatarUser.js +56 -0
- package/src/getBotInitialData.js +37 -0
- package/src/getCtx.js +6 -0
- package/src/getCurrentUserID.js +7 -0
- package/src/getEmojiUrl.js +29 -0
- package/src/getFriendsList.js +83 -0
- package/src/getMessage.js +796 -0
- package/src/getOptions.js +6 -0
- package/src/getRegion.js +8 -0
- package/src/getThreadHistory.js +666 -0
- package/src/getThreadHistoryDeprecated.js +55 -0
- package/src/getThreadInfo.js +535 -0
- package/src/getThreadInfoDeprecated.js +49 -0
- package/src/getThreadList.js +192 -0
- package/src/getThreadListDeprecated.js +54 -0
- package/src/getThreadPictures.js +79 -0
- package/src/getUID.js +67 -0
- package/src/getUserID.js +66 -0
- package/src/getUserInfo.js +80 -0
- package/src/handleFriendRequest.js +61 -0
- package/src/handleMessageRequest.js +65 -0
- package/src/httpGet.js +57 -0
- package/src/httpPost.js +57 -0
- package/src/httpPostFormData.js +63 -0
- package/src/listenMqtt.js +1039 -0
- package/src/listenNotification.js +65 -0
- package/src/logout.js +75 -0
- package/src/markAsDelivered.js +58 -0
- package/src/markAsRead.js +80 -0
- package/src/markAsReadAll.js +50 -0
- package/src/markAsSeen.js +59 -0
- package/src/muteThread.js +52 -0
- package/src/pinMessage.js +59 -0
- package/src/postFormData.js +46 -0
- package/src/refreshFb_dtsg.js +66 -0
- package/src/removeUserFromGroup.js +79 -0
- package/src/resolvePhotoUrl.js +45 -0
- package/src/searchForThread.js +53 -0
- package/src/searchStickers.js +51 -0
- package/src/sendComment.js +63 -0
- package/src/sendMessage.js +328 -0
- package/src/sendMessageMqtt.js +316 -0
- package/src/sendTypingIndicator.js +103 -0
- package/src/setMessageReaction.js +119 -0
- package/src/setMessageReactionMqtt.js +61 -0
- package/src/setPostReaction.js +109 -0
- package/src/setProfileGuard.js +45 -0
- package/src/setStoryReaction.js +62 -0
- package/src/setTitle.js +86 -0
- package/src/shareContact.js +49 -0
- package/src/shareLink.js +59 -0
- package/src/stopListenMqtt.js +21 -0
- package/src/threadColors.js +131 -0
- package/src/unfriend.js +52 -0
- package/src/unsendMessage.js +49 -0
- package/src/uploadAttachment.js +95 -0
- package/utils.js +1432 -0
|
Binary file
|
package/LICENSE-MIT
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025 Nexus-016
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
|
13
|
+
all copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
21
|
+
THE SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,240 @@
|
|
|
1
|
+
<div align="center">
|
|
2
|
+
|
|
3
|
+
<img src="https://i.ibb.co/LzkQMGWz/Future-Studio-Synthwave-Logo-Future-Studio-Synthwave-Logo.png" alt="Nexus-FCA Logo" width="500"/>
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
<h2 align="center"><b>Nexus-FCA: Advanced Facebook Chat API</b></h2>
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
Nexus-FCA is a modern, safe, and advanced Facebook Chat API for Node.js. It is designed for developers who want a reliable, easy-to-use, and actively maintained solution for Messenger automation, bots, and integrations.
|
|
11
|
+
|
|
12
|
+
---
|
|
13
|
+
|
|
14
|
+
## Key Features
|
|
15
|
+
|
|
16
|
+
- **Modern & Safe:**
|
|
17
|
+
- Built with ES6+ features and TypeScript. No legacy code.
|
|
18
|
+
- **Active Development:**
|
|
19
|
+
- Regular updates and improvements. Open to contributions.
|
|
20
|
+
- **Easy to Use:**
|
|
21
|
+
- Simple API with clear documentation. Get started quickly.
|
|
22
|
+
- **No External Dependencies:**
|
|
23
|
+
- No need for external libraries. Everything is included.
|
|
24
|
+
- **No WebView/Browser Required:**
|
|
25
|
+
- Directly interacts with Facebook's Messenger API. No browser automation.
|
|
26
|
+
- **No CAPTCHA/Verification:**
|
|
27
|
+
- Bypass CAPTCHA and verification challenges. Use at your own risk.
|
|
28
|
+
- **No Rate Limits:**
|
|
29
|
+
- No restrictions on message sending. Use responsibly.
|
|
30
|
+
- **No Account Verification:**
|
|
31
|
+
- No need to verify your account. Use with caution.
|
|
32
|
+
- **All Major Messenger Features:**
|
|
33
|
+
- Messaging, reactions, group management, user info, and more.
|
|
34
|
+
- **Safe & Testable:**
|
|
35
|
+
- No legacy/unsafe code. Test every feature live in Messenger.
|
|
36
|
+
- **Admin & Safety Tools:**
|
|
37
|
+
- Rate limiting, allow/block lists, Safe Mode.
|
|
38
|
+
- **Easy Login:**
|
|
39
|
+
- Use `appstate.json` for secure, passwordless login.
|
|
40
|
+
- **Full Documentation:**
|
|
41
|
+
- Every feature documented in the `docs/` folder with real usage examples.
|
|
42
|
+
|
|
43
|
+
---
|
|
44
|
+
|
|
45
|
+
_Disclaimer_: Use responsibly. Nexus-FCA is not affiliated with Facebook. Your account may be at risk if you use this for spam or automation against Facebook's terms.
|
|
46
|
+
|
|
47
|
+
---
|
|
48
|
+
|
|
49
|
+
## Install
|
|
50
|
+
|
|
51
|
+
```bash
|
|
52
|
+
npm install nexus-fca
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Example Usage
|
|
56
|
+
|
|
57
|
+
```js
|
|
58
|
+
const login = require("nexus-fca");
|
|
59
|
+
|
|
60
|
+
login({ appState: [] }, (err, api) => {
|
|
61
|
+
if (err) return console.error(err);
|
|
62
|
+
|
|
63
|
+
api.listenMqtt((err, event) => {
|
|
64
|
+
if (err) return console.error(err);
|
|
65
|
+
api.sendMessage(event.body, event.threadID);
|
|
66
|
+
});
|
|
67
|
+
});
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Result:
|
|
71
|
+
|
|
72
|
+
<img width="517" alt="screen shot 2016-11-04 at 14 36 00" src="https://cloud.githubusercontent.com/assets/4534692/20023545/f8c24130-a29d-11e6-9ef7-47568bdbc1f2.png">
|
|
73
|
+
|
|
74
|
+
## Main Functionality
|
|
75
|
+
|
|
76
|
+
### Sending a message
|
|
77
|
+
|
|
78
|
+
#### api.sendMessage(message, threadID[, callback][, messageID])
|
|
79
|
+
|
|
80
|
+
Various types of message can be sent:
|
|
81
|
+
|
|
82
|
+
* *Regular:* set field `body` to the desired message as a string.
|
|
83
|
+
* *Sticker:* set a field `sticker` to the desired sticker ID.
|
|
84
|
+
* *File or image:* Set field `attachment` to a readable stream or an array of readable streams.
|
|
85
|
+
* *URL:* set a field `url` to the desired URL.
|
|
86
|
+
* *Emoji:* set field `emoji` to the desired emoji as a string and set field `emojiSize` with size of the emoji (`small`, `medium`, `large`)
|
|
87
|
+
|
|
88
|
+
Note that 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.
|
|
89
|
+
|
|
90
|
+
__Tip__: to find your own ID, you can look inside the cookies. The `userID` is under the name `c_user`.
|
|
91
|
+
|
|
92
|
+
__Example (Basic Message)__
|
|
93
|
+
|
|
94
|
+
```js
|
|
95
|
+
const login = require("nexus-fca");
|
|
96
|
+
|
|
97
|
+
login({ appState: [] }, (err, api) => {
|
|
98
|
+
if (err) {
|
|
99
|
+
console.error("Login Error:", err);
|
|
100
|
+
return;
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
let yourID = "000000000000000"; // Replace with actual Facebook ID
|
|
104
|
+
let msg = "Hey!";
|
|
105
|
+
|
|
106
|
+
api.sendMessage(msg, yourID, (err) => {
|
|
107
|
+
if (err) console.error("Message Sending Error:", err);
|
|
108
|
+
else console.log("Message sent successfully!");
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
|
|
112
|
+
```
|
|
113
|
+
|
|
114
|
+
__Example (File upload)__
|
|
115
|
+
|
|
116
|
+
```js
|
|
117
|
+
const login = require("nexus-fca");
|
|
118
|
+
const fs = require("fs"); // ✅ Required the fs module
|
|
119
|
+
|
|
120
|
+
login({ appState: [] }, (err, api) => {
|
|
121
|
+
if (err) {
|
|
122
|
+
console.error("Login Error:", err);
|
|
123
|
+
return;
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
let yourID = "000000000000000"; // Replace with actual Facebook ID
|
|
127
|
+
let imagePath = __dirname + "/image.jpg";
|
|
128
|
+
|
|
129
|
+
// Check if the file exists before sending
|
|
130
|
+
if (!fs.existsSync(imagePath)) {
|
|
131
|
+
console.error("Error: Image file not found!");
|
|
132
|
+
return;
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
let msg = {
|
|
136
|
+
body: "Hey!",
|
|
137
|
+
attachment: fs.createReadStream(imagePath)
|
|
138
|
+
};
|
|
139
|
+
|
|
140
|
+
api.sendMessage(msg, yourID, (err) => {
|
|
141
|
+
if (err) console.error("Message Sending Error:", err);
|
|
142
|
+
else console.log("Message sent successfully!");
|
|
143
|
+
});
|
|
144
|
+
});
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
### Saving session.
|
|
151
|
+
|
|
152
|
+
To avoid logging in every time you should save AppState (cookies etc.) to a file, then you can use it without having password in your scripts.
|
|
153
|
+
|
|
154
|
+
__Example__
|
|
155
|
+
|
|
156
|
+
```js
|
|
157
|
+
const fs = require("fs");
|
|
158
|
+
const login = require("nexus-fca");
|
|
159
|
+
|
|
160
|
+
const credentials = { appState: [] };
|
|
161
|
+
|
|
162
|
+
login(credentials, (err, api) => {
|
|
163
|
+
if (err) {
|
|
164
|
+
console.error("Login Error:", err);
|
|
165
|
+
return;
|
|
166
|
+
}
|
|
167
|
+
|
|
168
|
+
try {
|
|
169
|
+
const appState = JSON.stringify(api.getAppState(), null, 2); // Pretty print for readability
|
|
170
|
+
fs.writeFileSync("appstate.json", appState);
|
|
171
|
+
console.log("✅ AppState saved successfully!");
|
|
172
|
+
} catch (error) {
|
|
173
|
+
console.error("Error saving AppState:", error);
|
|
174
|
+
}
|
|
175
|
+
});
|
|
176
|
+
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
### Listening to a chat
|
|
182
|
+
|
|
183
|
+
#### api.listenMqtt(callback)
|
|
184
|
+
|
|
185
|
+
Listen watches for messages sent in a chat. By default this won't receive events (joining/leaving a chat, title change etc…) but it can be activated with `api.setOptions({listenEvents: true})`. This will by default ignore messages sent by the current account, you can enable listening to your own messages with `api.setOptions({selfListen: true})`.
|
|
186
|
+
|
|
187
|
+
__Example__
|
|
188
|
+
|
|
189
|
+
```js
|
|
190
|
+
const fs = require("fs");
|
|
191
|
+
const login = require("nexus-fca");
|
|
192
|
+
|
|
193
|
+
// Simple echo bot: Repeats everything you say. Stops when you say "/stop".
|
|
194
|
+
login({ appState: JSON.parse(fs.readFileSync("appstate.json", "utf8")) }, (err, api) => {
|
|
195
|
+
if (err) {
|
|
196
|
+
console.error("Login Error:", err);
|
|
197
|
+
return;
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
api.setOptions({ listenEvents: true });
|
|
201
|
+
|
|
202
|
+
const stopListening = api.listenMqtt((err, event) => {
|
|
203
|
+
if (err) {
|
|
204
|
+
console.error("Listen Error:", err);
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
// Mark message as read
|
|
209
|
+
api.markAsRead(event.threadID, (err) => {
|
|
210
|
+
if (err) console.error("Mark as read error:", err);
|
|
211
|
+
});
|
|
212
|
+
|
|
213
|
+
// Handle different event types
|
|
214
|
+
switch (event.type) {
|
|
215
|
+
case "message":
|
|
216
|
+
if (event.body && event.body.trim().toLowerCase() === "/stop") {
|
|
217
|
+
api.sendMessage("Goodbye…", event.threadID);
|
|
218
|
+
stopListening();
|
|
219
|
+
return;
|
|
220
|
+
}
|
|
221
|
+
api.sendMessage(`TEST BOT: ${event.body}`, event.threadID);
|
|
222
|
+
break;
|
|
223
|
+
|
|
224
|
+
case "event":
|
|
225
|
+
console.log("Event Received:", event);
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
});
|
|
229
|
+
});
|
|
230
|
+
|
|
231
|
+
```
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## Advanced Safety & Admin Features
|
|
236
|
+
|
|
237
|
+
- **Global Rate Limiting:** Prevents spam and abuse for all sensitive actions (e.g., avatar change, messaging).
|
|
238
|
+
- **Safe Mode:** Set `NEXUS_FCA_SAFE_MODE=1` in your environment to disable risky features (like avatar/group changes) for extra protection.
|
|
239
|
+
- **Allow/Block List:** Control who can use the API with `NEXUS_FCA_ALLOW_LIST` and `NEXUS_FCA_BLOCK_LIST` (comma-separated user IDs).
|
|
240
|
+
- **Health Check:** Use `api.healthCheck((err, status) => { ... })` to verify the bot is running and see current safety status.
|
package/docs/README.md
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
# Nexus-FCA Documentation Folder
|
|
2
|
+
|
|
3
|
+
This folder contains individual documentation files for each advanced and core feature of Nexus-FCA. For a full overview, see the main `DOCS.md` or browse the files here for per-feature usage, arguments, and safety notes.
|
|
4
|
+
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
- Each `.md` file in this folder documents a single feature/module.
|
|
8
|
+
- You can add your own notes or examples to any file.
|
|
9
|
+
- For the latest and most complete API reference, always check the main `DOCS.md`.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# addExternalModule
|
|
2
|
+
|
|
3
|
+
Dynamically add an external module to Nexus-FCA (advanced).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.addExternalModule('path/to/module.js', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Module added!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `modulePath`: Path to the external module (string).
|
|
15
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
# addUserToGroup
|
|
2
|
+
|
|
3
|
+
Add a user or users to a group chat.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.addUserToGroup(userID, threadID, (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('User(s) added to group!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `userID`: User ID or array of user IDs.
|
|
15
|
+
- `threadID`: Group chat ID (string or number).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
- `userID` can be a single ID or an array of IDs.
|
|
20
|
+
- Throws an error if `threadID` is not a string or number.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# changeAdminStatus
|
|
2
|
+
|
|
3
|
+
Set or remove admin status for users in a group chat.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeAdminStatus(threadID, adminIDs, adminStatus, (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Admin status changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `threadID`: Group chat ID (string).
|
|
15
|
+
- `adminIDs`: User ID or array of user IDs to promote/demote.
|
|
16
|
+
- `adminStatus`: Boolean (`true` to promote, `false` to demote).
|
|
17
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
18
|
+
|
|
19
|
+
## Notes
|
|
20
|
+
- Throws if arguments are not the correct type.
|
|
21
|
+
- `adminIDs` can be a string or array.
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
# changeArchivedStatus
|
|
2
|
+
|
|
3
|
+
Archive or unarchive one or more threads.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeArchivedStatus(threadOrThreads, archive, (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Archive status changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `threadOrThreads`: Thread ID or array of thread IDs.
|
|
15
|
+
- `archive`: Boolean (`true` to archive, `false` to unarchive).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
17
|
+
|
|
18
|
+
## Notes
|
|
19
|
+
- Accepts a single thread ID or an array.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
# changeAvatar
|
|
2
|
+
|
|
3
|
+
Change your Facebook profile avatar (profile picture).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeAvatar(fs.createReadStream('./avatar.jpg'), 'My new avatar!', null, (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Avatar changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `image`: File stream of the image.
|
|
15
|
+
- `caption`: (Optional) Caption for the image (string).
|
|
16
|
+
- `timestamp`: (Optional) Timestamp for the change (null for now).
|
|
17
|
+
- `callback(err, res)`: Callback with error or result.
|
|
18
|
+
|
|
19
|
+
## Notes
|
|
20
|
+
- Use a readable stream for the image file.
|
|
21
|
+
- You can add a caption or leave it blank.
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# changeAvatarV2
|
|
2
|
+
|
|
3
|
+
Change your Facebook profile avatar using a local image file.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeAvatarV2('./avatar.jpg', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Avatar changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `imagePath`: Path to the image file (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
16
|
+
|
|
17
|
+
## Safety Note
|
|
18
|
+
Use images that comply with Facebook's community standards.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# changeBio
|
|
2
|
+
|
|
3
|
+
Change your Facebook profile bio.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeBio('This is my new bio!', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Bio changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `bio`: New bio text (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# changeBlockedStatus
|
|
2
|
+
|
|
3
|
+
Block or unblock a user (basic method).
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeBlockedStatus('1000123456789', true, (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('User blocked!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `userID`: The user ID (string).
|
|
15
|
+
- `block`: Boolean to block (true) or unblock (false).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# changeBlockedStatusMqtt
|
|
2
|
+
|
|
3
|
+
Block or unblock a user using the MQTT protocol.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeBlockedStatusMqtt('1000123456789', true, (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('User blocked!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `userID`: The user ID (string).
|
|
15
|
+
- `block`: Boolean to block (true) or unblock (false).
|
|
16
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# changeCover
|
|
2
|
+
|
|
3
|
+
Change your Facebook cover photo.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeCover('./cover.jpg', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Cover photo changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `imagePath`: Path to the image file (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# changeGroupImage
|
|
2
|
+
|
|
3
|
+
Change the group chat's image.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeGroupImage(fs.createReadStream('./group.jpg'), '1234567890', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Group image changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `image`: File stream of the image.
|
|
15
|
+
- `threadID`: Group chat ID (string).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
# changeName
|
|
2
|
+
|
|
3
|
+
Change your Facebook profile name.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeName('New Name', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Name changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `newName`: New name (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
16
|
+
|
|
17
|
+
## Safety Note
|
|
18
|
+
Changing your name too frequently may result in Facebook restrictions.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# changeNickname
|
|
2
|
+
|
|
3
|
+
Change a user's nickname in a thread.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeNickname('Cool Guy', '1234567890', '1000123456789', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Nickname changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `nickname`: New nickname (string).
|
|
15
|
+
- `threadID`: Thread ID (string).
|
|
16
|
+
- `participantID`: User ID (string).
|
|
17
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# changeThreadColor
|
|
2
|
+
|
|
3
|
+
Change the thread color.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeThreadColor('#0000ff', '1234567890', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Thread color changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `color`: Color hex string (e.g. '#0000ff').
|
|
15
|
+
- `threadID`: Thread ID (string).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# changeThreadEmoji
|
|
2
|
+
|
|
3
|
+
Change the thread emoji.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeThreadEmoji('😎', '1234567890', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Thread emoji changed!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `emoji`: Emoji character (string).
|
|
15
|
+
- `threadID`: Thread ID (string).
|
|
16
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# changeUsername
|
|
2
|
+
|
|
3
|
+
Change your Facebook username.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.changeUsername('newusername', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Username changed!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `username`: New username (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# createCommentPost
|
|
2
|
+
|
|
3
|
+
Comment on a Facebook post.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.createCommentPost('1234567890', 'Nice post!', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Comment posted!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `postID`: The post ID (string).
|
|
15
|
+
- `comment`: Comment text (string).
|
|
16
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# createNewGroup
|
|
2
|
+
|
|
3
|
+
Create a new group chat.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.createNewGroup(['10001','10002'], 'My Group', (err, threadID) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Group created! ID:', threadID);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `participantIDs`: Array of user IDs.
|
|
15
|
+
- `groupTitle`: (Optional) Group name (string).
|
|
16
|
+
- `callback(err, threadID)`: Callback with error or new thread ID.
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
# createPoll
|
|
2
|
+
|
|
3
|
+
Create a poll in a thread.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.createPoll('Favorite color?', '1234567890', { Red: false, Blue: true }, (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Poll created!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `title`: Poll title (string).
|
|
15
|
+
- `threadID`: Thread ID (string).
|
|
16
|
+
- `options`: Object of poll options (e.g. `{ Red: false, Blue: true }`).
|
|
17
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# createPost
|
|
2
|
+
|
|
3
|
+
Create a new Facebook post.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.createPost('Hello, world!', (err, res) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Post created!', res);
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `content`: Post content (string).
|
|
15
|
+
- `callback(err, res)`: Callback with error or result.
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# deleteMessage
|
|
2
|
+
|
|
3
|
+
Delete one or more messages by ID.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.deleteMessage('mid.$cAA...', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Message deleted!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `messageOrMessages`: Message ID or array of message IDs.
|
|
15
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
# deleteThread
|
|
2
|
+
|
|
3
|
+
Delete one or more threads by ID.
|
|
4
|
+
|
|
5
|
+
## Usage
|
|
6
|
+
```js
|
|
7
|
+
api.deleteThread('1234567890', (err) => {
|
|
8
|
+
if (err) return console.error(err);
|
|
9
|
+
console.log('Thread deleted!');
|
|
10
|
+
});
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
## Arguments
|
|
14
|
+
- `threadOrThreads`: Thread ID or array of thread IDs.
|
|
15
|
+
- `callback(err)`: Callback called when the operation is done (error or null).
|