AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-angular |
| Key components | cometchat-group-members, cometchat-message-list, cometchat-message-composer, cometchat-message-header |
| Init | CometChatUIKit.init(uiKitSettings) then CometChatUIKit.login("UID") |
| Purpose | Launch a direct 1:1 chat from a group member profile |
| Sample app | GitHub |
| Related | All Guides |
cometchat-message-list provides this as a built-in action. The “Message Privately” option appears only in group chats, and only for messages sent by other users. It is controlled by the hideMessagePrivatelyOption property, which defaults to false, so the action is shown by default. When a user selects it, the (messagePrivatelyClick) output emits the target message and user.
Before starting, complete the Integration Guide.
Components
| Component / Selector | Role |
|---|---|
cometchat-message-list | Emits the built-in “Message Privately” action via (messagePrivatelyClick) and displays private conversation messages |
cometchat-message-header | Header showing private chat information |
cometchat-message-composer | Input component for composing private messages |
cometchat-group-members | Optional alternative entry point: start a private chat from the member list |
Implementation Steps
1. Handle the Built-in “Message Privately” Action (Canonical)
The canonical way to launch a private chat is the built-in action oncometchat-message-list. Bind the (messagePrivatelyClick) output to open a 1:1 chat with the emitted user.
hideMessagePrivatelyOptiondefaults tofalse, so the action is shown by default. Set it totrueto hide the option.- The action appears only in group chats, and only for messages sent by other users.
- Selecting it opens a normal 1:1 user chat — it is not group-scoped.
2. Alternative: Group Member Click Handler
As a secondary route, you can also start a private chat from the group member list. When a group member is clicked, cast them to aUser object and initiate a private chat. Save the current group so the user can return to it later.
3. Alternative: Group Members with Private Messaging Option
For the group-members route, rendercometchat-group-members and handle the (itemClick) output to trigger the private chat flow.
4. Private Chat Interface
Render a full chat view (header, message list, composer) for the 1:1 conversation. The header includes a back button that returns the user to the original group.5. Return to Group
When the user clicks back, restore the previous group context and close the private chat view.6. Full Component Example
A complete standalone component wiring group members, private chat, and navigation together.Feature Matrix
| Feature | Component / Method | Description |
|---|---|---|
| Built-in Message Privately (canonical) | cometchat-message-list with (messagePrivatelyClick) | Emits the target message and user when the built-in action is selected; shown by default via hideMessagePrivatelyOption (false) |
| Group member selection (alternative) | cometchat-group-members with (itemClick) | Triggers private chat from member list |
| Private chat initiation | startPrivateChat() | Saves group context and opens 1:1 chat |
| Private chat interface | cometchat-message-header, cometchat-message-list, cometchat-message-composer | Full 1:1 chat view with [user] binding |
| Context preservation | previousGroup property | Stores the group to return to |
| Return to group | returnToGroup() | Restores group context and closes private chat |
| Cleanup | ngOnDestroy | Clears private chat state on component destroy |
Next Steps
Group Members
Display and manage group member lists.
Message List
Render real-time message threads.
All Guides
Browse all feature and formatter guides.
Sample App
Full working sample application on GitHub.