{"_id":"toru-ultimate","name":"toru-ultimate","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"toru-ultimate","version":"1.0.0","description":"Facebook Chat API by HR ID OY | Stable • Auto Re-login • Full E2EE Support — send messages, media, reactions & more in encrypted chats, hassle-free","main":"index.js","types":"index.d.ts","exports":{".":{"require":"./index.js","default":"./index.js","types":"./index.d.ts"}},"scripts":{"test":"mocha","lint":"eslint ."},"repository":{"type":"git","url":"git+https://github.com/HR-ID-OY/toru-ultimate.git"},"keywords":["facebook","chat","api","messenger","bot","unofficial","fca","toru-ultimate","hr-id-oy"],"author":{"name":"HR ID OY","url":"https://github.com/HR-ID-OY"},"contributors":[{"name":"HR ID OY","url":"https://github.com/HR-ID-OY"},{"name":"DongDev","url":"Original"}],"license":"MIT","bugs":{"url":"https://github.com/HR-ID-OY/toru-ultimate/issues"},"homepage":"https://github.com/HR-ID-OY/toru-ultimate#readme","engines":{"node":">=12.0.0"},"dependencies":{"axios":"^1.13.5","axios-cookiejar-support":"^5.0.5","bluebird":"^3.7.2","chalk":"^4.1.2","cheerio":"1.0.0-rc.12","duplexify":"^4.1.3","gradient-string":"^2.0.2","https-proxy-agent":"^4.0.0","mqtt":"^5.10.1","sequelize":"^6.37.6","sqlite3":"^5.1.7","totp-generator":"^1.0.0","ws":"^8.18.0","@noble/curves":"^2.2.0","@noble/hashes":"^2.2.0","@signalapp/libsignal-client":"0.70.0","mime":"^3.0.0","protobufjs":"^8.4.0","koffi":"^3.0.2","yumi-json-bigint":"^1.0.0","fca-unofficial":"github:VangBanLaNhat/fca-unofficial"},"devDependencies":{"eslint":"^8.50.0","mocha":"^10.2.0"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_id":"toru-ultimate@1.0.0","_nodeVersion":"26.4.0","_npmVersion":"11.19.1","dist":{"integrity":"sha512-mB3Na31g16UCAce8WTfwYdRzEwG3zDf51wGdN+n4Eg+2pJ9fFqdNeCGywx+0nmh+8d0nUdRfBnwdT9H8yjbcVQ==","shasum":"af8436ccf6abec3a85be917e994971cc282c0354","tarball":"https://registry.npmjs.org/toru-ultimate/-/toru-ultimate-1.0.0.tgz","fileCount":166,"unpackedSize":34468075,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEQCIDTr55B31r94MQaLIaYBJukRYHMEfJ1rQO+upwpP92lAAiB0N2nuy2HhufXY4rEOnMUIpQJaRSBfhUo5Qnb+BT7F7A=="}]},"_npmUser":{"name":"alpha-male","email":"hridoykhan827642488@gmail.com"},"directories":{},"maintainers":[{"name":"alpha-male","email":"hridoykhan827642488@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/toru-ultimate_1.0.0_1788503609325_0.5683953321076034"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-04T06:33:29.166Z","1.0.0":"2026-09-04T06:33:29.663Z","modified":"2026-09-04T06:33:29.860Z"},"maintainers":[{"name":"alpha-male","email":"hridoykhan827642488@gmail.com"}],"description":"Facebook Chat API by HR ID OY | Stable • Auto Re-login • Full E2EE Support — send messages, media, reactions & more in encrypted chats, hassle-free","homepage":"https://github.com/HR-ID-OY/toru-ultimate#readme","keywords":["facebook","chat","api","messenger","bot","unofficial","fca","toru-ultimate","hr-id-oy"],"repository":{"type":"git","url":"git+https://github.com/HR-ID-OY/toru-ultimate.git"},"contributors":[{"name":"HR ID OY","url":"https://github.com/HR-ID-OY"},{"name":"DongDev","url":"Original"}],"author":{"name":"HR ID OY","url":"https://github.com/HR-ID-OY"},"bugs":{"url":"https://github.com/HR-ID-OY/toru-ultimate/issues"},"license":"MIT","readme":"<div align=\"center\">\n\n<img src=\"https://img.shields.io/badge/toru--ultimate-v1.0.0-blueviolet?style=for-the-badge&logo=npm\" alt=\"toru-ultimate\"/>\n\n# 🚀 toru-ultimate\n\n### Unofficial Facebook Messenger Bot API for Node.js\n\n> Built and maintained by **HR ID OY**\n\n[![npm version](https://img.shields.io/npm/v/toru-ultimate?color=blueviolet&style=flat-square)](https://www.npmjs.com/package/toru-ultimate)\n[![license](https://img.shields.io/badge/license-MIT-brightgreen?style=flat-square)](./LICENSE)\n[![node](https://img.shields.io/badge/node-%3E%3D20-blue?style=flat-square)](https://nodejs.org)\n[![author](https://img.shields.io/badge/author-HR%20ID%20OY-orange?style=flat-square)](https://github.com/HR-ID-OY)\n\n</div>\n\n---\n\n## 👤 About\n\n**toru-ultimate** is a powerful, stable, and feature-rich Facebook Messenger Bot API for Node.js — created and maintained by **HR ID OY**.\n\nThis project supports real E2EE encrypted conversations, stable MQTT connection, auto session protection, and 90+ API methods — all fully compatible with GoatBot and Mirai bot frameworks.\n\n---\n\n## ✨ Key Features\n\n| Feature | Description |\n|---|---|\n| 🔒 **Signal Protocol E2EE** | Real Facebook encrypted conversation support |\n| 📡 **Stable MQTT** | Auto-reconnect, jitter, isActiveClient guard |\n| 🛡️ **sessionGuard** | Appstate auto-save, corruption guard, .bak backup |\n| 📢 **sendBroadcast** | Rate-limited multi-thread message broadcast |\n| 🤖 **MessengerBot** | Discord.js / Telegraf style bot class |\n| 🎯 **createFcaClient** | Namespaced API facade (messages, threads, users) |\n| ⚡ **Anti-Spam Humanizer** | Human-like reply delay, per-thread cooldown |\n| 🔄 **Auto-Reconnect** | Auto-reconnect on MQTT/connection drop |\n| 🧩 **GoatBot Compatible** | Drop-in replacement, all API signatures unchanged |\n| 📦 **90+ API Methods** | sendMessage, editMessage, getThreadInfo & more |\n\n---\n\n## 📦 Installation\n\n```bash\nnpm install toru-ultimate\n```\n\n> Node.js **>= 20** required.\n\n---\n\n## 🚀 Quick Start\n\n### Basic Usage (GoatBot Compatible)\n\n```javascript\nconst login = require(\"toru-ultimate\");\n\nlogin({ appState: require(\"./account.json\") }, { listenEvents: true }, (err, api) => {\n  if (err) throw err;\n\n  api.sessionGuard(\"./account.json\", {\n    interval: 3 * 60 * 1000,\n    debounce: 30 * 1000\n  });\n\n  api.listenMqtt((err, event) => {\n    if (err) throw err;\n    if (event.type === \"message\") {\n      api.sendMessage(\"Hello! 👋\", event.threadID);\n    }\n  });\n});\n```\n\n### With E2EE (Encrypted Conversations)\n\n```javascript\nconst login = require(\"toru-ultimate\");\n\nlogin({ appState: require(\"./account.json\") }, { listenEvents: true }, (err, api) => {\n  if (err) throw err;\n\n  api.sessionGuard(\"./account.json\");\n\n  // E2EE auto-connects after login — do NOT call connectE2EE() manually\n  api.listenE2EE((err, event) => {\n    if (err) throw err;\n    if (event.type === \"message\") {\n      if (event.isE2EE) {\n        api.e2ee.sendMessage(event.threadID, \"Encrypted reply! 🔐\");\n      } else {\n        api.sendMessage(\"Normal reply! 💬\", event.threadID);\n      }\n    }\n  });\n});\n```\n\n### MessengerBot Style\n\n```javascript\nconst { createMessengerBot } = require(\"toru-ultimate\");\n\nconst bot = await createMessengerBot(\n  { appState: require(\"./account.json\") },\n  { commandPrefix: \"/\" }\n);\n\nbot.command(\"ping\", async ctx => await ctx.replyAsync(\"🏓 pong!\"));\nbot.hears(/hi/i, async ctx => await ctx.replyAsync(\"Hello! 👋\"));\n\nawait bot.launch();\n```\n\n### createFcaClient (Namespaced API)\n\n```javascript\nconst { createFcaClient } = require(\"toru-ultimate\");\nconst client = createFcaClient(api);\n\nawait client.messages.send(\"Hello!\", threadID);\nawait client.messages.react(\"❤️\", messageID, threadID);\nawait client.threads.getInfo(threadID);\nawait client.users.getInfo(userID);\n```\n\n---\n\n## 🔐 E2EE — Encrypted Conversations\n\ntoru-ultimate uses Facebook's real **Signal Protocol** infrastructure — same as the official Messenger app.\n\n- E2EE connects **automatically** after login (no manual setup needed)\n- Creates `.nexca/e2ee_device.json` on first run\n- Supports DM text, media, reactions, unsend, edit in encrypted threads\n\n```javascript\n// Check E2EE status\nconsole.log(api.e2ee.isConnected()); // true\n\n// E2EE Methods\nawait api.e2ee.sendMessage(threadID, \"Hello! 🔐\");\nawait api.e2ee.sendMessage(threadID, { body: \"Photo!\", attachment: fs.createReadStream(\"photo.jpg\") });\nawait api.e2ee.sendReaction(threadID, messageID, \"❤️\");\nawait api.e2ee.sendTyping(threadID, true);\nawait api.e2ee.unsendMessage(messageID, threadID);\nawait api.e2ee.editMessage(threadID, messageID, \"Updated!\");\nawait api.e2ee.disconnect();\n```\n\n### Native Media Engine (Optional)\n\nEnable via environment variable for enhanced E2EE media support:\n\n```bash\nFCA_E2EE_NATIVE=1 node bot.js\n```\n\n> Supports Linux (.so) and Windows (.dll) — auto-falls back on unsupported platforms.\n\n---\n\n## 🛡️ sessionGuard\n\nProtects your appstate from corruption and silent logouts.\n\n```javascript\napi.sessionGuard(\"./account.json\", {\n  interval: 3 * 60 * 1000,  // save every 3 minutes\n  debounce: 30 * 1000        // debounce after sendMessage\n});\n\napi.saveSession();           // force save now\napi.restoreSessionBackup();  // restore from .bak\napi.stopSessionGuard();      // stop the timer\n```\n\n---\n\n## 📢 sendBroadcast\n\nRate-limited multi-thread message broadcasting.\n\n```javascript\nconst result = await api.sendBroadcast(\n  \"Hello everyone! 👋\",\n  [\"THREAD_1\", \"THREAD_2\", \"THREAD_3\"],\n  {\n    delay: 2000,\n    parallel: 2,\n    onEach: (err, info, id) => {\n      console.log(err ? `❌ Failed: ${id}` : `✅ Sent: ${id}`);\n    }\n  }\n);\nconsole.log(`${result.sent.length}/${result.total} delivered`);\n```\n\n---\n\n## ⚡ Anti-Spam Humanizer\n\nMakes your bot reply like a real human — adds natural delay and drops spam bursts.\n\n```javascript\nlogin({ appState }, {\n  humanize: {\n    enabled: true,\n    reactDelayMs: [2000, 3000],\n    cooldownMs: 5500,\n    resetMs: 10000,\n    maxPerMinute: 20,\n    commands: [\"/\", \"!\", \".\"],\n    perThread: true\n  }\n}, cb);\n\n// Inspect humanizer stats\nconst h = api.getHumanizer();\nh.stats();   // { enabled, global: {...}, threads: [...] }\nh.reset();   // clear all cooldown state\n```\n\n---\n\n## 📖 Full API Reference\n\n### 💬 Sending Messages\n\n```javascript\napi.sendMessage(\"Hello!\", threadID);\napi.sendMessage({ body: \"Photo!\", attachment: fs.createReadStream(\"photo.jpg\") }, threadID);\napi.sendMessage({ body: \"Hey @Name\", mentions: [{ id: \"uid\", tag: \"@Name\", fromIndex: 4 }] }, threadID);\napi.sendMessage({ sticker: \"369239263222822\" }, threadID);\napi.sendBroadcast(\"msg\", [\"tid1\", \"tid2\"], { delay: 2000 });\napi.sendGif(\"https://media.giphy.com/xyz.gif\", threadID);\napi.sendLocation(23.8, 90.4, threadID);\napi.sendImage(\"./photo.jpg\", threadID, \"caption\");\napi.sendVideo(\"./video.mp4\", threadID);\napi.sendAudio(\"./voice.ogg\", threadID);\napi.sendFile(\"./doc.pdf\", threadID);\napi.shareLink(\"https://github.com\", threadID, \"Check this!\");\napi.shareContact(\"Meet my friend!\", userID, threadID);\n```\n\n### ✏️ Message Actions\n\n```javascript\napi.editMessage(\"Updated text\", messageID);\napi.unsendMessage(messageID);\napi.deleteMessage([messageID]);\napi.deleteThread(threadID);\napi.setMessageReaction(\"😍\", messageID, threadID);\napi.setMessageReaction(\"\", messageID);  // remove reaction\napi.getMessage(threadID, messageID);\napi.forwardAttachment(attachmentID, [userID]);\napi.uploadAttachment([fs.createReadStream(\"photo.jpg\")]);\napi.pinMessage(messageID, threadID);\napi.unpinMessage(messageID, threadID);\n```\n\n### 👁️ Read Receipts & Typing\n\n```javascript\napi.markAsRead(threadID);\napi.markAsReadAll();\napi.markAsDelivered(threadID, messageID);\napi.markAsSeen();\napi.sendTypingIndicator(threadID, true);\n```\n\n### 🧵 Thread Management\n\n```javascript\napi.getThreadInfo(threadID);\napi.getThreadList(10, null, [\"INBOX\"]);\napi.getThreadHistory(threadID, 20);\napi.createGroup(\"Group Name\", [\"uid1\", \"uid2\"]);\napi.muteThread(threadID, 3600);\napi.changeArchivedStatus(threadID, true);\napi.handleMessageRequest(threadID, true);\napi.searchForThread(\"query\");\n```\n\n### 🎨 Thread Customization\n\n```javascript\napi.setTitle(\"New Name\", threadID);\napi.changeThreadColor(\"#0084FF\", threadID);\napi.changeThreadEmoji(\"🔥\", threadID);\napi.changeNickname(\"The Boss\", threadID, userID);\napi.changeGroupImage(fs.createReadStream(\"group.jpg\"), threadID);\napi.changeAdminStatus(threadID, userID, true);\napi.addUserToGroup(userID, threadID);\napi.removeUserFromGroup(userID, threadID);\napi.createPoll(\"Question?\", threadID, { \"Yes\": false, \"No\": false });\n```\n\n### 👤 User Info\n\n```javascript\napi.getUserInfo(userID);\napi.getUserID(\"John Doe\", callback);\napi.getUID(\"https://facebook.com/username\");\napi.getFriendsList();\napi.getAvatarUser(userID);\napi.getProfileInfo(userID);\napi.sendFriendRequest(userID);\napi.handleFriendRequest(userID, true);\napi.changeBlockedStatus(userID, true);\napi.followUser(userID);\napi.unfriend(userID);\n```\n\n### 🌐 Social Actions\n\n```javascript\napi.reactToPost(postID, \"love\");\napi.reactToComment(commentID, \"haha\");\napi.postComment(postID, \"Great post!\");\napi.sharePost(postID, \"Check this!\");\n```\n\n### ⚙️ Account & Config\n\n```javascript\napi.getCurrentUserID();\napi.getAppState();\napi.setOptions({ listenTyping: true });\napi.logout();\napi.refreshFb_dtsg();\napi.httpGet(url, params, callback);\napi.httpPost(url, form, callback);\napi.httpPostFormData(url, form, callback);\n```\n\n---\n\n## 📋 Login Options\n\n| Option | Type | Default | Description |\n|--------|------|---------|-------------|\n| `selfListen` | boolean | `false` | Receive your own sent messages |\n| `listenEvents` | boolean | `true` | Receive thread/group events |\n| `listenTyping` | boolean | `false` | Receive typing indicator events |\n| `updatePresence` | boolean | `false` | Receive online/offline presence events |\n| `autoMarkDelivery` | boolean | `false` | Auto-mark incoming as delivered |\n| `autoMarkRead` | boolean | `false` | Auto-mark threads as read |\n| `autoReconnect` | boolean | `true` | Auto-reconnect MQTT on disconnect |\n| `online` | boolean | `false` | Appear as online to others |\n| `emitReady` | boolean | `false` | Emit ready event when MQTT connected |\n| `proxy` | string | `—` | HTTP proxy URL |\n| `userAgent` | string | Safari UA | Override HTTP User-Agent |\n\n---\n\n## 📄 License\n\nMIT License © **HR ID OY**\n\n> The E2EE native media engine (`src/api/socket/e2ee/native/`) bundles a precompiled binary from **mautrix-go / mautrix-meta**, © Tulir Asokan, licensed under **MPL-2.0**. See `src/api/socket/e2ee/native/NOTICE.md` — must be preserved in any redistribution.\n\n---\n\n<div align=\"center\">\n\n### 🚀 toru-ultimate\n\nMade with ❤️ by **HR ID OY**\n\n</div>\n","readmeFilename":"README.md","_rev":"1-da6ff1ffd8072628a2ada473d5216fbe"}