{"id":28999941,"url":"https://github.com/ConnectyCube/use-chat","last_synced_at":"2025-06-25T08:33:47.458Z","repository":{"id":274779845,"uuid":"917643948","full_name":"ConnectyCube/use-chat","owner":"ConnectyCube","description":"A React hook for state management in ConnectyCube-powered chat solutions","archived":false,"fork":false,"pushed_at":"2025-06-18T12:14:32.000Z","size":560,"stargazers_count":0,"open_issues_count":4,"forks_count":0,"subscribers_count":1,"default_branch":"dev","last_synced_at":"2025-06-18T12:39:48.643Z","etag":null,"topics":["chat","chat-application","instant-messaging","react","react-hooks"],"latest_commit_sha":null,"homepage":"https://connectycube.com","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ConnectyCube.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":".github/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,"zenodo":null}},"created_at":"2025-01-16T11:32:48.000Z","updated_at":"2025-06-18T12:14:35.000Z","dependencies_parsed_at":"2025-01-29T11:24:13.222Z","dependency_job_id":"678b0402-7711-4ea3-9527-1386fadedac9","html_url":"https://github.com/ConnectyCube/use-chat","commit_stats":null,"previous_names":["connectycube/use-chat"],"tags_count":22,"template":false,"template_full_name":null,"purl":"pkg:github/ConnectyCube/use-chat","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectyCube%2Fuse-chat","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectyCube%2Fuse-chat/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectyCube%2Fuse-chat/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectyCube%2Fuse-chat/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ConnectyCube","download_url":"https://codeload.github.com/ConnectyCube/use-chat/tar.gz/refs/heads/dev","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ConnectyCube%2Fuse-chat/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":261835864,"owners_count":23217114,"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","chat-application","instant-messaging","react","react-hooks"],"created_at":"2025-06-25T08:33:14.266Z","updated_at":"2025-06-25T08:33:47.449Z","avatar_url":"https://github.com/ConnectyCube.png","language":"TypeScript","funding_links":["https://www.buymeacoffee.com/connectycube"],"categories":["State management"],"sub_categories":[],"readme":"# Use Chat\n\nA React hook for state management in ConnectyCube-powered chat solutions.\n\nThis library provides a headless solution for managing chat functionality in ConnectyCube. Similar to how Formik simplifies form handling, this library streamlines the development of chat applications.\n\nThe core purpose is to handle essential chat features like state management, handling subsequent events and APIs properly etc, so the end user takes care about UI building only.\n\n## Features\n\n- Handle chats and messages states, including the currently active conversation\n- Manage chat participants states\n- Maintain typing indicators and users last activity.\n- Support attachments download\n- Message drafts\n- Moderation via user reporting and block\n\n## Installation\n\n```\nnpm install @connectycube/use-chat\n```\n\nor\n\n```\nyarn add @connectycube/use-chat\n```\n\n## Usage\n\n```ts\nimport { useChat } from \"@connectycube/use-chat\";\n\nconst MyComponent = () =\u003e {\n  const { connect, createChat, sendMessage, selectedDialog } = useChat();\n\n  const handleConnect = async () =\u003e {\n    const chatCredentials = {\n      userId: 22,\n      password: \"password\",\n    };\n    await connect(chatCredentials);\n  };\n\n  const handleCreateChat = async () =\u003e {\n    const userId = 456;\n    const dialog = await createChat(userId);\n    await selectDialog(dialog);\n  };\n\n  const handleSendMessage = async () =\u003e {\n    // send message to selected dialog\n    sendMessage(\"Hi there\");\n  };\n\n  return (\n    \u003cdiv className=\"container\"\u003e\n      \u003cbutton type=\"button\" onClick={handleConnect}\u003e\n        Connect\n      \u003c/button\u003e\n      \u003cbutton type=\"button\" onClick={handleCreateChat}\u003e\n        Create chat\n      \u003c/button\u003e\n      \u003cbutton type=\"button\" onClick={handleSendMessage}\u003e\n        Send message\n      \u003c/button\u003e\n    \u003c/div\u003e\n  );\n};\n\nexport default MyComponent;\n```\n\nFor more complex example please check [React chat code sample](https://github.com/ConnectyCube/connectycube-web-samples/tree/master/chat-react)\n\n## API\n\nCheck types for more API examples https://github.com/ConnectyCube/use-chat/blob/main/src/types/index.ts\n\n## Documentation \n\n[https://developers.connectycube.com/js/use-chat](https://developers.connectycube.com/js/use-chat)\n\n## Have an issue?\n\nJoin our [Discord](https://discord.com/invite/zqbBWNCCFJ) for quick answers to your questions\n\n## Community\n\n- [Blog](https://connectycube.com/blog)\n- X (twitter)[@ConnectyCube](https://x.com/ConnectyCube)\n- [Facebook](https://www.facebook.com/ConnectyCube)\n\n**Want to support our team**:\u003cbr\u003e\n\u003ca href=\"https://www.buymeacoffee.com/connectycube\" target=\"_blank\"\u003e\u003cimg src=\"https://cdn.buymeacoffee.com/buttons/v2/default-blue.png\" alt=\"Buy Me A Coffee\" style=\"height: 60px !important;width: 217px !important;\" \u003e\u003c/a\u003e\n\n## License\n\n[Apache 2.0](https://github.com/connectycube/use-chat/blob/main/LICENSE)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConnectyCube%2Fuse-chat","html_url":"https://awesome.ecosyste.ms/projects/github.com%2FConnectyCube%2Fuse-chat","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2FConnectyCube%2Fuse-chat/lists"}