Platform note — code samples below use TypeScript. Every method has an equivalent in the iOS (Swift), Android (Kotlin), and Flutter (Dart) SDKs — see the linked SDK reference in each step.
Messages are the core of every chat experience. This guide covers the full send-read-edit-delete lifecycle, plus real-time subscriptions so your UI stays in sync without polling.
The Live Collection already handles real-time updates — new messages, edits, and deletions all trigger dataUpdated. No extra setup required.For advanced use cases (e.g., detecting when other users are typing), subscribe to the raw event stream:
import { ChannelRepository } from '@amityco/ts-sdk';// Subscribe to the channel for typing indicators / presenceconst sub = ChannelRepository.subscribeChannel(channelId);// Dispose when component unmountsreturn () => sub.dispose();
social.plus AI Moderation automatically scans message text and flags violations before they’re visible to other users. Enable it in Admin Console → AI Content Moderation.→ AI Content Moderation
Webhook: message events
Subscribe to message.created, message.updated, and message.deleted webhook events to sync message data or trigger business logic in your backend.→ Webhook Events
Sending to the wrong subChannelId — For Community and Live channels, subChannelId is the same as channelId. For Conversation channels (1:1), use the channel’s defaultSubChannelId. Double-check which ID you’re using when switching channel types.
Forgetting to dispose Live Collections — Every liveCollection.on('dataUpdated', …) subscription holds an open connection. Always call liveCollection.dispose() when your component unmounts to prevent memory leaks and ghost re-renders.