Skip to main content

Custom Messages

Custom Regular Messages

We’ll use a custom GIF message as an example.

Step 1: Inherit MessageContent and Define GIF Message Structure

Step 2: Encoding and Decoding

Step 3: Register

Complete GIF Message Implementation Example

Custom Attachment Messages

The process for custom attachment messages is not much different from regular messages. We’ll use an image message as an example.

Step 1: Inherit MediaMessageContent

Note that here we inherit from MediaMessageContent, not MessageContent. When sending attachment messages, the SDK will call the upload task to upload local files to the server, then encode and send the message. The final message content passed is {"type":3,"url":"xxxx","width":xxx,"height":xxx}

Step 2: Encoding and Decoding

Step 3: Register

Complete Image Message Implementation Example

Advanced Custom Message Features

Message Content Validation

Message Content Preprocessing

Message Extensions and Metadata

Local Message Extensions

Message Search Enhancement

Best Practices

1. Message Type Management

2. Error Handling

3. Performance Optimization

Next Steps

Data Source Configuration

Learn how to configure data sources for custom messages

Chat Management

Return to chat message management

Channel Management

Return to channel management

Basic Features

Return to basic features