공식 패키지 · 프레임워크

Node.js에서 Chat API, Live Chat, 승인 사용하기

의존성이 없는 서버 SDK로, pusher 패키지가 다루지 않는 Hibira 제품을 지원합니다: Chat API, Express·Fastify·Koa 미들웨어를 갖춘 Live Chat 인증 방문자, 그리고 Approvals.

npm 버전라이선스

가장 빠른 방법: Hibira 플러그인과 프롬프트 하나

AI 코딩 에이전트에 플러그인을 설치하고 프롬프트를 붙여 넣으세요. 에이전트가 로그인하고, 필요하면 무료 앱을 만들고, 코드를 작성한 뒤 테스트 이벤트를 보냅니다. GitHub ↗

  1. 플러그인 설치

    claude plugin marketplace add hibira-io/agent-plugin
    claude plugin install hibira@hibira
  2. 이 프롬프트 붙여 넣기

    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.

직접 하고 싶다면 아래 단계는 다음과 같습니다:

  1. 설치
  2. 설정하기
  3. 사용하기

다른 AI 도구와 플러그인 구성 →

  • hibira.chat으로 대화를 만들고, 멤버로 메시지를 보내고, 기록을 읽고, 읽음 처리를 합니다.
  • Express, Koa, Fastify 미들웨어가 로그인한 사용자를 인증한 상태로 Live Chat 위젯을 페이지에 넣습니다.
  • hibira.approvals는 사람에게 결정을 요청하고 답을 기다립니다. verifyApprovalCallback()은 서명된 콜백을 검증합니다.

로그인하면 예제 코드에 내 클러스터 호스트가 채워집니다. 로그인

  1. 설치

    npm install @hibira-io/node
  2. 설정하기

    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. 사용하기

    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 });

시작하기 전에

  • 앱 시크릿은 앱을 만들거나 시크릿을 교체할 때 한 번만 표시됩니다. 서버에만 두고, 브라우저나 게임 빌드에는 절대 넣지 마세요.
  • 실시간 이벤트와 채널 인증에는 {brand} 호스트를 가리키는 pusher npm 패키지를, 대기실에는 @hibira-io/waiting-room을 사용하세요.

대시보드의 앱 키를 사용하세요. 시크릿은 서버에만 둡니다. 채널, 이벤트, 인가 엔드포인트는 Pusher와 똑같이 동작합니다. 무료 계정 만들기 →