AI Integration Quick Reference
AI Integration Quick Reference
| Field | Value |
|---|---|
| Package | @cometchat/chat-uikit-react-native |
| Key class | CometChatTextFormatter (abstract base class for custom formatters) |
| Required setup | CometChatUIKit.init(UIKitSettings) then CometChatUIKit.login("UID") |
| Purpose | Create custom text shortcuts for quick message composition by extending CometChatTextFormatter |
| Extension | Message Shortcuts extension must be enabled in CometChat Dashboard |
| Sample app | GitHub |
| Related | Mentions Formatter · Custom Text Formatter · All Guides |
Overview
TheShortCutFormatter class extends the CometChatTextFormatter class to provide a mechanism for handling shortcuts within messages. This guide walks you through the process of using ShortCutFormatter to implement shortcut extensions in your CometChat application.
The Message Shortcuts extension must be enabled in your CometChat Dashboard for this feature to work.
Setup
Create the ShortCutFormatter Class
Define the ShortCutFormatter class by extending the CometChatTextFormatter class:
- TypeScript
- JavaScript
Usage
Initialize an instance ofShortCutFormatter and pass it to the message composer via the textFormatters prop:
- TypeScript
- JavaScript
Result
When users type the trigger character (!), they’ll see a list of available shortcuts to quickly insert predefined text.
