AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-angular |
| Key methods | CometChat.blockUsers(), CometChat.unblockUsers() |
| Events | CometChatUserEvents.ccUserBlocked, CometChatUserEvents.ccUserUnblocked |
| UI helpers | cometchat-confirm-dialog |
| Init | CometChatUIKit.init(uiKitSettings) then CometChatUIKit.login("UID") |
| Sample app | GitHub |
| Related | All Guides |
Components
| Component / Method | Role |
|---|---|
CometChat.blockUsers() | SDK method to block specific users |
CometChat.unblockUsers() | SDK method to unblock previously blocked users |
CometChatUserEvents.ccUserBlocked | RxJS subject fired when a user is blocked |
CometChatUserEvents.ccUserUnblocked | RxJS subject fired when a user is unblocked |
cometchat-confirm-dialog | Confirmation dialog for block/unblock actions |
Implementation Steps
1. Block User
CallCometChat.blockUsers() with the target UID. On success, update the local user object with setBlockedByMe(true) and emit ccUserBlocked so all subscribed components react to the change.
2. Unblock User
CallCometChat.unblockUsers() with the target UID. On success, update the local user object and emit ccUserUnblocked to restore the composer.
3. Confirmation Dialog
Show a confirmation dialog before blocking. This prevents accidental blocks.4. Composer Blocked State
When a user is blocked, the composer is replaced with an unblock prompt.5. Event Listeners
Subscribe to block/unblock events to update the UI in real time. Clean up subscriptions inngOnDestroy.
Feature Matrix
| Feature | Component / Method | Description |
|---|---|---|
| Block user | CometChat.blockUsers([uid]) | Blocks a user by UID |
| Unblock user | CometChat.unblockUsers([uid]) | Unblocks a previously blocked user |
| Check blocked status | user.getBlockedByMe() | Returns whether the user is blocked |
| Block confirmation | cometchat-confirm-dialog | Prevents accidental blocks |
| Blocked composer state | showComposer flag | Hides composer and shows unblock prompt |
| Block event | CometChatUserEvents.ccUserBlocked | RxJS subject for block notifications |
| Unblock event | CometChatUserEvents.ccUserUnblocked | RxJS subject for unblock notifications |
| Subscription cleanup | ngOnDestroy | Unsubscribes from all event listeners |
Next Steps
Users
Display and manage user lists.
Message Composer
Customize the message input component.
All Guides
Browse all feature and formatter guides.
Sample App
Full working sample application on GitHub.