npm i clashofclans.js
- Node.js v16 or newer is required.
const { Client } = require('clashofclans.js');
const client = new Client();
(async function () {
// This method should be called once when application starts.
await client.login({ email: 'developer@email.com', password: '***' });
const clan = await client.getClan('#2PP');
console.log(`${clan.name} (${clan.tag})`);
})();
const client = new Client({ keys: ['api_key_goes_here'] });
(async function () {
const clan = await client.getClan('#2PP');
console.log(`${clan.name} (${clan.tag})`);
})();
The API lacks socket-based real-time events. It is recommended to implement your own custom polling system. Pull data at specified intervals, compare with previous values, and emit events on change. Consider using Node.js clusters and threads for efficient parallel processing.
This content is not affiliated with, endorsed, sponsored, or specifically approved by Supercell and Supercell is not responsible for it. For more information see Supercell's Fan Content Policy.