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 🙏

© 2025 – Pkg Stats / Ryan Hefner

react-chat-sdk

v1.3.2

Published

A React Chat SDK component

Readme

React Chat SDK

A simple, reusable React Chat Component!

Install

npm install react-chat-sdk
# or
yarn add react-chat-sdk

Getting Started

import ChatComponent from "react-chat-sdk";
import "react-chat-sdk/dist/style.css";

<ChatComponent
  serverUrl={{
    chatURL: "API endpoint that fetches history",
    audioURL: "Audio transcript endpoint",
    webSocketURL: "WebSocket URL that can load live messages",
  }}
  headers={{
    Authorization: "Auth token if needed",
  }}
  userName={"Full Name"}
  userId={"Mail ID"}
/>;

Options


serverUrl={{
        chatURL:
          "url that fetches history",
        audioURL:
          "audio url that translate audio",
        audioOutputURL:
          "url that gives audio transcript should be wav file",
        webSocketURL:
          "[email protected]&agent_id=0",
      }}
      headers={{
        Authorization: `Bearer token`,
      }}
      userName={"Full Name"}
      userId={"[email protected]"}
      entityId={"uuid"}
      width={"500"}
      height={"500"}
      open={"need to pass true to open chat window"}
      onClose={"callback function to close chat window"}
      appId={"your appid string"}
      initialMessage={"Send a welcome message"}
      session_id={"uuid"}
      welcomeMessage={'Hi'}
      agent_ids={[]}

Request and Response for chaturl that fetches history (chatURL)


Request formdata that accept at server side (which already being sent from sdk)


"user_id": "mail-id",
"page": 1,
"page_size": 10,
"order": "desc"


Response

"data": {
        "history": [
            {
                "id": "uuid",
                "session_id": "uuid",
                "user_id": "mail-id",
                "agent_ids": [],
                "user_type": "agent || user",
                "action_type": "",
                "message_type": "text",
                "message": "",
                "meta_data": null,
                "created_at": "",
                "parent_message_id": "",
                "message_read": false
            }
        ],
        "total": 58
    },

Request and Response for audioURL


Request formdata that accept at server side (which already being sent from sdk)

"audio": binary
"user_id":"mail-id"
"src_lang":"en-IN"

Response

{
    "language_code": "en-IN",
    "provider": "sarvam",
    "success": true,
    "transcript": "",
    "translation": ""
}

Request and Response for websocket


Request params thatb accept st server side (which already being sent from sdk)

{
  "user_id": "userId",
  "query": "message",
  "transcript_query": "translated_message",
  "entity_id": "uuid",
  "agent_ids": [],
  "session_id":"",
  "type": "agent_chat",
  "agent_type": "",
  "audio_enabled": false,
  "language_code": "en-IN"
},

Response

{
  "id": "uuid",
  "type": "agent_response",
  "session_id": "uuid",
  "user_id": "[email protected]",
  "user_type": "agent | user",
  "agent_response": {
    "reasoning": "",
    "message": "",
    "message_type": "text",
    "content": {
      "text": "",
      "headers": null,
      "rows": null,
      "type": null,
      "labels": null,
      "data": null,
      "items": null,
      "markdown": "",
      "file_size": 0,
      "file_name": ""
    },
    "followup_questions": null,
    "actions": null,
    "audio_urls": null,
    "language_code": "",
    "audio_storage_prefix": "example.wav",
    "translated_message": ""
  },
  "message_type": "text"
}

configure audio output url at server side with audio_storage_prefix param which should accept .wav file and it will be handle at sdk