This page documents the official JavaScript implementation of GDPlatform requests. The library is gjrequest.js, hosted on GitHub.
Install via npm in your Node.js project:
npm install gjrequest.js
Below is a minimal example based on the official README. It demonstrates login, reading inbox, sending a message, and calling a generic endpoint.
require("dotenv").config();
const { Client } = require("gjrequest.js");
(async () => {
const client = new Client();
await client.login({
accountID: process.env.GD_ACCOUNT_ID,
password: process.env.GD_PASSWORD
});
const inbox = await client.readMessages();
console.log(inbox);
const sent = await client.sendMessage(
29294657,
"Hello World",
"This is a test message!"
);
console.log(sent);
const scores = await client.getLevelScores(1234567);
console.log(scores);
const response = await client.requestEndpoint("uploadGJMessage20.php", {
toAccountID: 29294657,
subject: Buffer.from("Test").toString("base64"),
body: Buffer.from("Hello!").toString("base64")
});
console.log(response);
})();
Important: This page is for documentation only. Do not run live requests from this site. Use a local Node.js environment with your own GDPlatform credentials.