I got a chance to work on a project called EmbeddedChat which is an in-app chat solution to web applications needing a chat component to increase user engagement.
From just an idea (proposal) to a complete product - 3 months of Google Summer of Code passed.
I intend to maintain this repository as a final report summary of my GSoC work and a quick guide for all future GSoC aspirants.
EmbeddedChat allows users to integrate RocketChat into their React web-based applications easily also providing an amazing developer experience while introducing in-app chat solutions.
Create a ready-to-go easy to embed mini-chat React component.
I worked on a project called EmbeddedChat which is an in-app chat solution that utilizes the RocketChat chat engine through its REST and real-time APIs to support powerful chat features like reactions, online presence, typing status, threads, and much more.
I would maintain this repository as the final report summary of my GSoC 2023 project and a quick guide for all future GSoC aspirants.
The goal of the project is to make a ready-to-use chat solution that could be integrated into any website, web app, or app. This project was a major refactoring and enhancement for the EmbeddedChat 2022 project.
auth - The auth package includes functions to easily log into a Rocket chat server. Though it is used by embeddedchat's react and react-native client, developers can use this package for their own use cases.
api - The api package includes functions that are all required to create a chat application using the Rocketchat server. It has functions like connect, login, sendMesage, pinMessage, starMessage, deleteMessage, triggerBlockAction, etc. to perform various operations. One can listen to new/updated message events by attaching event listeners using addMessageListener. There are other event listeners which could be added using addMessageDeleteListener, addTypingStatusListener, addActionTriggeredListener, addUiInteractionListener.
react - The react package includes the react components to integrate EmbeddedChat.
react-native - The react-native project aims at using EmbeddedChat in react native mobile apps.
htmembed - With this project EmbeddedChat could be integrated into any web app by simply embedding an HTML snippet.
We can customize EmbeddedChat by passing a custom theme object. Hence, it could take the look and feel of the app or website. We can also customize components by custom stylesheet or passing custom class names through the theme object.
Our api package exposes the EmbeddedChatApi class. It comes with a bunch of APIs that could be used to login, send, pin, edit, star or delete message, attach listeners for realtime events. It has the following structure:
We now support token-based authentication for EmbeddedChat. An app can pass the access token of the services that are configured in RocketChat to EmbeddedChat. It would be useful when the app does not want to show any additional login UI for EmbeddedChat.
A big big thank you to my mentor for the guidance and support before and throughout GSoC. π
I learned beyond GSoC from him and am forever grateful to be mentored by him.
During my GSoC period, I worked on EmbeddedChat, a lightweight chat widget that uses the RocketChat engine's REST and real-time APIs to deliver comprehensive chat features, customizable options, and attractive theming capabilities.
The goal of this project was to develop a ready-to-use chat solution that could be integrated into any website, web app, or mobile app. In EmbeddedChat 2024, my focus was on enhancing the UI by making components modular and providing pre-built themes. The project also sought to ensure security through HTTP-Only cookie-based authentication, using RC-app as a bridge. I also worked on improving configuration capabilities, enabling the instance to be configurable through RC-app, and developed a real-time layout editor with drag-and-drop features, among other enhancements.
Here's a brief preview of EmbeddedChat integrated into a website, designed to demonstrate the functionality of RC apps without the need for local setup.
Key updates to the EmbeddedChat repository include:
Separation of Components from Views: Standalone components have been moved to a ui-element monorepo with its own Storybook.
CSS Styles Separation: CSS styles are now in a component.styles.js file, providing a clear separation from core logic.
Markup and UI-Kit Separation: Markups and the UI Kit are organized into a separate library (monorepo).
CSS styles are now in component.styles.js
Separation into monorepo for ui-elements, markups, and ui-kit
The video below illustrates the development, usage, and setup of the ui-elements monorepo, and it also shows that EmbeddedChat functions as expected following this separation:
UI Theming Upgrade: Prebuilt Themes and Style Variantsβ
The theming system has been enhanced with several prebuilt themes, ensuring a consistent use of theme colors across the repository. This replaces the previously inconsistent and varied color schemes.
Once the Storybook is running, you can explore and experiment with various designs within the Design Variants folder, including RCVariant, Bubble Variant, and Modern Variant. These options enable you to either use the prebuilt themes or draw inspiration to create your own. Below are images and videos demonstrating the different variants; note that the videos also highlight fixes introduced with these PRs:
Automatically generated colors in usernames in dark mode + popup instead of sidebar
Automatically generated colors in usernames in light mode + popup instead of sidebar
The theming system follows a convention similar to the ShadCN theming system. Users can generate themes from the ShadCN website or other sites that follow the same convention, then use the packages/react/tools/theme-generator.js to convert the theme into a supported format and apply it via the theme prop.
A demonstration video is available here:
For further details on theming, you can visit the documentation or check out the technical guide for insights on how theming is implemented in the repository.
EmbeddedChat authentication security has been enhanced through the use of HTTP-Only cookies for re-authentication. This approach adds an extra layer of protection by preventing access via inline JavaScript, thereby reducing the risk of potential attacks. To use this storage method, the EmbeddedChat RC app must be installed on the RC server, which acts as a bridge for saving and retrieving tokens. Once installed, you can test the feature using the Storybook SecureAuth option or by setting the secure: true prop during EmbeddedChat setup.
I have added support for remote configuration of EmbeddedChat props, including themes, via the EmbeddedChat RC App. The app can also validate CSS dimensions provided in the settings. To try this feature, set up the RC app in your Rocket.Chat workspace and use the Storybook option WithRemoteOpt or pass the remoteOpt: true prop during EmbeddedChat setup.
I also worked on a new sub-project called layout-editor during GSoC to enhance EmbeddedChat customizability. This tool enables users to customize the EmbeddedChat layout in real-time with drag-and-drop features, color configuration, and more. Once satisfied with their design, users can click the Generate Theme button to create a theme object, which can be applied by passing it into the theme prop during EmbeddedChat setup or by configuring it remotely if EmbeddedChat RC App is properly set up.
A video demonstration showcases the features:
To learn more about the layout editor, visit the guide: Layout Editor Guide.
In addition to working on EmbeddedChat, I've made contributions to several other RocketChat projects. Check out my pull requests for Apps.Notion, Rocket.Chat, and Fuselage.
Thank you so much to Sidharth Mohanty for being an amazing mentor during GSoC. Heβs been incredibly receptive to ideas, always available to help, and provides great guidance during our meetups. His encouragement to explore new areas has made this experience really rewarding. Iβve learned a lot from him and truly appreciate all his support.
This repository contains the final report and serves as a guide for future contributors to the EmbeddedChat project, which was developed and improved during Google Summer of Code (GSoC) 2024. The final report details the solutions implemented during the project, while the guide provides insights and instructions for new contributors to effectively engage with and build upon the project's foundation.