Skip to main content

Contact card messages

The Chat UI SDK does not include a contact card message plugin by default. To send contact cards, you must implement a custom message type, message item provider, and extension panel plugin.

tip

The default channel page does not enable contact card messages. The current source code does not include ContactCardExtensionModule, ContactCardPlugin, or ContactMessage implementations.

Usage

Follow these steps to integrate contact card messages:

  1. Define your custom contact card message type and register it before you connect.

    Java
    NCEngine.registerCustomMessages(Arrays.asList(CustomCardMessage.class));
  2. Implement a message item provider for contact cards and add it to Chat UI during initialization.

    Java
    NCChatUIConfig.channelConfig().addMessageProvider(new CustomCardMessageItemProvider());
  3. Implement a custom plugin IPluginModule that opens the contact picker and sends the contact card message.

  4. Register the plugin to the input area using a custom IExtensionModule. Complete this configuration after SDK initialization and before you enter the channel page.

    Java
    NCExtensionManager.getInstance().registerExtensionModule(new CustomCardExtensionModule());

Send contact card messages

Tap the + button on the right side of the input bar to open the extension panel. Tap your registered contact card plugin icon to send a contact card.

Extension panel

Customization

Contact card functionality consists of three core components: the custom message content class, the custom message item provider, and the custom extension panel plugin.

Customize contact card message UI

To adjust the message style, implement your own message item provider class and provide it to the SDK.

All message item providers extend BaseMessageItemProvider<CustomMessage>. Your custom message item provider must also extend BaseMessageItemProvider<CustomMessage>. For details, see Customize message item styles.

You can also replace the style resources, string resources, and icon resources referenced in your custom template.