Introduction
Hello, everyone, my name is Martin, and today I have created yet another resource that’s open for the public. Today, I’m introducing an open-sourced library (“wrapper”), bloxy, to interact with Roblox’s Web API endpoints.
If you have ever heard of “noblox” or “roblox.js”, this is a library that wants in on the fun. Bloxy basically handles everything related to making / sending requests to Roblox, so you don’t have to worry about that.
Features
Why consider using bloxy, compared to the alternatives:
- It’s open-sourced and written in TypeScript ()
- It’s object-oriented in a “discord.js fashion”
- It’s got the highest coverage of the Roblox Web APIs to date. *1
- Most endpoints added have typings, both for the options but also for the response.
- It’s implemented with CI and tests, which means that it’s more reliable, and once an endpoint changes, we’ll know *2
*1: As of 23/08/2020, bloxy has the most APIs added compared to the most popular alternatives on NPM
*2: Even though we’re trying to test as much as possible, testing web endpoints is never easy, but where it’s possible and viable, we have added tests
Typings on APIs
(You can see the amount of APIs added)
(Detailed typings)
Installation & Setting Up
Now, it’s not a big deal to install bloxy, either. Once you have Node.JS and NPM installed, execute the following command and it’ll be installed:
npm install bloxy --save
In order to log in with bloxy, you need to fetch your .ROBLOSECURITY
cookie, as it provides instantaneous access to your account, and does not need captcha-solving. Once you’ve installed bloxy and retrieved your cookie, you can see the video below for a quick example on how to log in!
Code
const COOKIE = "[REDACTED]";
const bloxy = require("bloxy");
// Creating an async environment
(async () => {
const client = new bloxy.Client({
credentials: {
cookie: COOKIE
}
});
const authenticatedUser = await client.login();
console.log(`Logged in as ${authenticatedUser.name} (${authenticatedUser.id})`)
})();
Example usages
Now, to allow you to see how great bloxy really is, we’ve got to add some examples!
Getting a group's funds
// Async environment //
const bloxy = require("bloxy");
const client = new bloxy.Client({
credentials: {
cookie: "your cookie"
}
});
const group = await client.getGroup(123);
const funds = await group.getFunds();
console.log(`Group ${group.name} has ${funds} Robux in funds!`);
Giving a user a role
const bloxy = require("bloxy");
const client = new bloxy.Client({
credentials: {
cookie: "cookie"
}
});
await client.login();
const group = await client.getGroup(6969);
await group.updateMember(
321, // User id
123 // Role id
);
Notes
- Bloxy is still under development, and bugs may occur. If you do find any, please, open an issue on the GitHub page or reach out to me.
- Since bloxy still is in development, documentation is not at its best, however, it’s definitely being worked on. You do have access to the typings and all of that to help you, though.
- If you encounter an issue, need help, or want to talk about Roblox API in general, feel free to visit this Discord server