npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@rivium/chat

v0.1.0

Published

RiviumChat Node.js SDK — server-side chat rooms, messages, reactions, pins, and webhooks

Readme

RiviumChat Node.js SDK

Server-side SDK for RiviumChat. Manage chat rooms, messages, reactions, pins, webhooks, and push notification templates from your Node.js backend.

Server-side only. This SDK requires a server secret and must never be used in client-side applications. The server secret can be extracted from client apps.

Features

  • Room management (create, find, list, add participants)
  • Message operations (send, edit, delete, search, mentions)
  • Read receipts and unread counts
  • Emoji reactions
  • Message pinning
  • Webhook configuration
  • Push notification templates (via Rivium Push)
  • Centrifugo connection token generation
  • Zero runtime dependencies — uses native Node.js http/https
  • TypeScript declarations included

Installation

npm install @rivium/chat

Quick Start

import { RiviumChat } from '@rivium/chat';

const riviumChat = new RiviumChat({
  apiKey: 'YOUR_API_KEY',
  serverSecret: 'YOUR_SERVER_SECRET',
});

Create a Room

const room = await riviumChat.rooms.findOrCreate({
  externalId: 'order-123',
  participants: [
    { externalUserId: 'user-1', displayName: 'Alice', role: 'member' },
    { externalUserId: 'user-2', displayName: 'Bob', role: 'member' },
  ],
});

Send a Message

const message = await riviumChat.messages.send(room.id, {
  senderUserId: 'user-1',
  content: 'Hello from the server!',
});

Get Message History

const { messages, hasMore } = await riviumChat.messages.getHistory(room.id, {
  userId: 'user-1',
  limit: 50,
});

Mark as Read

await riviumChat.messages.markAsRead(room.id, 'user-1');

Unread Counts

const summary = await riviumChat.rooms.getUnreadSummary('user-1');
// { totalUnread: 5, rooms: [{ roomId, externalId, unreadCount }] }

API Reference

Rooms

riviumChat.rooms.create(options)                    // Create a room
riviumChat.rooms.findOrCreate(options)               // Find or create by externalId
riviumChat.rooms.get(roomId)                         // Get room by ID
riviumChat.rooms.getByExternalId(externalId)          // Get room by external ID
riviumChat.rooms.list(userId)                        // List rooms for a user
riviumChat.rooms.addParticipant(roomId, options)      // Add participant to room
riviumChat.rooms.getUnreadSummary(userId)             // Get unread counts

Messages

riviumChat.messages.send(roomId, options)             // Send a message
riviumChat.messages.getHistory(roomId, options)        // Get paginated history
riviumChat.messages.markAsRead(roomId, userId)         // Mark messages as read
riviumChat.messages.edit(messageId, userId, content)   // Edit a message
riviumChat.messages.delete(messageId, userId)          // Delete a message
riviumChat.messages.search(roomId, options)            // Search messages
riviumChat.messages.getMentions(roomId, options)        // Get @mentions

Reactions

riviumChat.reactions.add(messageId, userId, emoji)     // Add reaction
riviumChat.reactions.remove(messageId, userId, emoji)   // Remove reaction
riviumChat.reactions.list(messageId)                    // List reactions

Pins

riviumChat.pins.pin(messageId, userId)                 // Pin a message
riviumChat.pins.unpin(messageId, userId)                // Unpin a message
riviumChat.pins.list(roomId)                           // List pinned messages

Webhooks

riviumChat.webhooks.get()                              // Get webhook config
riviumChat.webhooks.setWebhook({ url, secret? })        // Set webhook URL
riviumChat.webhooks.removeWebhook()                     // Remove webhook
riviumChat.webhooks.setPushTemplate(templateId)          // Set push template
riviumChat.webhooks.removePushTemplate()                 // Remove push template
riviumChat.webhooks.setPushTemplates(templates)           // Per-event push templates
riviumChat.webhooks.removePushTemplates()                 // Remove per-event templates

Tokens

riviumChat.tokens.getConnectionToken({ userId, info? })  // Get Centrifugo token

Push Notifications

Configure push notifications for offline users via Rivium Push:

// Use a Rivium Push template
await riviumChat.webhooks.setPushTemplate('your-template-id');

// Or use per-event inline templates
await riviumChat.webhooks.setPushTemplates({
  new_message: {
    title: '{{senderName}}',
    body: '{{messagePreview}}',
  },
  mention: {
    title: '{{senderName}} mentioned you',
    body: '{{messagePreview}}',
  },
});

Links

License

MIT