Connect the open source Universal Chat Widget to your Rocket.Chat backend. Using the UCW you can enable live web chat not only for livechat rooms but also for private channels.
This adapter implements the necessary methods for the chat widget to connect with the fantastic Rocket.Chat web chat platform. You will need:
- A Rocket.Chat instance
- A copy of the Universal Chat Widget
mkdir my-chat-widget
cd my-chat-widget
git clone https://github.com/121services/universal-chat-widget
npm run dev
The chat-adapter-rocketchat
is listed as a dependency for the UCW so you don't need to install it
Here's a sample configuration of the universal chat widget including the adapterConfig
portion necessary for Rocket Chat. This was kindly provided by user sGaster.
config= {
"adapter": "RocketChat", // (required)
"element": "#chat-widget",// css selector of element to replace in DOM when the chat widget renders (required)
"position": "bottom-right", // or embedded
"showAvatars": true,
"allowUploads": true,
"poweredByText": "121 Services", // yes, you can change this :)
"poweredByHost": "http://localhost:3000", // and this!
"adapterConfig": {
"backendUrl": "https://my-instance.rocket.chat/", // your Rochet chat instance
"deviceId": "c683b9da-c908-4407-97dd-91e6bf2552d1", // whatever string you want to use to track your clients' messages
"initData": {
"username": 'admin',
"password": 'admin',
"data": {
"roomId": 'XYZ' // when mode is 'private', fill in with a room id; when mode is 'livechat' fill in a departmentId
}
},
"mode":"private" // or livechat
}
}
The following instructions are a copy from http://justjs.com/posts/npm-link-developing-your-own-npm-modules-without-tears
npm link: symbolic links to the rescue Fortunately npm provides a tool to avoid this tedium. And it's easy to use. But there's a catch.
Here's how it's supposed to work:
-
cd to src/appy
-
Run "npm link". This creates a symbolic link from a global folder to the src/appy folder.
-
cd to src/mysite
-
Run "npm link appy". This links "node_modules/appy" in this particular project to the global folder, so that "require" calls looking for appy wind up loading it from your development folder, src/appy.
Mission accomplished... almost. If you installed Node in a typical way, using MacPorts or Ubuntu's apt-get, then npm's "global" folders are probably in a location shared system-wide, like /opt/local/npm or /usr/lib/npm. And this is not good, because it means those "npm link" commands are going to fail unless you run them as root.
If you want to develop a new adapter to connect the Universal Chat Widget with any other backend, follow these instructions.
# install dependencies
npm install
# serve with hot reload at localhost:8080
npm run dev
# build for production with minification
npm run build
# build for production and view the bundle analyzer report
npm run build --report
# run unit tests
npm run unit
# run e2e tests
npm run e2e
# run all tests
npm test
- webpack - The JS modules bundler
If you have a feature request or found a bug, please open an issue here
Help with developing and maintaining the code is welcome. Please read CONTRIBUTING.md for details on our code of conduct, and the process for submitting pull requests.
We use SemVer for versioning. For the versions available, see the tags on this repository.
- Carlos Gonzalez - Initial work - catogonzalez
This project was initially created and is sponsored by 121 Services; you build chatbots? use 121 Services' Bot Platform: it integrates with anything that has an API.
This project is licensed under the MIT License - see the LICENSE.md file for details
This library webpack boilerplate code config is based on https://github.com/krasimir/webpack-library-starter