im.messages covers everything related to individual messages - sending plain text, rich multipart messages, reacting, editing, unsending, paginated listing, and real-time event subscriptions.
Sending
The SDK has three sending tiers. Use the simplest tier that covers your use case.Tier 1 - plain text
Tier 2 - with options
SendOptions reference
| Option | Type | Description |
|---|---|---|
effect | MessageEffect | Visual send effect (slam, confetti, fireworks, …) |
replyTo | MessageGuid | { guid: MessageGuid; partIndex?: number } | Reply to a specific message or part |
subject | string | Message subject line |
attachment | AttachmentGuid | Pre-uploaded attachment to include |
audioMessage | boolean | Send attachment as an audio message |
sticker | { attachment: AttachmentGuid; target: MessageGuid; placement?: StickerPlacement } | Send as a sticker on another message |
formatting | TextFormatInput[] | Bold, italic, underline, or text effects |
service | "iMessage" | "SMS" | "RCS" | Override service |
clientMessageId | string | Idempotency key |
ddScan | boolean | Enable data detectors scan |
richLink | boolean | Expand URLs to rich link previews |
Tier 3 - MessageBuilder
Use the builder when you need mentions, per-part formatting, or attachments mixed with text.SendReceipt:
Available effects
Reactions
CommandReceipt:
Edit & unsend
Querying messages
Get a single message
List with auto-pagination
list() returns a Paginated<Message> that is both awaitable and for awaitable - no pagination API to learn.
MessageListOptions reference
| Option | Type | Description |
|---|---|---|
chatGuid | ChatGuid | Filter to one conversation |
before | Date | Only messages before this timestamp |
after | Date | Only messages after this timestamp |
sort | SortDirection | "ascending" or "descending" |
limit | number | Page size |
offset | number | Starting offset |
withChats | boolean | Include related chat objects |
withAttachments | boolean | Include attachment metadata |
Message statistics
Real-time events
subscribe() returns a TypedEventStream<MessageEvent>. Pass an event type string to narrow the type automatically.
Event types
| Type | Extra fields |
|---|---|
message.sent | message, chatGuid, clientMessageId? |
message.received | message, chatGuid |
message.updated | message, chatGuid, updateType (edited | unsent | notified | reaction) |
message.sendError | chatGuid, errorCode, errorMessage, clientMessageId? |
Stream operators
TypedEventStream supports .filter(), .map(), and .take():
Symbol.asyncDispose: