# hr-sdk

> A JavaScript library for Highrise bot.

Latest version **1.2.0** (published 2026-11-27) · MIT license · 0 weekly downloads

## Install

```sh
npm install hr-sdk
pnpm add hr-sdk
yarn add hr-sdk
bun add hr-sdk
```

## Health

**Score 65/100 (B)** — status: active.

Positive: has types; esm support; no vulnerabilities; recently updated; high maintenance score.

Warnings: low downloads.

## Facts

| | |
|---|---|
| Version | 1.2.0 |
| Published | 2026-11-27 |
| First published | 2024-08-29 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 3 |
| Unpacked size | 218.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Author | Gyanendra Kumar |
| Maintainers | mityg |
| Keywords | highrise, highrise-js-sdk, highrise-sdk, chatbot, sdk, hr-sdk |

## Links

- npm: https://www.npmjs.com/package/hr-sdk
- Repository: https://github.com/GauravGhost/hr-sdk
- Homepage: https://github.com/GauravGhost/hr-sdk#readme
- Issues: https://github.com/GauravGhost/hr-sdk/issues
- npm.io page: https://npm.io/package/hr-sdk

## Dependencies (3)

- [ws](https://npm.io/package/ws.md) ^8.18.0
- [axios](https://npm.io/package/axios.md) ^1.7.4
- [chalk](https://npm.io/package/chalk.md) ^5.3.0

## Recent versions

- 1.2.0 (latest) — 2026-11-27
- 1.1.0 — 2026-11-27
- 1.0.0 — 2026-11-27
- 0.1.1 — 2025-02-11
- 0.1.0 — 2025-01-24
- 0.0.20 — 2025-01-17
- 0.0.19 — 2025-01-14
- 0.0.18 — 2025-01-14
- 0.0.17 — 2025-01-14
- 0.0.16 — 2025-01-14
- 0.0.15 — 2025-01-13
- 0.0.14 — 2025-01-13
- 0.0.13 — 2025-01-13
- 0.0.12 — 2025-01-10
- 0.0.11 — 2025-01-08
- … 9 more at https://npm.io/package/hr-sdk/versions

## README

# Highrise SDK

A JavaScript library for creating and managing Highrise bots.

## Description

The Highrise SDK provides a comprehensive set of tools and functions to interact with the Highrise game platform. It allows developers to create bots that can perform various actions within the Highrise environment, such as sending messages, managing user interactions, handling in-game economy, and more.

## Installation

To install the Highrise SDK, use npm:

```bash
npm install hr-sdk
```

## Usage

Here's a basic example of how to use the Highrise SDK:

```javascript
import { HR, Event } from 'hr-sdk';

const bot = new HR();

bot.on(Event.Ready, (data) => {
    console.log("bot is connected to the server", data)
})

bot.on(Event.Chat, ({user, message, whisper}) => {
   console.log('Received chat create event: @' + user.username + ": " + message);
});

bot.connect('YOUR_BOT_TOKEN', 'YOUR_ROOM_ID');
```

## Actions return promises

Actions without a result (`broadcastMessage`, `whisper`, `emote`, `walk`, `teleport`, `modAction`, ...)
return a `Promise<void>` that resolves when Highrise accepts the request and rejects with its error:

```javascript
try {
    await bot.action.emote({ emoteId: 'emote-wave' });
} catch (error) {
    console.error('Highrise rejected the emote:', error.message);
}
```

Calling them without `await` is still safe: the promise never becomes an unhandled rejection, and
server errors are also emitted as an `Event.Error` event. Invalid payloads and a closed socket still
throw synchronously.

## Connection events

- `Event.Ready`: session started (also after every reconnect)
- `Event.Disconnected`, `Event.Reconnecting` (`{ attempt, delay }`), `Event.ReconnectFailed`
- `Event.Stopped` (`{ reason }`): Highrise refused the session and asked not to reconnect (e.g. invalid token)

The SDK reconnects by itself with backoff and detects silent dead connections (no data for 35s).

## Features

The Highrise SDK supports the following functions:

- **Chat and Communication**
  - `message`: Send a chat message
  - `whisper`: Send a private message to a user
  - `emote`: Perform an emote action
  - `reaction`: Send a reaction
  - `setIndicator`: Show an icon over the bot (`null` clears it)

- **User Management**
  - `getRoomUsers`: Get a list of users in the current room
  - `getRoomUserByUsername`: Find a user in the room by username
  - `getRoomUserByUserId`: Find a user in the room by user ID
  - `moveUserToRoom`: Move a user to another room

- **Room Interactions**
  - `sit`: Make the bot sit on a specific anchor
  - `walk`: Make the bot walk to a specific position
  - `teleport`: Teleport the bot to a specific position

- **Economy and Transactions**
  - `getWallet`: Get the bot's wallet information
  - `getGold`: Get the bot's gold balance
  - `getBoostToken`: Get the bot's boost token balance
  - `getVoiceToken`: Get the bot's voice token balance
  - `tipUser`: Send a tip to a user
  - `buyVoice`: Purchase voice time
  - `buyBoost`: Purchase a room boost
  - `buyItem`: Purchase an item from the shop

- **Moderation and Privileges**
  - `modAction`: Perform a moderation action
  - `getRoomPrivilege`: Get a user's room privileges
  - `changeRoomPrivilege`: Change a user's room privileges

- **Inventory and Outfits**
  - `getBackpack`: Get a user's backpack contents
  - `changeBackpack`: Add or remove items in a user's backpack
  - `getOutfit`: Get a user's current outfit
  - `getMyOutfit`: Get the bot's own outfit
  - `setOutfit`: Set the bot's outfit
  - `getInventory`: Get the bot's inventory

- **Voice Chat**
  - `getVoiceStatus`: Voice chat time left, default speakers and each user's status
  - `inviteSpeaker`: Invite a user to speak
  - `removeSpeaker`: Remove a user from speaking

- **Messaging System**
  - `getConversation`: Get conversation history
  - `sendMessage`: Send a message in a conversation
  - `sendBulkMessage`: Send a message to multiple conversations
  - `getMessage`: Get a specific message
  - `leaveConversation`: Leave a conversation

- **Miscellaneous**
  - `channel`: Send a hidden channel message to other bots
  - `uploadMedia`: Upload an image/gif for a media direct message

- **Events**
  - `Chat`, `Emote`, `Reaction`, `PlayerJoin`, `PlayerLeft`, `PlayerMovement`, `Tip`, `Channel`,
    `Voice`, `Message`, `Moderate`, `Error`

- **Web API** (`import { webApi } from 'hr-sdk'`, no token needed)
  - `getUserById`, `getUserByUsername`, `getUsers`
  - `getRoomById`, `getRooms`
  - `getPost`, `getPosts`
  - `getItem`, `getItems`
  - `getGrab`, `getGrabs`

  List calls take `{ startsAfter, endsBefore, sortOrder, limit }` plus their filters and return
  `{ <records>, total, firstId, lastId }`.

## Documentation

For detailed documentation on each function and its parameters, please refer to our [API Documentation](https://highrise.zesp.in/).

## Contributing

We welcome contributions to the Highrise SDK! Please mail [Email](gyanendrak478@gmail.com) for more information on how to get started.

## License

This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details.

---
_Source: https://npm.io/package/hr-sdk · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
