- Notifications
You must be signed in to change notification settings - Fork142
A Node.js API wrapper for Roblox.
License
noblox/noblox.js
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
A Node.js wrapper for interacting with the Roblox API; forked fromroblox-js.
About •Prerequisites •Installation •Quickstart •Documentation •Common Issues •YouTube Series •Credits •License
noblox.js
is an open-source Roblox API wrapper written in JavaScript (with TypeScript compatibility) as a fork from sentanos's roblox-js module.
This NPM package enables operations froms theRoblox website to be executed via NodeJS; many individuals leveragenoblox.js
along sideRoblox's HTTPService to create in-game scripts that interact with the website, i.e. promote users, shout events, and so on, or to create Discord utilities to manage their community.
If you are looking for more information on how to create something like this, check outour sister library,noblox.js-server
orour YouTube series. Keep in mind that these resources may not always be up to date, so it ishighly encouraged that you learn to use thenoblox.js
library directly.
- Node.js® v18.18 or later
With node.js installed simply run:
# Run this to install noblox.js locally to your repository.$ npm install noblox.js# Alternatively, if you are using yarn:$ yarn add noblox.js# To use noblox.js anywhere, run this code to install the package globally:$ npm install noblox.js -g
That's it!
You can locate thenoblox.js
documentation here; keep in mind some internal or legacy methods may not be documented.
You may notice our documentation utilizes emojis in every function description; they have meanings!
Icon | Description |
---|---|
🔐 | Authentication throughsetCookie() is required to use this method.1 |
🔓 | Authentication throughsetCookie() is required insome use-cases; dependent on the target's privacy settings. |
✅ | No authentication is required to use this method. |
1 : Extended permissions may be required such as edit permissions or account ownership.
Retrieve your
.ROBLOSECURITY
cookie. Instructions on how to do that can be foundhere.Write your code.
Using
async/await
syntax:constnoblox=require('noblox.js')asyncfunctionstartApp(){// You MUST call setCookie() before using any authenticated methods [marked by 🔐]// Replace the parameter in setCookie() with your .ROBLOSECURITY cookie.constcurrentUser=awaitnoblox.setCookie('_|WARNING:-DO-NOT-SHARE-THIS.--Sharing-this-will-allow-someone-to-log-in-as-you-and-to-steal-your-ROBUX-and-items.|_6E6F626C6F782E6A73')console.log(`Logged in as${currentUser.UserName} [${currentUser.UserID}]`)// Do everything else, calling functions and the like.constgroupInfo=awaitnoblox.getGroup(9997719)console.log(groupInfo)}startApp()
You are now using noblox.js!
Promises are fundamental to this library; if you are unfamiliar with JavaScript promises, we recommend you check outour tutorial here, andDaniel Shiffman's JavaScript series.
It is bad practice to store your.ROBLOSECURITY
cookie inside your codebase; it is too easy to accidentally screenshot or push this private key to GitHub. We recommend using apackage such asdotenv
to store your private information in environmental variables.
We recommend using a secondary account for botting purposes.
Consult their documentation orfollow this video.
In the event of accidentally exposing your.ROBLOSECURITY
cookie, do not panic. Go toAccount Settings
>Security
, selectSign out of all other sessions
, then log out of your account. This should invalidate your.ROBLOSECURITY
cookie.
Error: You are not logged in.
You may be calling a function beforesetCookie()
is completed; make sure that you are awaitingsetCookie()
before initializing any event listeners or function calls.
noblox.js
is a promise based library, this enables you to run operations concurrently; however if you are not awaiting your promises, this means whilesetCookie()
is validating your cookie,your other functions will continue to run- ~30ms is along time at the computer scale.
Promises are fundamental to this library; if you are unfamiliar with JavaScript promises, we recommend you check outour tutorial here, andDaniel Shiffman's JavaScript series.
Error: 400 The roleset is invalid or does not exist.
You likely are using arankId
(0 - 255) instead of arolesetId
(>255); arolesetId
is a unique identifier for a role which you can find by callinggetRoles(groupId)
.
Roblox's naming scheme is a fickle beast; similarly, adeveloperProductId
isdifferent than aproductId
(which appears on the public facing dashboard); usegetDeveloperProducts(placeId)
to see thedeveloperProductId
.
Error: Initialization failed: 401 Authorization has been denied for this request.
First, see the steps forError: You are not logged in
.
If this is unresolved, are you sure the bot has permissions to access this resource? Can you do this operation manually on the website through the bot account?
At the end of the day, a 'bot' is a user account, it cannot magically bypass privacy restrictions or group permissions.
- suufi - Lead maintainer
- sentanos - We wouldn't exist without him. 😀
- Neztore - Library maintenance and review
- alanbixby - Library maintenance
- popeeyy - Creation of the documentation.
- edward - Helping with the creation of the documentation.
About
A Node.js API wrapper for Roblox.