{"id":13989730,"url":"https://github.com/dharness/react-chat-window","last_synced_at":"2025-05-16T15:07:24.097Z","repository":{"id":22020383,"uuid":"94737695","full_name":"dharness/react-chat-window","owner":"dharness","description":"Intercom-style live chat window written in react","archived":false,"fork":false,"pushed_at":"2024-04-01T04:45:02.000Z","size":7173,"stargazers_count":679,"open_issues_count":30,"forks_count":250,"subscribers_count":16,"default_branch":"master","last_synced_at":"2025-04-29T18:17:54.686Z","etag":null,"topics":["chat","react"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dharness.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-06-19T04:52:11.000Z","updated_at":"2025-04-15T20:31:02.000Z","dependencies_parsed_at":"2024-06-18T16:44:33.121Z","dependency_job_id":"026f19c7-5c4d-4ed5-94ad-0ef27058e88c","html_url":"https://github.com/dharness/react-chat-window","commit_stats":null,"previous_names":["kingofthestack/react-live-chat","dharness/react-chat-window","kingofthestack/react-chat-window"],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dharness%2Freact-chat-window","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dharness%2Freact-chat-window/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dharness%2Freact-chat-window/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dharness%2Freact-chat-window/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dharness","download_url":"https://codeload.github.com/dharness/react-chat-window/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254378571,"owners_count":22061398,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chat","react"],"created_at":"2024-08-09T13:02:00.844Z","updated_at":"2025-05-16T15:07:24.079Z","avatar_url":"https://github.com/dharness.png","language":"JavaScript","funding_links":[],"categories":["JavaScript","Widgets"],"sub_categories":[],"readme":"# react-chat-window\n\n`react-chat-window` provides an intercom-like chat window that can be included easily in any project for free. It provides no messaging facilities, only the view component.\n\n![GitHub license](https://img.shields.io/github/package-json/v/kingofthestack/react-chat-window.svg?style=flat-square) \u003ca href=\"https://www.npmjs.com/package/react-chat-window\" target=\"\\_parent\"\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/npm/dm/react-chat-window.svg\" /\u003e\n\u003c/a\u003e\n\u003ca href=\"https://github.com/kingofthestack/react-chat-window\" target=\"\\_parent\"\u003e\n  \u003cimg alt=\"\" src=\"https://img.shields.io/github/stars/kingofthestack/react-chat-window.svg?style=social\u0026label=Star\" /\u003e\n\u003c/a\u003e\n\u003cbr/\u003e\n\n![Demo gif of react-chat-window being used](https://puu.sh/xei2F/fd4a121185.gif)\n\n## Features\n\n- Customizeable\n- Backend agnostic\n- Free\n\n## [Demo](https://kingofthestack.github.io/react-chat-window/)\n\n## Table of Contents\n- [Installation](#installation)\n- [Example](#example)\n- [Components](#components)\n\n## Installation\n\n```\n$ npm install react-chat-window\n```\n\n## Example\n\n``` javascript\nimport React, {Component} from 'react'\nimport {Launcher} from 'react-chat-window'\n\nclass Demo extends Component {\n\n  constructor() {\n    super();\n    this.state = {\n      messageList: []\n    };\n  }\n\n  _onMessageWasSent(message) {\n    this.setState({\n      messageList: [...this.state.messageList, message]\n    })\n  }\n\n  _sendMessage(text) {\n    if (text.length \u003e 0) {\n      this.setState({\n        messageList: [...this.state.messageList, {\n          author: 'them',\n          type: 'text',\n          data: { text }\n        }]\n      })\n    }\n  }\n\n  render() {\n    return (\u003cdiv\u003e\n      \u003cLauncher\n        agentProfile={{\n          teamName: 'react-chat-window',\n          imageUrl: 'https://a.slack-edge.com/66f9/img/avatars-teams/ava_0001-34.png'\n        }}\n        onMessageWasSent={this._onMessageWasSent.bind(this)}\n        messageList={this.state.messageList}\n        showEmoji\n      /\u003e\n    \u003c/div\u003e)\n  }\n}\n```\n\nFor more detailed examples see the demo folder.\n\n## Components\n\n# Launcher\n\n`Launcher` is the only component needed to use react-chat-window. It will react dynamically to changes in messages. All new messages must be added via a change in props as shown in the example.\n\nLauncher props:\n\n|      prop        | type   | required | description |\n|------------------|--------|----------|-------------|\n| agentProfile     | [object](#agent-profile-objects) | yes | Represents your product or service's customer service agent. Fields: imageUrl (string), teamName (string). |\n| handleClick      | function | yes | Intercept the click event on the launcher. No argument sent when function is called. |\n| isOpen           | boolean | yes | Force the open/close state of the chat window. If this is not set, it will open and close when clicked. |\n| messageList      | [[message](#message-objects)] | yes | An array of message objects to be rendered as a conversation. |\n| mute             | boolean | no | Don't play sound for incoming messages. Defaults to `false`. |\n| newMessagesCount | number | no | The number of new messages. If greater than 0, this number will be displayed in a badge on the launcher. Defaults to `0`. |\n| onFilesSelected  | function([fileList](https://developer.mozilla.org/en-US/docs/Web/API/FileList)) | no | Called after file has been selected from dialogue in chat window. |\n| onMessageWasSent | function([message](#message-objects)) | yes | Called when a message is sent, with a message object as an argument. |\n| showEmoji        | boolean | no | Whether or not to show the emoji button in the input bar. Defaults to `true`.\n\n\n### Message Objects\n\nMessage objects are rendered differently depending on their type. Currently, only text, file, and emoji types are supported. Each message object has an `author` field which can have the value 'me' or 'them'.\n\n``` javascript\n{\n  author: 'them',\n  type: 'text',\n  data: {\n    text: 'some text'\n  }\n}\n\n{\n  author: 'me',\n  type: 'emoji',\n  data: {\n    code: 'someCode'\n  }\n}\n\n\n{\n  author: 'me',\n  type: 'file',\n  data: {\n    url: 'somefile.mp3',\n    fileName: 'Any old name'\n  }\n}\n\n```\n\n### Agent Profile Objects\n\nLook like this:\n\n```js\n{\n  imageUrl: 'https://somewhere.on/the_web.png',\n  teamName: 'Da best'\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdharness%2Freact-chat-window","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdharness%2Freact-chat-window","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdharness%2Freact-chat-window/lists"}