Official package · Frameworks

Chat API, Live Chat and approvals from Node.js

A server SDK with no dependencies for the Hibira products the pusher package does not cover: the Chat API, Live Chat verified visitors with Express, Fastify and Koa middleware, and Approvals.

npm versionLicense

Fastest way: one prompt with the Hibira plugin

Install the plugin in your AI coding agent and paste the prompt. The agent signs you in, creates a free app if you need one, writes the code and sends a test event. GitHub ↗

  1. Install the plugin

    claude plugin marketplace add hibira-io/agent-plugin
    claude plugin install hibira@hibira
  2. Paste this prompt

    Add Hibira Node.js SDK (@hibira-io/node) to this project.
    Follow https://hibira.io/guides/node-sdk, adapted to how this project is already set up.
    If I have no Hibira app yet, create a Free one that allows http://localhost so I can test right away.
    Keep the app key and secret in environment variables, add placeholders to .env.example, and never commit real values or send the secret to a browser.
    When you are done, send a test event, show me it arriving, and list the files you changed.

Prefer to do it by hand? These are the steps below:

  1. Install
  2. Set it up
  3. Use it

Other AI tools and what the plugin includes →

  • hibira.chat creates conversations, posts as a member, reads history and marks messages read.
  • Express, Koa and Fastify middleware put the Live Chat widget on your pages with signed-in users verified.
  • hibira.approvals asks a person for a decision and waits for the answer; verifyApprovalCallback() checks signed callbacks.

Sign in to see these snippets with your own cluster host. Sign in

  1. Install

    npm install @hibira-io/node
  2. Set it up

    HIBIRA_APP_ID=YOUR_APP_ID
    HIBIRA_KEY=YOUR_APP_KEY
    HIBIRA_SECRET=YOUR_APP_SECRET
    HIBIRA_HOST=ws.hibira.io
    HIBIRA_LIVECHAT_WORKSPACE=YOUR_WORKSPACE_ID
    HIBIRA_LIVECHAT_IDENTITY_SECRET=YOUR_IDENTITY_SECRET
  3. Use it

    import { createHibira } from '@hibira-io/node';
    
    const hibira = createHibira();
    
    // Live Chat on every page, signed-in users verified: <%- hibiraLiveChat.scriptTag %>
    app.use(hibira.liveChat.express({ getUser: (req) => req.user && { id: req.user.id, name: req.user.name } }));
    
    await hibira.chat.putConversation('order-1042', { members: ['buyer-7', 'seller-3'] });
    await hibira.chat.sendMessage('order-1042', 'seller-3', 'Shipped today!');
    
    const ask = await hibira.approvals.request({ title: 'Refund order #1042 for $89?', options: ['Refund', 'Decline'] });
    const answer = await hibira.approvals.wait(ask.approval_id, { timeout: 600 });

Before you start

  • The app secret is shown only once, when you create the app or rotate its secret. Keep it on your server, never in a browser or game build.
  • For realtime events and channel auth, use the pusher npm package pointed at your {brand} host; for waiting rooms, @hibira-io/waiting-room.

Use the app key from your dashboard; the secret stays on your server. Channels, events and authorization endpoints work exactly as they do with Pusher. Create your free account →