Channels, messages, and threads
Create and query channels, send messages, work with direct replies, reactions, attachments, and read state.
Open a channel handle
final identity = VChatChannelIdentity(
channelTypeKey: 'messaging',
channelId: 'support-123',
);
final channel = client.channel(identity);
final snapshot = await client.getChannel(identity: identity);Creating a handle performs no I/O. Cached results may be stale and are not proof of current authorization or server completeness.
Send, query, update, and delete
final sent = await client.sendMessage(
channel: identity,
request: VChatMessageSendRequest(text: 'Hello'),
);
final page = await client.queryMessages(channel: identity, limit: 25);
final updated = await client.updateMessage(
channel: identity,
messageId: sent.message.messageId,
request: VChatMessageUpdateRequest(
expectedVersion: sent.message.version,
text: const VChatOptionalValue<String>.value('Updated'),
),
);
await client.deleteMessage(
channel: identity,
messageId: updated.message.messageId,
);Direct replies and thread read state
final reply = await client.sendMessageReply(
channel: identity,
rootMessageId: sent.message.messageId,
request: VChatMessageSendRequest(text: 'Direct reply'),
);
final thread = await client.getMessageThread(
channel: identity,
rootMessageId: sent.message.messageId,
limit: 25,
);
await client.markMessageThreadRead(
channel: identity,
rootMessageId: sent.message.messageId,
replyMessageId: reply.message.messageId,
);Top-level history excludes direct replies. Replies live under their root message and become authoritative only through a coherent completed thread snapshot.
Reactions and attachments
Add/remove reaction operations affect only the connected user and use separate reaction-summary versions. Attachment upload is a three-stage intent, one-use transfer, and completion flow. Persist only validated metadata—never signed upload URLs, headers, or attachment bytes.