execute() lets the AI model handle messaging automatically, sometimes you need to send messages directly from your handler. The conversation.send() method gives you full control over what gets sent.
Sending a text message
Message types
The available message types depend on which channel your agent is deployed on. For Webchat, the following types are supported:| Type | Payload | Description |
|---|---|---|
text | { text, value? } | Plain text message |
markdown | { markdown } | Markdown-formatted text |
image | { imageUrl } | Image from a URL |
audio | { audioUrl } | Audio file |
video | { videoUrl } | Video file |
file | { fileUrl, title? } | Downloadable file |
location | { latitude, longitude, address?, title? } | Map location |
card | { title, subtitle?, imageUrl?, actions } | Rich card with action buttons |
carousel | { items } | Horizontal scrollable list of cards |
choice | { text, options, disableFreeText? } | Quick reply buttons |
dropdown | { text, options, disableFreeText? } | Dropdown select menu |
bloc | { items } | A group of mixed message types sent together |
custom | { url, name, data? } | Raw custom message referencing a bundled component by URL |
customComponent | { component, props } | Send a custom component directly. The runtime rewrites this into a custom message under the hood, so you get type-checked props instead of a raw URL |
Examples
Card with actions
Carousel
Choice buttons
Markdown
Typing indicators
The framework automatically starts a typing indicator when your handler begins and stops it when the handler finishes. You don’t need to manage this yourself. If you need manual control (e.g., you stopped typing to send a message and want to restart it before a slow operation), you can call the methods directly:Conversation tags
Read and write metadata tags on the conversation:Tags must be declared in
agent.config.ts under conversation.tags. Check out our guide to configuration your agent for more information.